From e87f393192636e8c03b3743efd82da5e1aa6f167 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 27 May 2012 01:03:18 +0200 Subject: [PATCH] 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. --- data/geany.glade | 18 ++++++++++++++++++ src/callbacks.c | 7 +++++++ src/callbacks.h | 4 ++++ src/highlighting.c | 21 +-------------------- src/highlighting.h | 4 ++-- src/main.c | 3 --- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/data/geany.glade b/data/geany.glade index 3c04578506..7086445180 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -452,6 +452,12 @@ + + True + False + gtk-select-color + 1 + True False @@ -8305,6 +8311,18 @@ False + + + _Color Schemes + False + True + False + True + image2 + False + + + False diff --git a/src/callbacks.c b/src/callbacks.c index ece2d9d4ab..68a35f1c2d 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -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) diff --git a/src/callbacks.h b/src/callbacks.h index f6435cfbf0..b99cf07279 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -177,6 +177,10 @@ G_MODULE_EXPORT void on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem, 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); diff --git a/src/highlighting.c b/src/highlighting.c index 0f2ff7783b..4302b798e3 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -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_*). diff --git a/src/highlighting.h b/src/highlighting.h index 3cb65821ad..e993afef80 100644 --- a/src/highlighting.h +++ b/src/highlighting.h @@ -41,8 +41,6 @@ typedef struct GeanyLexerStyle 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_string_style(gint lexer, gint style); 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 diff --git a/src/main.c b/src/main.c index a570b6a803..e19d3ee5fb 100644 --- a/src/main.c +++ b/src/main.c @@ -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();