comparison src/info.c @ 764:ae618ebec3e9

Save properties window width and height to rc file and restore them on next session if layout.save_window_positions is set to TRUE.
author zas_
date Thu, 29 May 2008 07:52:05 +0000
parents a7289f9e8d29
children 339db85846da
comparison
equal deleted inserted replaced
763:81f9e8dbb4bf 764:ae618ebec3e9
31 31
32 32
33 #define IMAGE_SIZE_W 200 33 #define IMAGE_SIZE_W 200
34 #define IMAGE_SIZE_H 200 34 #define IMAGE_SIZE_H 200
35 35
36 #define DEF_PROPERTY_WIDTH 600
37 #define DEF_PROPERTY_HEIGHT 400
38 36
39 typedef struct _TabData TabData; 37 typedef struct _TabData TabData;
40 struct _TabData 38 struct _TabData
41 { 39 {
42 void (*func_free)(gpointer data); 40 void (*func_free)(gpointer data);
714 *------------------------------------------------------------------- 712 *-------------------------------------------------------------------
715 * base window 713 * base window
716 *------------------------------------------------------------------- 714 *-------------------------------------------------------------------
717 */ 715 */
718 716
719 static gint info_window_last_width = DEF_PROPERTY_WIDTH;
720 static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
721
722 static void info_window_image_update_cb(ImageWindow *imd, gpointer data) 717 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
723 { 718 {
724 InfoData *id = data; 719 InfoData *id = data;
725 720
726 /* only do this once after when loading a new image, 721 /* only do this once after when loading a new image,
796 } 791 }
797 } 792 }
798 793
799 static void info_window_close(InfoData *id) 794 static void info_window_close(InfoData *id)
800 { 795 {
801 gdk_drawable_get_size(id->window->window, &info_window_last_width, &info_window_last_height); 796 gdk_drawable_get_size(id->window->window, &options->layout.properties_window.w, &options->layout.properties_window.h);
802 info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH); 797 options->layout.properties_window.w = MAX(options->layout.properties_window.w, DEF_PROPERTY_WIDTH);
803 info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT); 798 options->layout.properties_window.h = MAX(options->layout.properties_window.h, DEF_PROPERTY_HEIGHT);
804 799
805 gtk_widget_destroy(id->window); 800 gtk_widget_destroy(id->window);
806 } 801 }
807 802
808 static void info_window_close_cb(GtkWidget *widget, gpointer data) 803 static void info_window_close_cb(GtkWidget *widget, gpointer data)
869 geometry.base_width = DEF_PROPERTY_WIDTH; 864 geometry.base_width = DEF_PROPERTY_WIDTH;
870 geometry.base_height = DEF_PROPERTY_HEIGHT; 865 geometry.base_height = DEF_PROPERTY_HEIGHT;
871 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry, 866 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
872 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); 867 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
873 868
874 869 if (options->layout.save_window_positions)
875 gtk_window_set_default_size(GTK_WINDOW(id->window), info_window_last_width, info_window_last_height); 870 gtk_window_set_default_size(GTK_WINDOW(id->window), options->layout.properties_window.w, options->layout.properties_window.h);
871 else
872 gtk_window_set_default_size(GTK_WINDOW(id->window), DEF_PROPERTY_WIDTH, DEF_PROPERTY_HEIGHT);
873
876 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER); 874 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
877 875
878 g_signal_connect(G_OBJECT(id->window), "delete_event", 876 g_signal_connect(G_OBJECT(id->window), "delete_event",
879 G_CALLBACK(info_window_delete_cb), id); 877 G_CALLBACK(info_window_delete_cb), id);
880 g_signal_connect(G_OBJECT(id->window), "destroy", 878 g_signal_connect(G_OBJECT(id->window), "destroy",