Skip to content

Commit

Permalink
Fix showing desensitive widgets if no documents are open when a
Browse files Browse the repository at this point in the history
plugin is first loaded.
Remove plugins_update_document_sensitive().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3095 ea778897-0a13-0410-b9d1-a72fbfd435f5
  • Loading branch information
ntrel committed Oct 15, 2008
1 parent 65768ef commit e72e7c3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -3,6 +3,10 @@
* 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.
* src/plugins.c, src/plugins.h, src/ui_utils.c:
Fix showing desensitive widgets if no documents are open when a
plugin is first loaded.
Remove plugins_update_document_sensitive().


2008-10-14 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Expand Down
20 changes: 3 additions & 17 deletions src/plugins.c
Expand Up @@ -515,8 +515,7 @@ plugin_init(Plugin *plugin)

if (plugin->fields.flags & PLUGIN_IS_DOCUMENT_SENSITIVE)
{
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) ? TRUE : FALSE;
gtk_widget_set_sensitive(plugin->fields.menu_item, enable);
ui_add_document_sensitive(plugin->fields.menu_item);
}

g_module_symbol(plugin->module, "plugin_callbacks", (void *) &callbacks);
Expand Down Expand Up @@ -911,20 +910,6 @@ void plugins_free(void)
}


void plugins_update_document_sensitive(gboolean enabled)
{
GList *item;

for (item = active_plugin_list; item != NULL; item = g_list_next(item))
{
Plugin *plugin = item->data;

if (plugin->fields.flags & PLUGIN_IS_DOCUMENT_SENSITIVE)
gtk_widget_set_sensitive(plugin->fields.menu_item, enabled);
}
}


/* Plugin Manager */

enum
Expand All @@ -943,7 +928,8 @@ typedef struct
GtkListStore *store;
GtkWidget *description_label;
GtkWidget *configure_button;
} PluginManagerWidgets;
}
PluginManagerWidgets;

static PluginManagerWidgets pm_widgets;

Expand Down
2 changes: 0 additions & 2 deletions src/plugins.h
Expand Up @@ -36,8 +36,6 @@ void plugins_save_prefs(GKeyFile *config);

void plugins_load_prefs(GKeyFile *config);

void plugins_update_document_sensitive(gboolean enabled);

#endif

#endif
9 changes: 5 additions & 4 deletions src/ui_utils.c
Expand Up @@ -645,12 +645,9 @@ void ui_document_buttons_update(void)
for (i = 0; i < widgets.document_buttons->len; i++)
{
GtkWidget *widget = g_ptr_array_index(widgets.document_buttons, i);

gtk_widget_set_sensitive(widget, enable);
}

#ifdef HAVE_PLUGINS
plugins_update_document_sensitive(enable);
#endif
}


Expand All @@ -666,6 +663,10 @@ static void on_doc_sensitive_widget_destroy(GtkWidget *widget, G_GNUC_UNUSED gpo
* @param widget The widget to add. */
void ui_add_document_sensitive(GtkWidget *widget)
{
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) ? TRUE : FALSE;

gtk_widget_set_sensitive(widget, enable);

g_ptr_array_add(widgets.document_buttons, widget);
g_signal_connect(widget, "destroy", G_CALLBACK(on_doc_sensitive_widget_destroy), NULL);
}
Expand Down

0 comments on commit e72e7c3

Please sign in to comment.