summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarosg <[email protected]>2017-09-10 18:36:47 +0200
committermarosg <[email protected]>2017-09-10 18:36:47 +0200
commit29c3ce4408b6139b17e41a301fe47329de4c491b (patch)
tree492f2fd609085e8cd267e4d14ef8ca2b5f08acff
parent5764aa11ba5351f6ab88f29ca9e44f391a84403d (diff)
downloadmate-applets-29c3ce4408b6139b17e41a301fe47329de4c491b.tar.bz2
mate-applets-29c3ce4408b6139b17e41a301fe47329de4c491b.tar.xz
GSettings change recognized dynamically
-rw-r--r--drivemount/drive-button.c7
-rw-r--r--drivemount/drive-button.h1
-rw-r--r--drivemount/drive-list.c14
-rw-r--r--drivemount/drive-list.h2
-rw-r--r--drivemount/drivemount.c4
5 files changed, 28 insertions, 0 deletions
diff --git a/drivemount/drive-button.c b/drivemount/drive-button.c
index ff766fcb..bd01805e 100644
--- a/drivemount/drive-button.c
+++ b/drivemount/drive-button.c
@@ -544,6 +544,13 @@ drive_button_set_size (DriveButton *self, int icon_size)
}
}
+void
+drive_button_redraw (gpointer key, gpointer value, gpointer user_data)
+{
+ DriveButton *button = value;
+ drive_button_queue_update (button);
+}
+
int
drive_button_compare (DriveButton *button, DriveButton *other_button)
{
diff --git a/drivemount/drive-button.h b/drivemount/drive-button.h
index 10ba3a35..8974f7bf 100644
--- a/drivemount/drive-button.h
+++ b/drivemount/drive-button.h
@@ -64,6 +64,7 @@ void drive_button_set_size (DriveButton *button,
int drive_button_compare (DriveButton *button,
DriveButton *other_button);
GSettings *settings;
+void drive_button_redraw (gpointer key, gpointer value, gpointer user_data);
G_END_DECLS
diff --git a/drivemount/drive-list.c b/drivemount/drive-list.c
index 7ebb6240..a20e1329 100644
--- a/drivemount/drive-list.c
+++ b/drivemount/drive-list.c
@@ -486,6 +486,20 @@ drive_list_set_panel_size (DriveList *self, int panel_size)
}
}
+void
+drive_list_redraw (DriveList *self)
+{
+ g_hash_table_foreach (self->volumes, drive_button_redraw, self);
+ g_hash_table_foreach (self->mounts, drive_button_redraw, self);
+}
+
+void
+settings_color_changed (GSettings *settings, gchar *key, DriveList *drive_list)
+{
+ g_return_if_fail (DRIVE_IS_LIST (drive_list));
+ drive_list_redraw (drive_list);
+}
+
static void
set_button_relief (gpointer key, gpointer value, gpointer user_data)
{
diff --git a/drivemount/drive-list.h b/drivemount/drive-list.h
index d74b934a..c7e844dd 100644
--- a/drivemount/drive-list.h
+++ b/drivemount/drive-list.h
@@ -66,5 +66,7 @@ void drive_list_set_panel_size (DriveList *list,
void drive_list_set_transparent (DriveList *self,
gboolean transparent);
GSettings *settings;
+void drive_list_redraw (DriveList *self);
+void settings_color_changed (GSettings *settings, gchar *key, DriveList *drive_list);
#endif /* DRIVE_LIST_H */
diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c
index 7d10a1d6..b7321719 100644
--- a/drivemount/drivemount.c
+++ b/drivemount/drivemount.c
@@ -193,6 +193,10 @@ applet_factory (MatePanelApplet *applet,
settings = g_settings_new ( "org.mate.drivemount");
drive_list = drive_list_new ();
+ g_signal_connect(settings,
+ "changed::drivemount-checkmark-color",
+ G_CALLBACK (settings_color_changed),
+ drive_list);
gtk_container_add (GTK_CONTAINER (applet), drive_list);
g_signal_connect_object (applet, "change_orient",