diff --git a/ChangeLog b/ChangeLog index 572a396c..de6f3e04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ src/ui_utils.c, src/ui_utils.h: Add option 'System Default' for toolbar icon style and size to use the GTK default value. + * geany.glade, src/callbacks.c, src/callbacks.h, src/interface.c, + src/toolbar.c, src/toolbar.h: + Shorten the toolbar popup menu, only provide items for Toolbar + Preferences and to Hide the toolbar. 2010-04-09 Frank Lanitz diff --git a/geany.glade b/geany.glade index 43782e1d..a8df8438 100644 --- a/geany.glade +++ b/geany.glade @@ -2282,93 +2282,17 @@ - - - True - Images _and Text - True - False - - - - - - - True - _Images Only - True - False - images_and_text2 - - - - - - - True - _Text Only - True - True - images_and_text2 - - - - - - - True - - - - - - True - _Large Icons - True - False - - - - - - - True - _Small Icons - True - False - large_icons1 - - - - - - - True - _Very Small Icons - True - True - large_icons1 - - - - - - - True - - - True - _Customize Toolbar + _Toolbar Preferences True - + True - gtk-properties + gtk-preferences 1 0.5 0.5 @@ -2379,6 +2303,12 @@ + + + True + + + True @@ -2387,7 +2317,7 @@ - + True gtk-cancel 1 diff --git a/src/callbacks.c b/src/callbacks.c index 896582a9..2013945b 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -77,9 +77,6 @@ #endif -/* flag to indicate the explicit change of a toggle button of the toolbar menu and so the - * toggled callback should ignore the change since it is not triggered by the user */ -static gboolean ignore_toolbar_toggle = FALSE; /* flag to indicate that an insert callback was triggered from the file menu, * so we need to store the current cursor position in editor_info.click_pos. */ @@ -500,42 +497,6 @@ on_reload_as_activate (GtkMenuItem *menuitem, } -void -on_images_and_text2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_style = GTK_TOOLBAR_BOTH; - toolbar_set_icon_style(); -} - - -void -on_images_only2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_style = GTK_TOOLBAR_ICONS; - toolbar_set_icon_style(); -} - - -void -on_text_only2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_style = GTK_TOOLBAR_TEXT; - toolbar_set_icon_style(); -} - - void on_change_font1_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -618,42 +579,6 @@ on_toolbutton_search_clicked (GtkAction *action, } -void -on_toolbar_large_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR; - toolbar_set_icon_size(); -} - - -void -on_toolbar_small_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR; - toolbar_set_icon_size(); -} - - -void -on_very_small_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data) -{ - if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem)) - return; - - toolbar_prefs.icon_size = GTK_ICON_SIZE_MENU; - toolbar_set_icon_size(); -} - - /* hides toolbar from toolbar popup menu */ void on_hide_toolbar1_activate (GtkMenuItem *menuitem, @@ -867,32 +792,7 @@ toolbar_popup_menu (GtkWidget *widget, { if (event->button == 3) { - GtkWidget *w; - - ignore_toolbar_toggle = TRUE; - - switch (toolbar_prefs.icon_style) - { - case 0: w = ui_lookup_widget(ui_widgets.toolbar_menu, "images_only2"); break; - case 1: w = ui_lookup_widget(ui_widgets.toolbar_menu, "text_only2"); break; - default: w = ui_lookup_widget(ui_widgets.toolbar_menu, "images_and_text2"); break; - } - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE); - - switch (toolbar_prefs.icon_size) - { - case GTK_ICON_SIZE_LARGE_TOOLBAR: - w = ui_lookup_widget(ui_widgets.toolbar_menu, "large_icons1"); break; - case GTK_ICON_SIZE_SMALL_TOOLBAR: - w = ui_lookup_widget(ui_widgets.toolbar_menu, "small_icons1"); break; - default: w = ui_lookup_widget(ui_widgets.toolbar_menu, "very_small_icons1"); break; - } - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE); - - ignore_toolbar_toggle = FALSE; - gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time); - return TRUE; } return FALSE; @@ -2273,7 +2173,17 @@ void on_customize_toolbar1_activate (GtkMenuItem *menuitem, gpointer user_data) { - toolbar_configure(GTK_WINDOW(main_widgets.window)); + GtkWidget *widget; + GtkNotebook *notebook; + + prefs_show_dialog(); + + /* select the KB page */ + widget = ui_lookup_widget(ui_widgets.prefs_dialog, "vbox15"); + notebook = GTK_NOTEBOOK(ui_lookup_widget(ui_widgets.prefs_dialog, "notebook2")); + + if (notebook != NULL && widget != NULL) + gtk_notebook_set_current_page(notebook, gtk_notebook_page_num(notebook, widget)); } diff --git a/src/callbacks.h b/src/callbacks.h index 80b19b22..58ef5807 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -101,18 +101,6 @@ toolbar_popup_menu (GtkWidget *widget, GdkEventButton *event, gpointer user_data); -void -on_images_and_text2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - -void -on_images_only2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - -void -on_text_only2_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - void on_hide_toolbar1_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -321,14 +309,6 @@ void on_insert_date_activate (GtkMenuItem *menuitem, gpointer user_data); -void -on_toolbar_large_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - -void -on_toolbar_small_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - void on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data); @@ -595,10 +575,6 @@ void on_send_selection_to_vte1_activate (GtkMenuItem *menuitem, gpointer user_data); -void -on_very_small_icons1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - gboolean on_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); diff --git a/src/interface.c b/src/interface.c index 92b67550..57e25080 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1876,99 +1876,35 @@ GtkWidget* create_toolbar_popup_menu1 (void) { GtkWidget *toolbar_popup_menu1; - GSList *images_and_text2_group = NULL; - GtkWidget *images_and_text2; - GtkWidget *images_only2; - GtkWidget *text_only2; - GtkWidget *separator1; - GSList *large_icons1_group = NULL; - GtkWidget *large_icons1; - GtkWidget *small_icons1; - GtkWidget *very_small_icons1; - GtkWidget *separator20; GtkWidget *customize_toolbar1; - GtkWidget *image2878; + GtkWidget *image3192; + GtkWidget *separator53; GtkWidget *hide_toolbar1; - GtkWidget *image2879; + GtkWidget *image3193; toolbar_popup_menu1 = gtk_menu_new (); - images_and_text2 = gtk_radio_menu_item_new_with_mnemonic (images_and_text2_group, _("Images _and Text")); - images_and_text2_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (images_and_text2)); - gtk_widget_show (images_and_text2); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), images_and_text2); - - images_only2 = gtk_radio_menu_item_new_with_mnemonic (images_and_text2_group, _("_Images Only")); - images_and_text2_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (images_only2)); - gtk_widget_show (images_only2); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), images_only2); - - text_only2 = gtk_radio_menu_item_new_with_mnemonic (images_and_text2_group, _("_Text Only")); - images_and_text2_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (text_only2)); - gtk_widget_show (text_only2); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), text_only2); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (text_only2), TRUE); - - separator1 = gtk_separator_menu_item_new (); - gtk_widget_show (separator1); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), separator1); - gtk_widget_set_sensitive (separator1, FALSE); - - large_icons1 = gtk_radio_menu_item_new_with_mnemonic (large_icons1_group, _("_Large Icons")); - large_icons1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (large_icons1)); - gtk_widget_show (large_icons1); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), large_icons1); - - small_icons1 = gtk_radio_menu_item_new_with_mnemonic (large_icons1_group, _("_Small Icons")); - large_icons1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (small_icons1)); - gtk_widget_show (small_icons1); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), small_icons1); - - very_small_icons1 = gtk_radio_menu_item_new_with_mnemonic (large_icons1_group, _("_Very Small Icons")); - large_icons1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (very_small_icons1)); - gtk_widget_show (very_small_icons1); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), very_small_icons1); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (very_small_icons1), TRUE); - - separator20 = gtk_separator_menu_item_new (); - gtk_widget_show (separator20); - gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), separator20); - gtk_widget_set_sensitive (separator20, FALSE); - - customize_toolbar1 = gtk_image_menu_item_new_with_mnemonic (_("_Customize Toolbar")); + customize_toolbar1 = gtk_image_menu_item_new_with_mnemonic (_("_Toolbar Preferences")); gtk_widget_show (customize_toolbar1); gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), customize_toolbar1); - image2878 = gtk_image_new_from_stock ("gtk-properties", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2878); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (customize_toolbar1), image2878); + image3192 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); + gtk_widget_show (image3192); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (customize_toolbar1), image3192); + + separator53 = gtk_separator_menu_item_new (); + gtk_widget_show (separator53); + gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), separator53); + gtk_widget_set_sensitive (separator53, FALSE); hide_toolbar1 = gtk_image_menu_item_new_with_mnemonic (_("_Hide Toolbar")); gtk_widget_show (hide_toolbar1); gtk_container_add (GTK_CONTAINER (toolbar_popup_menu1), hide_toolbar1); - image2879 = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2879); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (hide_toolbar1), image2879); + image3193 = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_MENU); + gtk_widget_show (image3193); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (hide_toolbar1), image3193); - g_signal_connect ((gpointer) images_and_text2, "activate", - G_CALLBACK (on_images_and_text2_activate), - NULL); - g_signal_connect ((gpointer) images_only2, "activate", - G_CALLBACK (on_images_only2_activate), - NULL); - g_signal_connect ((gpointer) text_only2, "activate", - G_CALLBACK (on_text_only2_activate), - NULL); - g_signal_connect ((gpointer) large_icons1, "activate", - G_CALLBACK (on_toolbar_large_icons1_activate), - NULL); - g_signal_connect ((gpointer) small_icons1, "activate", - G_CALLBACK (on_toolbar_small_icons1_activate), - NULL); - g_signal_connect ((gpointer) very_small_icons1, "activate", - G_CALLBACK (on_very_small_icons1_activate), - NULL); g_signal_connect ((gpointer) customize_toolbar1, "activate", G_CALLBACK (on_customize_toolbar1_activate), NULL); @@ -1978,18 +1914,11 @@ create_toolbar_popup_menu1 (void) /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (toolbar_popup_menu1, toolbar_popup_menu1, "toolbar_popup_menu1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, images_and_text2, "images_and_text2"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, images_only2, "images_only2"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, text_only2, "text_only2"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, separator1, "separator1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, large_icons1, "large_icons1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, small_icons1, "small_icons1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, very_small_icons1, "very_small_icons1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, separator20, "separator20"); GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, customize_toolbar1, "customize_toolbar1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, image2878, "image2878"); + GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, image3192, "image3192"); + GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, separator53, "separator53"); GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, hide_toolbar1, "hide_toolbar1"); - GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, image2879, "image2879"); + GLADE_HOOKUP_OBJECT (toolbar_popup_menu1, image3193, "image3193"); return toolbar_popup_menu1; } diff --git a/src/toolbar.c b/src/toolbar.c index 0c49f543..5f57857b 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -506,7 +506,7 @@ void toolbar_show_hide(void) /* sets the icon style of the toolbar */ -void toolbar_set_icon_style(void) +static void toolbar_set_icon_style(void) { gint icon_style; @@ -516,32 +516,11 @@ void toolbar_set_icon_style(void) icon_style = ui_get_gtk_settings_integer("gtk-toolbar-style", toolbar_prefs.icon_style); gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), icon_style); - - switch (icon_style) - { - default: - case GTK_TOOLBAR_BOTH: - { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(ui_widgets.toolbar_menu, "images_and_text2")), TRUE); - break; - } - case GTK_TOOLBAR_ICONS: - { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(ui_widgets.toolbar_menu, "images_only2")), TRUE); - break; - } - case GTK_TOOLBAR_TEXT: - { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(ui_widgets.toolbar_menu, "text_only2")), TRUE); - break; - } - } - g_message("%d style %d (%d)", toolbar_prefs.use_gtk_default_style, icon_style, toolbar_prefs.icon_style); } /* sets the icon size of the toolbar */ -void toolbar_set_icon_size(void) +static void toolbar_set_icon_size(void) { gint icon_size; diff --git a/src/toolbar.h b/src/toolbar.h index 7efc9aa2..88817ace 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -51,10 +51,6 @@ void toolbar_update_ui(void); void toolbar_apply_settings(void); -void toolbar_set_icon_style(void); - -void toolbar_set_icon_size(void); - void toolbar_show_hide(void); void toolbar_item_ref(GtkToolItem *item);