[geany/geany] e87f39: Create color scheme menu item with Glade

Colomban Wendling git-noreply at xxxxx
Sat May 26 23:14:25 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 26 May 2012 23:14:25
Commit:      e87f393192636e8c03b3743efd82da5e1aa6f167
             https://github.com/geany/geany/commit/e87f393192636e8c03b3743efd82da5e1aa6f167

Log Message:
-----------
Create color scheme menu item with Glade

Now there is a dialog instead of a menu for selecting the color
schemes, the item under View->Editor can be created with Glade like the
rest of the menu.


Modified Paths:
--------------
    data/geany.glade
    src/callbacks.c
    src/callbacks.h
    src/highlighting.c
    src/highlighting.h
    src/main.c

Modified: data/geany.glade
18 files changed, 18 insertions(+), 0 deletions(-)
===================================================================
@@ -452,6 +452,12 @@
       <column type="gchararray"/>
     </columns>
   </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-select-color</property>
+    <property name="icon-size">1</property>
+  </object>
   <object class="GtkImage" id="image4060">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -8306,6 +8312,18 @@
                               <object class="GtkMenu" id="menu_view_editor1_menu">
                                 <property name="can_focus">False</property>
                                 <child>
+                                  <object class="GtkImageMenuItem" id="menu_color_schemes">
+                                    <property name="label" translatable="yes">_Color Schemes</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="image">image2</property>
+                                    <property name="use_stock">False</property>
+                                    <signal name="activate" handler="on_menu_color_schemes_activate" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckMenuItem" id="menu_markers_margin1">
                                     <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>


Modified: src/callbacks.c
7 files changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -63,6 +63,7 @@
 #include "plugins.h"
 #include "log.h"
 #include "toolbar.h"
+#include "highlighting.h"
 #include "pluginutils.h"
 
 
@@ -801,6 +802,12 @@ G_MODULE_EXPORT void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmen
 }
 
 
+G_MODULE_EXPORT void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data)
+{
+	highlighting_show_color_scheme_dialog();
+}
+
+
 G_MODULE_EXPORT void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data)
 {
 	if (ignore_callback)


Modified: src/callbacks.h
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -178,6 +178,10 @@
 										gpointer		 user_data);
 
 G_MODULE_EXPORT void
+on_menu_color_schemes_activate		   (GtkImageMenuItem *imagemenuitem,
+										gpointer user_data);
+
+G_MODULE_EXPORT void
 on_construct_completion1_activate	  (GtkMenuItem	 *menuitem,
 										gpointer		 user_data);
 


Modified: src/highlighting.c
21 files changed, 1 insertions(+), 20 deletions(-)
===================================================================
@@ -1312,7 +1312,7 @@ static void on_color_scheme_dialog_response(GtkWidget *dialog,
 }
 
 
-static void show_color_scheme_dialog(void)
+void highlighting_show_color_scheme_dialog(void)
 {
 	static GtkWidget *dialog = NULL;
 	GtkListStore *store = gtk_list_store_new(SCHEME_COLUMNS,
@@ -1358,25 +1358,6 @@ static void show_color_scheme_dialog(void)
 }
 
 
-static void create_color_scheme_menu(void)
-{
-	GtkWidget *item, *menu;
-
-	menu = ui_lookup_widget(main_widgets.window, "menu_view_editor1_menu");
-	item = ui_image_menu_item_new(GTK_STOCK_SELECT_COLOR, _("_Color Schemes"));
-	gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item);
-
-	g_signal_connect(item, "activate", G_CALLBACK(show_color_scheme_dialog), NULL);
-	gtk_widget_show(item);
-}
-
-
-void highlighting_init(void)
-{
-	create_color_scheme_menu();
-}
-
-
 /** Checks whether the given style is a string for the given lexer.
  *
  * @param lexer Scintilla lexer type (@c SCLEX_*).


Modified: src/highlighting.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -41,8 +41,6 @@
 GeanyLexerStyle;
 
 
-void highlighting_init(void);
-
 void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *configh);
 
 void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft);
@@ -55,6 +53,8 @@
 gboolean highlighting_is_comment_style(gint lexer, gint style);
 gboolean highlighting_is_code_style(gint lexer, gint style);
 
+void highlighting_show_color_scheme_dialog(void);
+
 G_END_DECLS
 
 #endif


Modified: src/main.c
3 files changed, 0 insertions(+), 3 deletions(-)
===================================================================
@@ -1040,9 +1040,6 @@ gint main(gint argc, gchar **argv)
 	keybindings_init();
 	notebook_init();
 	filetypes_init();
-	/* depends on filetypes_array being not NULL so must be after
-	 * filetypes_init(). */
-	highlighting_init();
 	templates_init();
 	navqueue_init();
 	document_init_doclist();


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list