Revision: 1575 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1575&view=re... Author: frlan Date: 2010-09-12 19:34:10 +0000 (Sun, 12 Sep 2010)
Log Message: ----------- Make menu item triggered by filetype
Modified Paths: -------------- trunk/geanylatex/src/geanylatex.c
Modified: trunk/geanylatex/src/geanylatex.c =================================================================== --- trunk/geanylatex/src/geanylatex.c 2010-09-12 19:33:20 UTC (rev 1574) +++ trunk/geanylatex/src/geanylatex.c 2010-09-12 19:34:10 UTC (rev 1575) @@ -139,8 +139,9 @@
/* Some functions*/ static void toggle_toolbar_items_by_file_type(gint id); +static void add_menu_to_menubar(); +static void remove_menu_form_menubar();
- static GtkWidget *init_toolbar() { GtkWidget *toolbar = NULL; @@ -312,6 +313,22 @@ } }
+static void +check_for_menu(gint ft_id) +{ + if (ft_id == GEANY_FILETYPES_LATEX && + main_menu_item == NULL) + { + add_menu_to_menubar(); + } + if (ft_id != GEANY_FILETYPES_LATEX && + main_menu_item != NULL) + { + remove_menu_form_menubar(); + } +} + + static void activate_toolbar_items() { if (uim == NULL) @@ -370,6 +387,7 @@ if (main_is_realized() == TRUE) { toggle_toolbar_items_by_file_type(doc->file_type->id); + check_for_menu(doc->file_type->id); } }
@@ -386,6 +404,8 @@ }
+ + static void on_geany_startup_complete(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED gpointer user_data) @@ -396,7 +416,9 @@ if (doc != NULL) { toggle_toolbar_items_by_file_type(doc->file_type->id); + check_for_menu(doc->file_type->id); } + }
@@ -409,6 +431,7 @@ if (main_is_realized() == TRUE) { toggle_toolbar_items_by_file_type(doc->file_type->id); + check_for_menu(doc->file_type->id); } }
@@ -636,6 +659,8 @@
if (doc->index < 2) deactivate_toolbar_items(); + if (doc->index < 1) + remove_menu_form_menubar(); }
@@ -2094,6 +2119,7 @@ remove_menu_form_menubar() { gtk_widget_destroy(main_menu_item); + main_menu_item = NULL; }
@@ -2125,7 +2151,6 @@ glatex_init_configuration(); glatex_init_encodings_latex();
- add_menu_to_menubar(); add_wizard_to_toolbar();
init_keybindings();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org