Show the tools menu separator if there are any items below it.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3094 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
bffb8b7c66
commit
65768ef184
@ -1,3 +1,10 @@
|
||||
2008-10-15 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/interface.c, src/callbacks.c, src/callbacks.h, src/plugins.c,
|
||||
src/plugins.h, geany.glade:
|
||||
Show the tools menu separator if there are any items below it.
|
||||
|
||||
|
||||
2008-10-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
|
||||
|
||||
* THANKS, src/about.c: Update of name of Korean translator. Thanks
|
||||
|
@ -1427,7 +1427,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Tools</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_tools1_activate" last_modification_time="Tue, 20 Nov 2007 16:31:10 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="tools1_menu">
|
||||
|
@ -2112,16 +2112,6 @@ on_page_setup1_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_tools1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
#ifdef HAVE_PLUGINS
|
||||
plugins_update_tools_menu();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
on_escape_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event,
|
||||
|
@ -569,10 +569,6 @@ void
|
||||
on_page_setup1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_tools1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean
|
||||
on_escape_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event,
|
||||
|
@ -1622,9 +1622,6 @@ create_window1 (void)
|
||||
g_signal_connect ((gpointer) project_properties1, "activate",
|
||||
G_CALLBACK (on_project_properties1_activate),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) tools1, "activate",
|
||||
G_CALLBACK (on_tools1_activate),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) menu_choose_color1, "activate",
|
||||
G_CALLBACK (on_show_color_chooser1_activate),
|
||||
NULL);
|
||||
|
@ -786,6 +786,30 @@ static void load_all_plugins(void)
|
||||
}
|
||||
|
||||
|
||||
static void on_tools_menu_show(GtkWidget *menu_item, G_GNUC_UNUSED gpointer user_data)
|
||||
{
|
||||
GList *item, *list = gtk_container_get_children(GTK_CONTAINER(menu_item));
|
||||
guint i = 0;
|
||||
gboolean have_plugin_menu_items = FALSE;
|
||||
|
||||
for (item = list; item != NULL; item = g_list_next(item))
|
||||
{
|
||||
if (item->data == menu_separator)
|
||||
{
|
||||
if (i < g_list_length(list) - 1)
|
||||
{
|
||||
have_plugin_menu_items = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
g_list_free(list);
|
||||
|
||||
ui_widget_show_hide(menu_separator, have_plugin_menu_items);
|
||||
}
|
||||
|
||||
|
||||
void plugins_init()
|
||||
{
|
||||
GtkWidget *widget;
|
||||
@ -804,10 +828,9 @@ void plugins_init()
|
||||
|
||||
menu_separator = gtk_separator_menu_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(main_widgets.tools_menu), menu_separator);
|
||||
g_signal_connect(main_widgets.tools_menu, "show", G_CALLBACK(on_tools_menu_show), NULL);
|
||||
|
||||
load_active_plugins();
|
||||
|
||||
plugins_update_tools_menu();
|
||||
}
|
||||
|
||||
|
||||
@ -902,28 +925,6 @@ void plugins_update_document_sensitive(gboolean enabled)
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
plugin_has_menu(Plugin *a, Plugin *b)
|
||||
{
|
||||
if (a->fields.menu_item != NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void plugins_update_tools_menu()
|
||||
{
|
||||
gboolean found;
|
||||
|
||||
if (menu_separator == NULL)
|
||||
return;
|
||||
|
||||
found = (g_list_find_custom(active_plugin_list, NULL, (GCompareFunc) plugin_has_menu) != NULL);
|
||||
ui_widget_show_hide(menu_separator, found);
|
||||
}
|
||||
|
||||
|
||||
/* Plugin Manager */
|
||||
|
||||
enum
|
||||
|
@ -36,8 +36,6 @@ void plugins_save_prefs(GKeyFile *config);
|
||||
|
||||
void plugins_load_prefs(GKeyFile *config);
|
||||
|
||||
void plugins_update_tools_menu(void);
|
||||
|
||||
void plugins_update_document_sensitive(gboolean enabled);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user