summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 12:03:11 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 12:03:11 +0000
commitde5a59c46986f1d8682638e4cb3a1e0111ad7d5f (patch)
treea6917f3eafab72524df02564711b0e5d31080819
parentb9ce26556ccc91fa260c9772f095e54ab98dd208 (diff)
correctly update gtk icons/themes when changed, also don't double update on icon events
ticket #2063 SVN revision: 81541
-rw-r--r--src/bin/e_xsettings.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/bin/e_xsettings.c b/src/bin/e_xsettings.c
index 6112158a3..1b0d19aeb 100644
--- a/src/bin/e_xsettings.c
+++ b/src/bin/e_xsettings.c
@@ -44,8 +44,9 @@ static void _e_xsettings_apply(Settings_Manager *sm);
44 44
45static Ecore_X_Atom _atom_manager = 0; 45static Ecore_X_Atom _atom_manager = 0;
46static Ecore_X_Atom _atom_xsettings = 0; 46static Ecore_X_Atom _atom_xsettings = 0;
47static Ecore_X_Atom _atom_gtk_iconthemes = 0;
48static Ecore_X_Atom _atom_gtk_rcfiles = 0;
47static Eina_List *managers = NULL; 49static Eina_List *managers = NULL;
48static Eina_List *handlers = NULL;
49static Eina_List *settings = NULL; 50static Eina_List *settings = NULL;
50static Eina_Bool running = EINA_FALSE; 51static Eina_Bool running = EINA_FALSE;
51static Eio_File *eio_op = NULL; 52static Eio_File *eio_op = NULL;
@@ -56,6 +57,7 @@ static const char _setting_theme_name[] = "Net/ThemeName";
56static const char _setting_font_name[] = "Gtk/FontName"; 57static const char _setting_font_name[] = "Gtk/FontName";
57static const char _setting_xft_dpi[] = "Xft/DPI"; 58static const char _setting_xft_dpi[] = "Xft/DPI";
58static const char *_setting_theme = NULL; 59static const char *_setting_theme = NULL;
60static unsigned int event_ignore = 0;
59 61
60static void _e_xsettings_done_cb(void *data, Eio_File *handler, const Eina_Stat *stat); 62static void _e_xsettings_done_cb(void *data, Eio_File *handler, const Eina_Stat *stat);
61 63
@@ -362,21 +364,25 @@ _e_xsettings_update(void)
362 if (sm->selection) _e_xsettings_apply(sm); 364 if (sm->selection) _e_xsettings_apply(sm);
363} 365}
364 366
365static Eina_Bool 367static void
366_cb_icon_theme_change(void *data __UNUSED__, int type __UNUSED__, void *event) 368_e_xsettings_gtk_icon_update(void)
367{ 369{
368 E_Event_Config_Icon_Theme *ev = event; 370 Eina_List *l;
369 371 E_Border *bd;
370 if (e_config->xsettings.match_e17_icon_theme)
371 {
372 _e_xsettings_string_set(_setting_icon_theme_name,
373 ev->icon_theme);
374 _e_xsettings_update();
375 }
376 372
377 return ECORE_CALLBACK_PASS_ON; 373 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
374 if (bd->client.icccm.state) ecore_x_client_message8_send(bd->client.win, _atom_gtk_iconthemes, NULL, 0);
378} 375}
379 376
377static void
378_e_xsettings_gtk_rcfiles_update(void)
379{
380 Eina_List *l;
381 E_Border *bd;
382
383 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
384 if (bd->client.icccm.state) ecore_x_client_message8_send(bd->client.win, _atom_gtk_rcfiles, NULL, 0);
385}
380 386
381static void 387static void
382_e_xsettings_icon_theme_set(void) 388_e_xsettings_icon_theme_set(void)
@@ -420,15 +426,11 @@ _e_xsettings_error_cb(void *data, Eio_File *handler __UNUSED__, int error __UNUS
420 _setting_theme = NULL; 426 _setting_theme = NULL;
421 427
422 if (e_config->xsettings.net_theme_name) 428 if (e_config->xsettings.net_theme_name)
423 { 429 _e_xsettings_string_set(_setting_theme_name, e_config->xsettings.net_theme_name);
424 _e_xsettings_string_set(_setting_theme_name, 430 else
425 e_config->xsettings.net_theme_name); 431 _e_xsettings_string_set(_setting_theme_name, NULL);
426 _e_xsettings_update();
427 return;
428 }
429
430 _e_xsettings_string_set(_setting_theme_name, NULL);
431 _e_xsettings_update(); 432 _e_xsettings_update();
433 _e_xsettings_gtk_rcfiles_update();
432} 434}
433 435
434static void 436static void
@@ -445,6 +447,7 @@ _e_xsettings_done_cb(void *data __UNUSED__, Eio_File *handler __UNUSED__, const
445 eio_op = NULL; 447 eio_op = NULL;
446 setting = EINA_FALSE; 448 setting = EINA_FALSE;
447 _e_xsettings_update(); 449 _e_xsettings_update();
450 _e_xsettings_gtk_rcfiles_update();
448} 451}
449 452
450static void 453static void
@@ -586,9 +589,6 @@ _e_xsettings_start(void)
586 managers = eina_list_append(managers, sm); 589 managers = eina_list_append(managers, sm);
587 } 590 }
588 591
589 handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_CONFIG_ICON_THEME,
590 _cb_icon_theme_change, NULL));
591
592 running = EINA_TRUE; 592 running = EINA_TRUE;
593} 593}
594 594
@@ -596,7 +596,6 @@ static void
596_e_xsettings_stop(void) 596_e_xsettings_stop(void)
597{ 597{
598 Settings_Manager *sm; 598 Settings_Manager *sm;
599 Ecore_Event_Handler *h;
600 Setting *s; 599 Setting *s;
601 600
602 if (!running) return; 601 if (!running) return;
@@ -618,9 +617,6 @@ _e_xsettings_stop(void)
618 E_FREE(s); 617 E_FREE(s);
619 } 618 }
620 619
621 EINA_LIST_FREE(handlers, h)
622 ecore_event_handler_del(h);
623
624 running = EINA_FALSE; 620 running = EINA_FALSE;
625} 621}
626 622
@@ -629,6 +625,8 @@ e_xsettings_init(void)
629{ 625{
630 _atom_manager = ecore_x_atom_get("MANAGER"); 626 _atom_manager = ecore_x_atom_get("MANAGER");
631 _atom_xsettings = ecore_x_atom_get("_XSETTINGS_SETTINGS"); 627 _atom_xsettings = ecore_x_atom_get("_XSETTINGS_SETTINGS");
628 _atom_gtk_iconthemes = ecore_x_atom_get("_GTK_LOAD_ICONTHEMES");
629 _atom_gtk_rcfiles = ecore_x_atom_get("_GTK_READ_RCFILES");
632 630
633 if (e_config->xsettings.enabled) 631 if (e_config->xsettings.enabled)
634 _e_xsettings_start(); 632 _e_xsettings_start();
@@ -643,6 +641,7 @@ e_xsettings_shutdown(void)
643 if (eio_op) eio_file_cancel(eio_op); 641 if (eio_op) eio_file_cancel(eio_op);
644 eio_op = NULL; 642 eio_op = NULL;
645 setting = EINA_FALSE; 643 setting = EINA_FALSE;
644 event_ignore = 0;
646 645
647 return 1; 646 return 1;
648} 647}
@@ -668,6 +667,9 @@ e_xsettings_config_update(void)
668 _e_xsettings_icon_theme_set(); 667 _e_xsettings_icon_theme_set();
669 _e_xsettings_font_set(); 668 _e_xsettings_font_set();
670 _e_xsettings_update(); 669 _e_xsettings_update();
670 _e_xsettings_gtk_icon_update();
671 _e_xsettings_gtk_rcfiles_update();
671 reset = EINA_TRUE; 672 reset = EINA_TRUE;
672 } 673 }
674 event_ignore++;
673} 675}