dclock: reflect panel configuration change immediately
authorMamoru TASAKA <mtasaka@fedoraproject.org>
Tue, 2 Jan 2018 13:43:03 +0000 (22:43 +0900)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sun, 7 Jan 2018 19:38:29 +0000 (21:38 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1261464

For example, when font color on panel configuration changes,
we should apply the change immediately.

plugins/dclock.c

index d934427..6955129 100644 (file)
@@ -74,6 +74,7 @@ typedef struct {
 static gboolean dclock_update_display(DClockPlugin * dc);
 static void dclock_destructor(gpointer user_data);
 static gboolean dclock_apply_configuration(gpointer user_data);
+static void dclock_on_panel_reconfigured(LXPanel *panel, GtkWidget *p);
 
 /* Display a window containing the standard calendar widget. */
 static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
@@ -440,6 +441,12 @@ static GtkWidget *dclock_configure(LXPanel *panel, GtkWidget *p)
         NULL);
 }
 
+/* Callback when panel configuration changes. */
+static void dclock_on_panel_reconfigured(LXPanel *panel, GtkWidget *p)
+{
+    dclock_apply_configuration(p);
+}
+
 /* Plugin descriptor. */
 LXPanelPluginInit lxpanel_static_plugin_dclock = {
     .name = N_("Digital Clock"),
@@ -447,5 +454,6 @@ LXPanelPluginInit lxpanel_static_plugin_dclock = {
 
     .new_instance = dclock_constructor,
     .config = dclock_configure,
+    .reconfigure = dclock_on_panel_reconfigured,
     .button_press_event = dclock_button_press_event
 };