diff options
author | Søren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com> | 2009-04-15 16:07:35 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com> | 2009-04-15 16:07:35 -0400 |
commit | 7a8846fd1e1370f1e46587ec429eb3b469af3556 (patch) | |
tree | 070b5073a49be46f5af5155912400ee3e0cf9d38 | |
parent | 0e6d7edcb3853d51e71461c8665790a2916a0ceb (diff) |
Allow the toolbar to be hidden
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | siv.c | 10 | ||||
-rw-r--r-- | siv.glade | 18 | ||||
-rw-r--r-- | siv.h | 4 | ||||
-rw-r--r-- | window.c | 17 |
5 files changed, 48 insertions, 6 deletions
@@ -28,6 +28,11 @@ - Remember the directory in the open file dialog +- Pass through unknown properties in the metadata. (To be forwards + compatible). This is not hugely important. I don't really care all + that much about NFS mounted home directories where people run + different versions of siv. + Done: - Handle startup notification across dbus @@ -216,7 +216,10 @@ load_meta_data (void) if (!get_int (keyfile, group, "hadj", &(data->hadj))) data->hadj = 0; - + + if (!get_int (keyfile, group, "show_toolbar", &(data->show_toolbar))) + data->show_toolbar = TRUE; + g_hash_table_insert (result, g_strdup (group), data); } @@ -269,6 +272,7 @@ foreach (gpointer key, gpointer value, gpointer user_data) g_key_file_set_integer (key_file, filename, "zoom_level", meta->zoom_level); g_key_file_set_integer (key_file, filename, "hadj", meta->hadj); g_key_file_set_integer (key_file, filename, "vadj", meta->vadj); + g_key_file_set_integer (key_file, filename, "show_toolbar", meta->show_toolbar); } void @@ -282,7 +286,8 @@ app_set_meta_data (App *app, BackgroundType background, int zoom_level, int vadj, - int hadj) + int hadj, + int show_toolbar) { GKeyFile *keyfile = g_key_file_new (); char *encoded = encode (filename); @@ -307,6 +312,7 @@ app_set_meta_data (App *app, data->zoom_level = zoom_level; data->hadj = hadj; data->vadj = vadj; + data->show_toolbar = show_toolbar; g_hash_table_foreach (table, foreach, keyfile); @@ -77,6 +77,22 @@ <widget class="GtkMenu" id="view1_menu"> <child> + <widget class="GtkCheckMenuItem" id="menu_toolbar"> + <property name="visible">True</property> + <property name="label" translatable="yes">Toolbar</property> + <property name="use_underline">True</property> + <property name="active">False</property> + <signal name="activate" handler="on_toolbar2_activate" last_modification_time="Wed, 15 Apr 2009 19:23:02 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator3"> + <property name="visible">True</property> + </widget> + </child> + + <child> <widget class="GtkRadioMenuItem" id="menu_white"> <property name="visible">True</property> <property name="label" translatable="yes">_White Background</property> @@ -190,7 +206,7 @@ </child> <child> - <widget class="GtkToolbar" id="toolbar1"> + <widget class="GtkToolbar" id="toolbar"> <property name="visible">True</property> <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> <property name="tooltips">True</property> @@ -32,6 +32,7 @@ struct MetaData int zoom_level; int vadj; int hadj; + gboolean show_toolbar; }; /* App */ @@ -52,7 +53,8 @@ void app_set_meta_data (App *data, BackgroundType background, int zoom_level, int vadj, - int hadj); + int hadj, + gboolean show_toolbar); GtkWidget *app_get_open_chooser (App *app); /* Doesn't really belong in the app namespace */ @@ -307,7 +307,7 @@ save_meta_data (SivWindow *window) const char *filename; BackgroundType bg; gboolean smooth; - + gboolean show_toolbar; if (window->filename) filename = window->filename; @@ -335,6 +335,7 @@ save_meta_data (SivWindow *window) } smooth = gtk_check_menu_item_get_active (get_widget (window, "menu_smooth_image")); + show_toolbar = gtk_check_menu_item_get_active (get_widget (window, "menu_toolbar")); app_set_meta_data (window->app, filename, @@ -342,7 +343,8 @@ save_meta_data (SivWindow *window) smooth, bg, window->zoom_level, get_vadj (window)->value, - get_hadj (window)->value); + get_hadj (window)->value, + show_toolbar); } static void @@ -440,6 +442,11 @@ rebuild (SivWindow *window) set_title (window); set_sensitivity (window); + if (gtk_check_menu_item_get_active (get_widget (window, "menu_toolbar"))) + gtk_widget_show (get_widget (window, "toolbar")); + else + gtk_widget_hide (get_widget (window, "toolbar")); + gtk_widget_queue_draw (get_widget (window, "drawing_area")); } @@ -919,6 +926,7 @@ connect_signals (SivWindow *window) { "menu_white", "activate", G_CALLBACK (on_various) }, { "menu_no", "activate", G_CALLBACK (on_various) }, { "menu_checkerboard", "activate", G_CALLBACK (on_various) }, + { "menu_toolbar", "activate", G_CALLBACK (on_various) }, { "drawing_area", "expose_event", G_CALLBACK (on_expose) }, { "drawing_area", "scroll_event", G_CALLBACK (on_scroll) }, { "drawing_area", "size_allocate", G_CALLBACK (on_size_allocate) }, @@ -991,6 +999,8 @@ set_defaults (SivWindow *window) gtk_check_menu_item_set_active (get_widget (window, "menu_smooth_image"), TRUE); gtk_check_menu_item_set_active (get_widget (window, "menu_no"), TRUE); + gtk_check_menu_item_set_active (get_widget (window, "menu_toolbar"), TRUE); + } static void @@ -1028,6 +1038,9 @@ apply_meta_data (SivWindow *window, const char *filename) gtk_check_menu_item_set_active (get_widget (window, "menu_smooth_image"), data.smooth_image); + + gtk_check_menu_item_set_active (get_widget (window, "menu_toolbar"), + data.show_toolbar); window->zoom_level = data.zoom_level; |