Commit 8e8aa3ec authored by Nick Schermer's avatar Nick Schermer

Merge 4ui branch back into trunk.

44 files changed, 2201 insertions(+), 2204 deletions(-).


(Old svn revision: 30306)
parent 34da6ee6
......@@ -10,11 +10,11 @@ dnl ***************************
dnl *** Version information ***
dnl ***************************
m4_define([xfce4_settings_version_major], [4])
m4_define([xfce4_settings_version_minor], [6])
m4_define([xfce4_settings_version_micro], [1])
m4_define([xfce4_settings_version_minor], [7])
m4_define([xfce4_settings_version_micro], [0])
m4_define([xfce4_settings_version_nano], [])
m4_define([xfce4_settings_version_build], [r@REVISION@])
m4_define([xfce4_settings_version_tag], []) # Leave empty for releases
m4_define([xfce4_settings_version_tag], [svn]) # Leave empty for releases
m4_define([xfce4_settings_version], [xfce4_settings_version_major().xfce4_settings_version_minor().xfce4_settings_version_micro()ifelse(xfce4_settings_version_nano(), [], [], [.xfce4_settings_version_nano()])ifelse(xfce4_settings_version_tag(),[],[], [-ifelse(xfce4_settings_version_tag(), [stephan], [xfce4_settings_version_tag()-xfce4_settings_version_build()], [xfce4_settings_version_tag()])])])
dnl *******************************************
......@@ -73,12 +73,12 @@ dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.100])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.16.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.6.0])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.6.0])
XDT_CHECK_PACKAGE([LIBXFCE4KBD_PRIVATE], [libxfce4kbd-private-1.0], [4.6.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.7.0])
XDT_CHECK_PACKAGE([LIBXFCE4KBD_PRIVATE], [libxfce4kbd-private-2], [4.7.0])
XDT_CHECK_PACKAGE([LIBXFCE4SMCLIENT_PRIVATE], [libxfce4smclient-private-1], [4.7.0])
XDT_CHECK_PACKAGE([GLADE], [libglade-2.0], [2.0.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.6.0])
XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.34])
......
......@@ -17,11 +17,9 @@ xfce4_accessibility_settings_SOURCES = \
xfce4_accessibility_settings_CFLAGS = \
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(GLADE_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(XFCONF_CFLAGS)
$(LIBXFCE4UI_CFLAGS) \
$(XFCONF_CFLAGS) \
$(PLATFORM_CFLAGS)
xfce4_accessibility_settings_LDFLAGS = \
-no-undefined \
......@@ -29,10 +27,7 @@ xfce4_accessibility_settings_LDFLAGS = \
xfce4_accessibility_settings_LDADD = \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXFCEGUI4_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(XFCONF_LIBS)
if MAINTAINER_MODE
......
......@@ -28,9 +28,8 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
......@@ -49,8 +48,8 @@ static GOptionEntry entries[] =
/* gloval xfconf channel */
static XfconfChannel *accessibility_channel;
/* global xfconf channel */
static XfconfChannel *accessibility_channel = NULL;
......@@ -58,67 +57,67 @@ static void
accessibility_settings_sensitivity (GtkToggleButton *button,
GtkWidget *box)
{
gtk_widget_set_sensitive (GTK_WIDGET (box), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
gtk_widget_set_sensitive (GTK_WIDGET (box),
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
static void
accessibility_settings_dialog_configure_widgets (GladeXML *gxml)
accessibility_settings_dialog_configure_widgets (GtkBuilder *builder)
{
GtkWidget *widget, *box;
GtkAdjustment *adjustment;
GObject *box, *object;
/* Sticky keys */
widget = glade_xml_get_widget (gxml, "sticky-keys-enabled");
box = glade_xml_get_widget (gxml, "sticky-keys-box");
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/StickyKeys", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
object = gtk_builder_get_object (builder, "sticky-keys-enabled");
box = gtk_builder_get_object (builder, "sticky-keys-box");
g_signal_connect (object, "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/StickyKeys", G_TYPE_BOOLEAN, object, "active");
widget = glade_xml_get_widget (gxml, "sticky-keys-latch-to-lock");
xfconf_g_property_bind (accessibility_channel, "/StickyKeys/LatchToLock", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
object = gtk_builder_get_object (builder, "sticky-keys-latch-to-lock");
xfconf_g_property_bind (accessibility_channel, "/StickyKeys/LatchToLock", G_TYPE_BOOLEAN, object, "active");
widget = glade_xml_get_widget (gxml, "sticky-keys-two-keys-disable");
xfconf_g_property_bind (accessibility_channel, "/StickyKeys/TwoKeysDisable", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
object = gtk_builder_get_object (builder, "sticky-keys-two-keys-disable");
xfconf_g_property_bind (accessibility_channel, "/StickyKeys/TwoKeysDisable", G_TYPE_BOOLEAN, object, "active");
/* Slow keys */
widget = glade_xml_get_widget (gxml, "slow-keys-enabled");
box = glade_xml_get_widget (gxml, "slow-keys-box");
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/SlowKeys", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
adjustment = gtk_range_get_adjustment (GTK_RANGE (glade_xml_get_widget (gxml, "slow-keys-delay")));
xfconf_g_property_bind (accessibility_channel, "/SlowKeys/Delay", G_TYPE_INT, G_OBJECT (adjustment), "value");
object = gtk_builder_get_object (builder, "slow-keys-enabled");
box = gtk_builder_get_object (builder, "slow-keys-box");
g_signal_connect (object, "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/SlowKeys", G_TYPE_BOOLEAN, object, "active");
object = gtk_builder_get_object (builder, "slow-keys-delay");
xfconf_g_property_bind (accessibility_channel, "/SlowKeys/Delay", G_TYPE_INT, object, "value");
/* Bounce keys */
widget = glade_xml_get_widget (gxml, "bounce-keys-enabled");
box = glade_xml_get_widget (gxml, "bounce-keys-box");
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/BounceKeys", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
object = gtk_builder_get_object (builder, "bounce-keys-enabled");
box = gtk_builder_get_object (builder, "bounce-keys-box");
g_signal_connect (object, "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/BounceKeys", G_TYPE_BOOLEAN, object, "active");
adjustment = gtk_range_get_adjustment (GTK_RANGE (glade_xml_get_widget (gxml, "bounce-keys-delay")));
xfconf_g_property_bind (accessibility_channel, "/BounceKeys/Delay", G_TYPE_INT, G_OBJECT (adjustment), "value");
object = gtk_builder_get_object (builder, "bounce-keys-delay");
xfconf_g_property_bind (accessibility_channel, "/BounceKeys/Delay", G_TYPE_INT, object, "value");
/* Mouse keys */
widget = glade_xml_get_widget (gxml, "mouse-emulation-enabled");
box = glade_xml_get_widget (gxml, "mouse-emulation-box");
g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/MouseKeys", G_TYPE_BOOLEAN, G_OBJECT (widget), "active");
widget = glade_xml_get_widget (gxml, "mouse-emulation-delay");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Delay", G_TYPE_INT, G_OBJECT (widget), "value");
widget = glade_xml_get_widget (gxml, "mouse-emulation-interval");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Interval", G_TYPE_INT, G_OBJECT (widget), "value");
widget = glade_xml_get_widget (gxml, "mouse-emulation-time-to-max");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/TimeToMax", G_TYPE_INT, G_OBJECT (widget), "value");
widget = glade_xml_get_widget (gxml, "mouse-emulation-max-speed");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/MaxSpeed", G_TYPE_INT, G_OBJECT (widget), "value");
widget = glade_xml_get_widget (gxml, "mouse-emulation-curve");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Curve", G_TYPE_INT, G_OBJECT (widget), "value");
object = gtk_builder_get_object (builder, "mouse-emulation-enabled");
box = gtk_builder_get_object (builder, "mouse-emulation-box");
g_signal_connect (object, "toggled", G_CALLBACK (accessibility_settings_sensitivity), box);
xfconf_g_property_bind (accessibility_channel, "/MouseKeys", G_TYPE_BOOLEAN, object, "active");
object = gtk_builder_get_object (builder, "mouse-emulation-delay");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Delay", G_TYPE_INT, object, "value");
object = gtk_builder_get_object (builder, "mouse-emulation-interval");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Interval", G_TYPE_INT, object, "value");
object = gtk_builder_get_object (builder, "mouse-emulation-time-to-max");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/TimeToMax", G_TYPE_INT, object, "value");
object = gtk_builder_get_object (builder, "mouse-emulation-max-speed");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/MaxSpeed", G_TYPE_INT, object, "value");
object = gtk_builder_get_object (builder, "mouse-emulation-curve");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Curve", G_TYPE_INT, object, "value");
}
......@@ -126,11 +125,10 @@ accessibility_settings_dialog_configure_widgets (GladeXML *gxml)
gint
main (gint argc, gchar **argv)
{
GtkWidget *dialog;
GtkWidget *plug;
GtkWidget *plug_child;
GladeXML *gxml;
GError *error = NULL;
GObject *dialog, *plug_child;
GtkWidget *plug;
GtkBuilder *builder;
GError *error = NULL;
/* setup translation domain */
xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
......@@ -160,7 +158,7 @@ main (gint argc, gchar **argv)
if (G_UNLIKELY (opt_version))
{
g_print ("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string ());
g_print ("%s\n", "Copyright (c) 2008");
g_print ("%s\n", "Copyright (c) 2008-2009");
g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));
g_print (_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
g_print ("\n");
......@@ -181,26 +179,28 @@ main (gint argc, gchar **argv)
/* open the channel */
accessibility_channel = xfconf_channel_new ("accessibility");
/* load the glade interface */
gxml = glade_xml_new_from_buffer (accessibility_dialog_glade,
accessibility_dialog_glade_length,
NULL, NULL);
/* hook to make sure the libxfce4ui library is linked */
if (xfce_titled_dialog_get_type () == 0)
return EXIT_FAILURE;
if (G_LIKELY (gxml != NULL))
/* load the glade interface */
builder = gtk_builder_new ();
if (gtk_builder_add_from_string (builder, accessibility_dialog_glade,
accessibility_dialog_glade_length, &error) != 0)
{
/* Configure widgets */
accessibility_settings_dialog_configure_widgets (gxml);
accessibility_settings_dialog_configure_widgets (builder);
if (G_UNLIKELY (opt_socket_id == 0))
{
/* Get the dialog widget */
dialog = glade_xml_get_widget (gxml, "accessibility-settings-dialog");
dialog = gtk_builder_get_object (builder, "dialog");
/* run the dialog */
gtk_dialog_run (GTK_DIALOG (dialog));
/* destroy the dialog */
gtk_widget_destroy (dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
}
else
{
......@@ -213,17 +213,22 @@ main (gint argc, gchar **argv)
gdk_notify_startup_complete ();
/* Get plug child widget */
plug_child = glade_xml_get_widget (gxml, "plug-child");
gtk_widget_reparent (plug_child, plug);
gtk_widget_show (plug_child);
plug_child = gtk_builder_get_object (builder, "plug-child");
gtk_widget_reparent (GTK_WIDGET (plug_child), plug);
gtk_widget_show (GTK_WIDGET (plug_child));
/* Enter main loop */
gtk_main ();
}
}
else
{
g_error ("Failed to load the glade file: %s.", error->message);
g_error_free (error);
}
/* Free Glade XML */
g_object_unref (G_OBJECT (gxml));
/* Release Builder */
g_object_unref (G_OBJECT (builder));
/* release the channel */
g_object_unref (G_OBJECT (accessibility_channel));
......
......@@ -18,11 +18,9 @@ xfce4_appearance_settings_SOURCES = \
xfce4_appearance_settings_CFLAGS = \
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(GLADE_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(XFCONF_CFLAGS)
$(LIBXFCE4UI_CFLAGS) \
$(XFCONF_CFLAGS) \
$(PLATFORM_CFLAGS)
xfce4_appearance_settings_LDFLAGS = \
-no-undefined \
......@@ -30,10 +28,7 @@ xfce4_appearance_settings_LDFLAGS = \
xfce4_appearance_settings_LDADD = \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXFCEGUI4_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(XFCONF_LIBS)
if MAINTAINER_MODE
......
......@@ -31,9 +31,8 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
......@@ -96,20 +95,20 @@ static XfconfChannel *xsettings_channel;
static int
compute_xsettings_dpi (GtkWidget *widget)
{
Screen *xscreen;
GdkScreen *screen;
int width_mm, height_mm;
int width, height;
int dpi;
xscreen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (widget));
width_mm = WidthMMOfScreen (xscreen);
height_mm = HeightMMOfScreen (xscreen);
screen = gtk_widget_get_screen (widget);
width_mm = gdk_screen_get_width_mm (screen);
height_mm = gdk_screen_get_height_mm (screen);
dpi = FALLBACK_DPI;
if (width_mm > 0 && height_mm > 0)
{
width = WidthOfScreen (xscreen);
height = HeightOfScreen (xscreen);
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
dpi = MIN (INCH_MM * width / width_mm,
INCH_MM * height / height_mm);
}
......@@ -502,15 +501,16 @@ static void
appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
const gchar *property_name,
const GValue *value,
GladeXML *gxml)
GtkBuilder *builder)
{
GtkWidget *widget, *spin;
GObject *object;
gchar *str;
guint i;
gint antialias;
gint antialias, dpi, custom_dpi;
GtkTreeModel *model;
g_return_if_fail (property_name != NULL);
g_return_if_fail (GTK_IS_BUILDER (builder));
if (strcmp (property_name, "/Xft/RGBA") == 0)
{
......@@ -519,8 +519,8 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
{
if (strcmp (str, xft_rgba_array[i]) == 0)
{
widget = glade_xml_get_widget (gxml, "xft_rgba_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
object = gtk_builder_get_object (builder, "xft_rgba_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (object), i);
break;
}
}
......@@ -533,8 +533,8 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
{
if (strcmp (str, toolbar_styles_array[i]) == 0)
{
widget = glade_xml_get_widget (gxml, "gtk_toolbar_style_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
object = gtk_builder_get_object (builder, "gtk_toolbar_style_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (object), i);
break;
}
}
......@@ -547,8 +547,8 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
{
if (strcmp (str, xft_hint_styles_array[i]) == 0)
{
widget = glade_xml_get_widget (gxml, "xft_hinting_style_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
object = gtk_builder_get_object (builder, "xft_hinting_style_combo_box");
gtk_combo_box_set_active (GTK_COMBO_BOX (object), i);
break;
}
}
......@@ -556,251 +556,209 @@ appearance_settings_dialog_channel_property_changed (XfconfChannel *channel,
}
else if (strcmp (property_name, "/Xft/Antialias") == 0)
{
widget = glade_xml_get_widget (gxml, "xft_antialias_check_button");
object = gtk_builder_get_object (builder, "xft_antialias_check_button");
antialias = xfconf_channel_get_int (xsettings_channel, property_name, -1);
switch (antialias)
{
case 1:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (object), TRUE);
break;
case 0:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (object), FALSE);
break;
default: /* -1 */
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), TRUE);
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (object), TRUE);
break;
}
}
else if (strcmp (property_name, "/Xft/DPI") == 0)
{
/* The DPI has changed, so get its value and the last known custom value */
gint dpi = xfconf_channel_get_int (xsettings_channel, property_name, FALLBACK_DPI);
gint custom_dpi = xfconf_channel_get_int (xsettings_channel, "/Xfce/LastCustomDPI", -1);
dpi = xfconf_channel_get_int (xsettings_channel, property_name, FALLBACK_DPI);
custom_dpi = xfconf_channel_get_int (xsettings_channel, "/Xfce/LastCustomDPI", -1);
/* Activate the check button if we're using a custom DPI */
widget = glade_xml_get_widget (gxml, "xft_custom_dpi_check_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), dpi >= 0);
object = gtk_builder_get_object (builder, "xft_custom_dpi_check_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (object), dpi >= 0);
/* If we're not using a custom DPI, compute the future custom DPI automatically */
if (custom_dpi == -1)
custom_dpi = compute_xsettings_dpi (widget);
custom_dpi = compute_xsettings_dpi (GTK_WIDGET (object));
spin = glade_xml_get_widget (gxml, "xft_custom_dpi_spin_button");
object = gtk_builder_get_object (builder, "xft_custom_dpi_spin_button");
if (dpi > 0)
{
/* We're using a custom DPI, so use the current DPI setting for the spin value */
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), dpi);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (object), dpi);
}
else
{
/* Set the spin button value to the last custom DPI */
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), custom_dpi);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (object), custom_dpi);
}
}
else if (strcmp (property_name, "/Net/ThemeName") == 0)
{
widget = glade_xml_get_widget (gxml, "gtk_theme_treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
object = gtk_builder_get_object (builder, "gtk_theme_treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (object));
gtk_list_store_clear (GTK_LIST_STORE (model));
appearance_settings_load_ui_themes (GTK_LIST_STORE (model), GTK_TREE_VIEW (widget));
appearance_settings_load_ui_themes (GTK_LIST_STORE (model), GTK_TREE_VIEW (object));
}
else if (strcmp (property_name, "/Net/IconThemeName") == 0)
{
widget = glade_xml_get_widget (gxml, "icon_theme_treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
object = gtk_builder_get_object (builder, "icon_theme_treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (object));
gtk_list_store_clear (GTK_LIST_STORE (model));
appearance_settings_load_icon_themes (GTK_LIST_STORE (model), GTK_TREE_VIEW (widget));
appearance_settings_load_icon_themes (GTK_LIST_STORE (model), GTK_TREE_VIEW (object));
}
}
static void
appearance_settings_dialog_configure_widgets (GladeXML *gxml)
appearance_settings_dialog_configure_widgets (GtkBuilder *builder)
{
GObject *object, *object2;
GtkListStore *list_store;
GtkCellRenderer *renderer;
GtkTreeSelection *icon_selection, *ui_selection;
GdkPixbuf *pixbuf;
GtkTreeSelection *selection;
/* Icon themes list */
GtkWidget *icon_theme_treeview = glade_xml_get_widget (gxml, "icon_theme_treeview");
object = gtk_builder_get_object (builder, "icon_theme_treeview");
list_store = gtk_list_store_new (N_THEME_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), COLUMN_THEME_DISPLAY_NAME, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (icon_theme_treeview), GTK_TREE_MODEL (list_store));
#if GTK_CHECK_VERSION (2, 12, 0)
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (icon_theme_treeview), COLUMN_THEME_COMMENT);
#endif
gtk_tree_view_set_model (GTK_TREE_VIEW (object), GTK_TREE_MODEL (list_store));
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (object), COLUMN_THEME_COMMENT);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (icon_theme_treeview), 0, "", renderer, "text", COLUMN_THEME_DISPLAY_NAME, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (object), 0, "", renderer, "text", COLUMN_THEME_DISPLAY_NAME, NULL);
appearance_settings_load_icon_themes (list_store, GTK_TREE_VIEW (icon_theme_treeview));
appearance_settings_load_icon_themes (list_store, GTK_TREE_VIEW (object));
g_object_unref (G_OBJECT (list_store));
icon_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (icon_theme_treeview));
gtk_tree_selection_set_mode (icon_selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (icon_selection), "changed", G_CALLBACK (cb_icon_theme_tree_selection_changed), NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cb_icon_theme_tree_selection_changed), NULL);
/* Gtk (UI) themes */
GtkWidget *ui_theme_treeview = glade_xml_get_widget (gxml, "gtk_theme_treeview");
object = gtk_builder_get_object (builder, "gtk_theme_treeview");
list_store = gtk_list_store_new (N_THEME_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), COLUMN_THEME_DISPLAY_NAME, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (ui_theme_treeview), GTK_TREE_MODEL (list_store));
#if GTK_CHECK_VERSION (2, 12, 0)
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (ui_theme_treeview), COLUMN_THEME_COMMENT);
#endif
gtk_tree_view_set_model (GTK_TREE_VIEW (object), GTK_TREE_MODEL (list_store));
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (object), COLUMN_THEME_COMMENT);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (ui_theme_treeview), 0, "", renderer, "text", COLUMN_THEME_DISPLAY_NAME, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (object), 0, "", renderer, "text", COLUMN_THEME_DISPLAY_NAME, NULL);
appearance_settings_load_ui_themes (list_store, GTK_TREE_VIEW (ui_theme_treeview));
appearance_settings_load_ui_themes (list_store, GTK_TREE_VIEW (object));
g_object_unref (G_OBJECT (list_store));
ui_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ui_theme_treeview));
gtk_tree_selection_set_mode (ui_selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (ui_selection), "changed", G_CALLBACK (cb_ui_theme_tree_selection_changed), NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cb_ui_theme_tree_selection_changed), NULL);
/* Subpixel (rgba) hinting Combo */
GtkWidget *rgba_combo_box = glade_xml_get_widget (gxml, "xft_rgba_combo_box");
list_store = gtk_list_store_new (N_RGBA_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
object = gtk_builder_get_object (builder, "xft_rgba_store");
pixbuf = gdk_pixbuf_new_from_xpm_data (rgba_image_none_xpm);
gtk_list_store_insert_with_values (list_store, NULL, 0, COLUMN_RGBA_PIXBUF, pixbuf, COLUMN_RGBA_NAME, _("None"), -1);
gtk_list_store_insert_with_values (GTK_LIST_STORE (object), NULL, 0, 0, pixbuf, 1, _("None"), -1);
g_object_unref (G_OBJECT (pixbuf));
pixbuf = gdk_pixbuf_new_from_xpm_data (rgba_image_rgb_xpm);
gtk_list_store_insert_with_values (list_store, NULL, 1, COLUMN_RGBA_PIXBUF, pixbuf, COLUMN_RGBA_NAME, _("RGB"), -1);
gtk_list_store_insert_with_values (GTK_LIST_STORE (object), NULL, 1, 0, pixbuf, 1, _("RGB"), -1);
g_object_unref (G_OBJECT (pixbuf));
pixbuf = gdk_pixbuf_new_from_xpm_data (rgba_image_bgr_xpm);
gtk_list_store_insert_with_values (list_store, NULL, 2, COLUMN_RGBA_PIXBUF, pixbuf, COLUMN_RGBA_NAME, _("BGR"), -1);
gtk_list_store_insert_with_values (GTK_LIST_STORE (object), NULL, 2, 0, pixbuf, 1, _("BGR"), -1);
g_object_unref (G_OBJECT (pixbuf));
pixbuf = gdk_pixbuf_new_from_xpm_data (rgba_image_vrgb_xpm);
gtk_list_store_insert_with_values (list_store, NULL, 3, COLUMN_RGBA_PIXBUF, pixbuf, COLUMN_RGBA_NAME, _("Vertical RGB"), -1);
gtk_list_store_insert_with_values (GTK_LIST_STORE (object), NULL, 3, 0, pixbuf, 1, _("Vertical RGB"), -1);
g_object_unref (G_OBJECT (pixbuf));
pixbuf = gdk_pixbuf_new_from_xpm_data (rgba_image_vbgr_xpm);
gtk_list_store_insert_with_values (list_store, NULL, 4, COLUMN_RGBA_PIXBUF, pixbuf, COLUMN_RGBA_NAME, _("Vertical BGR"), -1);
gtk_list_store_insert_with_values (GTK_LIST_STORE (object), NULL, 4, 0, pixbuf, 1, _("Vertical BGR"), -1);
g_object_unref (G_OBJECT (pixbuf));
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_clear (GTK_CELL_LAYOUT (rgba_combo_box));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (rgba_combo_box), renderer, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (rgba_combo_box), renderer, "pixbuf", COLUMN_RGBA_PIXBUF);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (rgba_combo_box), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (rgba_combo_box), renderer, "text", COLUMN_RGBA_NAME);
gtk_combo_box_set_model (GTK_COMBO_BOX (rgba_combo_box), GTK_TREE_MODEL (list_store));