Shorten the toolbar popup menu, only provide items for Toolbar Preferences and to Hide the toolbar.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4818 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-04-11 21:56:23 +00:00
parent e28ca32274
commit fef3ee8fc5
7 changed files with 45 additions and 321 deletions

View File

@ -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 <frank(at)frank(dot)uvena(dot)de>

View File

@ -2282,93 +2282,17 @@
<widget class="GtkMenu" id="toolbar_popup_menu1">
<child>
<widget class="GtkRadioMenuItem" id="images_and_text2">
<property name="visible">True</property>
<property name="label" translatable="yes">Images _and Text</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_images_and_text2_activate" last_modification_time="Sat, 30 Apr 2005 19:42:24 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="images_only2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Images Only</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">images_and_text2</property>
<signal name="activate" handler="on_images_only2_activate" last_modification_time="Sat, 30 Apr 2005 19:42:29 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="text_only2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Text Only</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="group">images_and_text2</property>
<signal name="activate" handler="on_text_only2_activate" last_modification_time="Sat, 30 Apr 2005 19:42:33 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="large_icons1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Large Icons</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_toolbar_large_icons1_activate" last_modification_time="Sat, 22 Oct 2005 11:52:26 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="small_icons1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Small Icons</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="group">large_icons1</property>
<signal name="activate" handler="on_toolbar_small_icons1_activate" last_modification_time="Sat, 22 Oct 2005 11:52:26 GMT"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="very_small_icons1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Very Small Icons</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="group">large_icons1</property>
<signal name="activate" handler="on_very_small_icons1_activate" last_modification_time="Sun, 29 Mar 2009 18:51:50 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator20">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="customize_toolbar1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Customize Toolbar</property>
<property name="label" translatable="yes">_Toolbar Preferences</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_customize_toolbar1_activate" last_modification_time="Thu, 25 Jun 2009 17:08:08 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2878">
<widget class="GtkImage" id="image3192">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
@ -2379,6 +2303,12 @@
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator53">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="hide_toolbar1">
<property name="visible">True</property>
@ -2387,7 +2317,7 @@
<signal name="activate" handler="on_hide_toolbar1_activate" last_modification_time="Sat, 30 Apr 2005 20:23:03 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2879">
<widget class="GtkImage" id="image3193">
<property name="visible">True</property>
<property name="stock">gtk-cancel</property>
<property name="icon_size">1</property>

View File

@ -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));
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);