Add saving & restore of window position in config file
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 10 Sep 2011 04:32:17 +0000 (00:32 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 26 Mar 2014 22:53:53 +0000 (18:53 -0400)
src/grip.c

index 80e859a..d217f55 100644 (file)
@@ -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();