Commit 44af4388 authored by Andrew Hayzen's avatar Andrew Hayzen Committed by Simon Steinbeiß

appearence: Sync theme, icon, font names to gsettings

Sync gsettings values so that tools such as flatpak are able
to determine the correct gtk theme.

(This may also help Wayland support later)

Related to #179
parent 6546ff18
Pipeline #834 passed with stages
in 3 minutes and 8 seconds
......@@ -40,6 +40,8 @@
#include <gdk/gdkx.h>
#include <gio/gio.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
......@@ -80,6 +82,7 @@ enum {
NUM_SYMBOLIC_COLORS
};
static const gchar *gsettings_category_gnome_interface = "org.gnome.desktop.interface";
static const gchar* xft_hint_styles_array[] =
{
"hintnone", "hintslight", "hintmedium", "hintfull"
......@@ -641,6 +644,7 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
guint i;
gint antialias, dpi, custom_dpi;
GtkTreeModel *model;
g_autoptr(GSettings) gsettings = NULL;
g_return_if_fail (property_name != NULL);
g_return_if_fail (GTK_IS_BUILDER (builder));
......@@ -746,6 +750,13 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
g_free (selected_name);
g_free (new_name);
}
/* Keep gsettings in sync */
gsettings = g_settings_new (gsettings_category_gnome_interface);
if (gsettings)
{
g_settings_set_string (gsettings, "gtk-theme", xfconf_channel_get_string (channel, property_name, NULL));
}
}
else if (strcmp (property_name, "/Net/IconThemeName") == 0)
{
......@@ -786,6 +797,31 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
pd,
(GDestroyNotify) preview_data_free);
}
/* Keep gsettings in sync */
gsettings = g_settings_new (gsettings_category_gnome_interface);
if (gsettings)
{
g_settings_set_string (gsettings, "icon-theme", xfconf_channel_get_string (channel, property_name, NULL));
}
}
else if (strcmp (property_name, "/Gtk/FontName") == 0)
{
/* Keep gsettings in sync */
gsettings = g_settings_new (gsettings_category_gnome_interface);
if (gsettings)
{
g_settings_set_string (gsettings, "font-name", xfconf_channel_get_string (channel, property_name, NULL));
}
}
else if (strcmp (property_name, "/Gtk/MonospaceFontName") == 0)
{
/* Keep gsettings in sync */
gsettings = g_settings_new (gsettings_category_gnome_interface);
if (gsettings)
{
g_settings_set_string (gsettings, "monospace-font-name", xfconf_channel_get_string (channel, property_name, NULL));
}
}
}
......
......@@ -34,6 +34,8 @@
#include <xfsettingsd/pointers-defines.h>
#ifdef HAVE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#include <gio/gio.h>
#endif /* !HAVE_XCURSOR */
#ifdef HAVE_LIBINPUT
......@@ -87,6 +89,8 @@ static GOptionEntry option_entries[] =
};
#ifdef HAVE_XCURSOR
static const gchar *gsettings_category_gnome_interface = "org.gnome.desktop.interface";
/* icon names for the preview widget */
static const gchar *preview_names[] = {
"left_ptr", "left_ptr_watch", "watch", "hand2",
......@@ -336,6 +340,7 @@ mouse_settings_themes_selection_changed (GtkTreeSelection *selection,
gboolean has_selection;
gchar *path, *name;
GObject *image;
g_autoptr(GSettings) gsettings = NULL;
has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
if (G_LIKELY (has_selection))
......@@ -350,8 +355,17 @@ mouse_settings_themes_selection_changed (GtkTreeSelection *selection,
/* write configuration (not during a lock) */
if (locked == 0)
{
xfconf_channel_set_string (xsettings_channel, "/Gtk/CursorThemeName", name);
/* Keep gsettings in sync */
gsettings = g_settings_new (gsettings_category_gnome_interface);
if (gsettings)
{
g_settings_set_string (gsettings, "cursor-theme", name);
}
}
/* cleanup */
g_free (path);
g_free (name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment