From 9ff4eec8538549078d2011bd6be31d7c6f9b0194 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 30 Jan 2012 21:32:16 -0800 Subject: [PATCH] Fix Color Schemes menu items activation when used with libdbusmenu. I'm not even going to try to explain why this fixes it :) --- src/highlighting.c | 9 +++------ src/main.c | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 89280b6c..5cdf48ea 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -1172,10 +1172,6 @@ on_color_scheme_clicked(GtkMenuItem *menuitem, gpointer user_data) gchar *fname; gchar *path; - /* prevent callback on setting initial value */ - if (!GTK_WIDGET_MAPPED(menuitem)) - return; - /* check if default item */ if (!user_data) { @@ -1255,14 +1251,15 @@ static void add_color_scheme_item(GtkWidget *menu, const gchar *fname) g_key_file_free(skeyfile); } + g_signal_connect(item, "activate", + G_CALLBACK(on_color_scheme_clicked), GINT_TO_POINTER(fname != NULL)); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item)); if (utils_str_equal(editor_prefs.color_scheme, fname)) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); - g_signal_connect(item, "activate", - G_CALLBACK(on_color_scheme_clicked), GINT_TO_POINTER(fname != NULL)); } diff --git a/src/main.c b/src/main.c index b0902fc5..1279d0ba 100644 --- a/src/main.c +++ b/src/main.c @@ -1037,7 +1037,6 @@ gint main(gint argc, gchar **argv) sidebar_init(); load_settings(); /* load keyfile */ - highlighting_init(); msgwin_init(); build_init(); ui_create_insert_menu_items(); @@ -1045,6 +1044,9 @@ 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();