From: Hugo Villeneuve Date: Sat, 10 Sep 2011 04:32:17 +0000 (-0400) Subject: Add saving & restore of window position in config file X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=1a27da79b64e18318820ab1be3a47a9a200d186e;p=hvgrip.git Add saving & restore of window position in config file --- diff --git a/src/grip.c b/src/grip.c index 80e859a..d217f55 100644 --- a/src/grip.c +++ b/src/grip.c @@ -130,6 +130,8 @@ void DoSaveConfig(GripInfo *ginfo); {"win_height_edit",CFG_ENTRY_INT,0,&uinfo->win_height_edit},\ {"win_width_min",CFG_ENTRY_INT,0,&uinfo->win_width_min},\ {"win_height_min",CFG_ENTRY_INT,0,&uinfo->win_height_min},\ +{"win_pos_x",CFG_ENTRY_INT,0,&uinfo->x},\ +{"win_pos_y",CFG_ENTRY_INT,0,&uinfo->y},\ {"vol_vis",CFG_ENTRY_BOOL,0,&uinfo->volvis},\ {"track_edit_vis",CFG_ENTRY_BOOL,0,&uinfo->track_edit_visible},\ {"track_prog_vis",CFG_ENTRY_BOOL,0,&uinfo->track_prog_visible},\ @@ -267,6 +269,9 @@ GtkWidget *GripNew(const gchar* geometry,char *device,char *scsi_device, } } + /* Position window from values in config file. */ + gtk_window_move(GTK_WINDOW(app),uinfo->x, uinfo->y); + gtk_widget_realize(app); uinfo->winbox=gtk_vbox_new(FALSE,3); @@ -353,8 +358,10 @@ void GripDie(GtkWidget *widget,gpointer data) static void ReallyDie(gpointer data) { GripInfo *ginfo; + GripGUI *uinfo; ginfo=(GripInfo *)data; + uinfo = &(ginfo->gui_info); #ifndef GRIPCD if(ginfo->ripping_a_disc) KillRip(NULL,ginfo); @@ -364,6 +371,9 @@ static void ReallyDie(gpointer data) if(!ginfo->no_interrupt) CDStop(&(ginfo->disc)); + /* For saving the window position */ + gtk_window_get_position(GTK_WINDOW(uinfo->app), &uinfo->x, &uinfo->y); + DoSaveConfig(ginfo); gtk_main_quit();