Revision: 1122 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1122&view=re... Author: frlan Date: 2010-01-11 19:47:56 +0000 (Mon, 11 Jan 2010)
Log Message: ----------- GeanyLaTeX: Move code for toggling toolbar items based on filetype into separate function.
Modified Paths: -------------- trunk/geanylatex/src/geanylatex.c
Modified: trunk/geanylatex/src/geanylatex.c =================================================================== --- trunk/geanylatex/src/geanylatex.c 2010-01-10 13:39:59 UTC (rev 1121) +++ trunk/geanylatex/src/geanylatex.c 2010-01-11 19:47:56 UTC (rev 1122) @@ -111,6 +111,8 @@ } config_widgets;
+/* Some functions*/ +static void toggle_toolbar_items_by_file_type(gint id);
static GtkWidget *init_toolbar() { @@ -243,13 +245,10 @@ glatex_set_latextoggle_status(TRUE); }
- -static on_document_activate(GObject *object, GeanyDocument *doc, gpointer data) +static void toggle_toolbar_items_by_file_type(gint id) { - /* First check, whether we are ask to do anything here */ - g_return_val_if_fail(doc != NULL, FALSE); if (glatex_deactivate_toolbaritems_with_non_latex == TRUE) - if (doc->file_type->id != GEANY_FILETYPES_LATEX) + if (id != GEANY_FILETYPES_LATEX) { /* Deactivate toolbar items */ gtk_action_set_sensitive(gtk_ui_manager_get_action(uim, "/ui/glatex_format_toolbar/Bold"), FALSE); @@ -269,6 +268,13 @@ gtk_action_set_sensitive(gtk_ui_manager_get_action(uim, "/ui/glatex_format_toolbar/Left"), TRUE); gtk_action_set_sensitive(gtk_ui_manager_get_action(uim, "/ui/glatex_format_toolbar/Right"), TRUE); } +} + + +static on_document_activate(GObject *object, GeanyDocument *doc, gpointer data) +{ + g_return_val_if_fail(doc != NULL, FALSE); + toggle_toolbar_items_by_file_type(doc->file_type->id); return FALSE; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.