From 5fedc5bcdc4f276709552ca40958442151bb97b4 Mon Sep 17 00:00:00 2001 From: marosg Date: Thu, 7 Sep 2017 07:31:37 +0200 Subject: GSettings for checkmark color shown for mounted volumes. --- drivemount/Makefile.am | 24 +++++++++++++++--------- drivemount/drive-button.c | 17 ++++++++++++++--- drivemount/drive-button.h | 1 + drivemount/drive-list.h | 1 + drivemount/drivemount.c | 2 ++ drivemount/org.mate.drivemount.gschema.xml.in | 9 +++++++++ 6 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 drivemount/org.mate.drivemount.gschema.xml.in (limited to 'drivemount') diff --git a/drivemount/Makefile.am b/drivemount/Makefile.am index dc0f225b..328f08f1 100644 --- a/drivemount/Makefile.am +++ b/drivemount/Makefile.am @@ -20,6 +20,20 @@ mate_drivemount_applet_LDADD = \ $(MATE_APPLETS4_LIBS) \ $(MATEDESKTOP_LIBS) +uidir = $(datadir)/mate/ui +ui_DATA = drivemount-applet-menu.xml + +@INTLTOOL_XML_NOMERGE_RULE@ +drivemount_gschema_in_files = org.mate.drivemount.gschema.xml.in +gsettings_SCHEMAS = $(drivemount_gschema_in_files:.xml.in=.xml) +@GSETTINGS_RULES@ + +EXTRA_DIST = \ + org.mate.applets.DriveMountApplet.mate-panel-applet.in.in \ + $(service_in_files) \ + $(drivemount_gschema_in_files) \ + $(ui_DATA) + appletdir = $(datadir)/mate-panel/applets applet_in_files = org.mate.applets.DriveMountApplet.mate-panel-applet.in @@ -42,14 +56,6 @@ org.mate.panel.applet.DriveMountAppletFactory.service: $(service_in_files) -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ $< > $@ -uidir = $(datadir)/mate/ui -ui_DATA = drivemount-applet-menu.xml - -CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) - -EXTRA_DIST = \ - org.mate.applets.DriveMountApplet.mate-panel-applet.in.in \ - $(service_in_files) \ - $(ui_DATA) +CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS) *.gschema.valid -include $(top_srcdir)/git.mk diff --git a/drivemount/drive-button.c b/drivemount/drive-button.c index fdaad0a2..ff766fcb 100644 --- a/drivemount/drive-button.c +++ b/drivemount/drive-button.c @@ -485,6 +485,17 @@ drive_button_update (gpointer user_data) rowstride = gdk_pixbuf_get_rowstride (tmp_pixbuf); pixels = gdk_pixbuf_get_pixels (tmp_pixbuf); + GdkRGBA color; + gchar *color_string = g_settings_get_string (settings, "drivemount-checkmark-color"); + if (!color_string) + color_string = g_strdup ("#00ff00"); + gdk_rgba_parse (&color, color_string); + g_free (color_string); + + guchar red = color.red*255; + guchar green = color.green*255; + guchar blue = color.blue*255; + const gdouble ratio = 0.65; gdouble y_start = icon_height * ratio; gdouble x_start = icon_height * (1 + ratio); @@ -493,9 +504,9 @@ drive_button_update (gpointer user_data) for (x = x_start - y; x < icon_width; x++) { p = pixels + y * rowstride + x * n_channels; - p[0] = 0; - p[1] = 230; - p[2] = 0; + p[0] = red; + p[1] = green; + p[2] = blue; p[3] = 255; } } diff --git a/drivemount/drive-button.h b/drivemount/drive-button.h index f0c3389d..10ba3a35 100644 --- a/drivemount/drive-button.h +++ b/drivemount/drive-button.h @@ -63,6 +63,7 @@ void drive_button_set_size (DriveButton *button, int drive_button_compare (DriveButton *button, DriveButton *other_button); +GSettings *settings; G_END_DECLS diff --git a/drivemount/drive-list.h b/drivemount/drive-list.h index 283aeb6d..d74b934a 100644 --- a/drivemount/drive-list.h +++ b/drivemount/drive-list.h @@ -65,5 +65,6 @@ void drive_list_set_panel_size (DriveList *list, int panel_size); void drive_list_set_transparent (DriveList *self, gboolean transparent); +GSettings *settings; #endif /* DRIVE_LIST_H */ diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c index 3e0bdd2b..7d10a1d6 100644 --- a/drivemount/drivemount.c +++ b/drivemount/drivemount.c @@ -190,6 +190,8 @@ applet_factory (MatePanelApplet *applet, mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet)); + settings = g_settings_new ( "org.mate.drivemount"); + drive_list = drive_list_new (); gtk_container_add (GTK_CONTAINER (applet), drive_list); diff --git a/drivemount/org.mate.drivemount.gschema.xml.in b/drivemount/org.mate.drivemount.gschema.xml.in new file mode 100644 index 00000000..24ffe871 --- /dev/null +++ b/drivemount/org.mate.drivemount.gschema.xml.in @@ -0,0 +1,9 @@ + + + + '#00e300' + Checkmark color for mounted drive or share + Default color in a hex value. + + + -- cgit v1.2.1