Commit 90777688 authored by Amrit Borah's avatar Amrit Borah Committed by Sergios - Anestis Kefalidis
Browse files

MR: !51 transitioned to Xfconf (#134)

bug fix & code improvements

formatting fix

.

.
parent c8bec2f3
......@@ -35,6 +35,7 @@
#include <terminal/terminal-private.h>
#include <terminal/terminal-gdbus.h>
#include <terminal/terminal-preferences-dialog.h>
#include <xfconf/xfconf.h>
......@@ -202,6 +203,16 @@ main (int argc, char **argv)
g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
#endif
/* initialize xfconf */
if (!xfconf_init (&error))
{
g_printerr (PACKAGE_NAME ": Failed to initialize Xfconf: %s\n\n", error->message);
g_clear_error (&error);
/* disable get/set properties */
terminal_preferences_xfconf_init_failed ();
}
/* parse some options we need in main, not the windows attrs */
terminal_options_parse (argc, argv, &options);
......
......@@ -73,29 +73,6 @@ static gboolean monospace_filter (const
struct _TerminalPreferencesDialogClass
{
XfceTitledDialogClass __parent__;
};
struct _TerminalPreferencesDialog
{
XfceTitledDialog __parent__;
TerminalPreferences *preferences;
GtkColorButton *buttons[16];
GtkLabel *dropdown_label;
GtkBox *dropdown_vbox;
GtkNotebook *dropdown_notebook;
GtkSpinButton *geometry_columns_button;
GtkSpinButton *geometry_rows_button;
gint n_presets;
gulong bg_image_signal_id;
gulong palette_signal_id;
gulong geometry_signal_id;
};
enum
{
PRESET_COLUMN_TITLE,
......@@ -106,8 +83,9 @@ enum
enum
{
GEOMETRY_GET_COLUMNS,
GEOMETRY_GET_ROWS
GEOMETRY_COLUMN,
GEOMETRY_ROW,
N_GEOMETRY_BUTTONS
};
enum
......@@ -116,6 +94,35 @@ enum
BACKGROUND_COMBO_SHOW_OPACITY_OPTIONS
};
enum
{
N_PALETTE_BUTTONS = 16,
};
struct _TerminalPreferencesDialogClass
{
XfceTitledDialogClass __parent__;
};
struct _TerminalPreferencesDialog
{
XfceTitledDialog __parent__;
TerminalPreferences *preferences;
GtkColorButton *palette_button[N_PALETTE_BUTTONS];
GtkSpinButton *geometry_button[N_GEOMETRY_BUTTONS];
GtkLabel *dropdown_label;
GtkBox *dropdown_vbox;
GtkNotebook *dropdown_notebook;
gint n_presets;
gulong bg_image_signal_id;
gulong palette_notify_signal_id;
gulong palette_set_signal_id[N_PALETTE_BUTTONS];
gulong geometry_notify_signal_id;
gulong geometry_set_signal_id[N_GEOMETRY_BUTTONS];
};
G_DEFINE_TYPE (TerminalPreferencesDialog, terminal_preferences_dialog, XFCE_TYPE_TITLED_DIALOG)
......@@ -1007,13 +1014,14 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
gtk_widget_show (label);
button = gtk_spin_button_new_with_range (10, 4000, 1);
g_signal_connect_swapped (button, "value-changed",
G_CALLBACK (terminal_preferences_dialog_geometry_changed), dialog);
dialog->geometry_set_signal_id[GEOMETRY_COLUMN] =
g_signal_connect_swapped (button, "value-changed",
G_CALLBACK (terminal_preferences_dialog_geometry_changed), dialog);
gtk_widget_set_halign (button, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), button, 1, row, 1, 1);
gtk_widget_show (button);
dialog->geometry_columns_button = GTK_SPIN_BUTTON (button);
dialog->geometry_button[GEOMETRY_COLUMN] = GTK_SPIN_BUTTON (button);
label = gtk_label_new_with_mnemonic (_("columns"));
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
......@@ -1021,21 +1029,23 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
gtk_widget_show (label);
button = gtk_spin_button_new_with_range (10, 3000, 1);
g_signal_connect_swapped (button, "value-changed",
G_CALLBACK (terminal_preferences_dialog_geometry_changed), dialog);
dialog->geometry_set_signal_id[GEOMETRY_ROW] =
g_signal_connect_swapped (button, "value-changed",
G_CALLBACK (terminal_preferences_dialog_geometry_changed), dialog);
gtk_widget_set_halign (button, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), button, 3, row, 1, 1);
gtk_widget_show (button);
dialog->geometry_rows_button = GTK_SPIN_BUTTON (button);
dialog->geometry_button[GEOMETRY_ROW] = GTK_SPIN_BUTTON (button);
label = gtk_label_new_with_mnemonic (_("rows"));
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
gtk_grid_attach (GTK_GRID (grid), label, 4, row, 1, 1);
gtk_widget_show (label);
dialog->geometry_signal_id = g_signal_connect_swapped (dialog->preferences, "notify::misc-default-geometry",
G_CALLBACK (terminal_preferences_dialog_geometry_notify), dialog);
dialog->geometry_notify_signal_id =
g_signal_connect_swapped (dialog->preferences, "notify::misc-default-geometry",
G_CALLBACK (terminal_preferences_dialog_geometry_notify), dialog);
terminal_preferences_dialog_geometry_notify (dialog);
......@@ -1246,20 +1256,22 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
/* section: Palette */
terminal_preferences_dialog_new_section (&frame, &vbox, &grid, &label, &row, "Palette");
for (gint i = 0; i < 16; i++)
for (gint i = 0; i < N_PALETTE_BUTTONS; i++)
{
row = i / 8;
row = i / (N_PALETTE_BUTTONS / 2);
button = gtk_color_button_new ();
g_signal_connect_swapped (button, "color-set",
G_CALLBACK (terminal_preferences_dialog_palette_changed), dialog);
dialog->palette_set_signal_id[i] =
g_signal_connect_swapped (button, "color-set",
G_CALLBACK (terminal_preferences_dialog_palette_changed), dialog);
gtk_widget_set_halign (button, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), button, i % 8, row, 1, 1);
gtk_grid_attach (GTK_GRID (grid), button, i % (N_PALETTE_BUTTONS / 2), row, 1, 1);
gtk_widget_show (button);
dialog->buttons[i] = GTK_COLOR_BUTTON (button);
dialog->palette_button[i] = GTK_COLOR_BUTTON (button);
}
dialog->palette_signal_id = g_signal_connect_swapped (dialog->preferences, "notify::color-palette",
G_CALLBACK (terminal_preferences_dialog_palette_notify), dialog);
dialog->palette_notify_signal_id =
g_signal_connect_swapped (dialog->preferences, "notify::color-palette",
G_CALLBACK (terminal_preferences_dialog_palette_notify), dialog);
terminal_preferences_dialog_palette_notify (dialog);
/* next row */
......@@ -1674,8 +1686,6 @@ terminal_preferences_dialog_background_set (TerminalPreferencesDialog *dialog,
static void
terminal_preferences_dialog_geometry_notify (TerminalPreferencesDialog *dialog)
{
gint cols;
gint rows;
gchar *geometry = NULL;
gchar **split = NULL;
......@@ -1692,13 +1702,15 @@ terminal_preferences_dialog_geometry_notify (TerminalPreferencesDialog *dialog)
if (G_UNLIKELY (split == NULL))
return;
/* parse integers from strings */
cols = atoi (split[GEOMETRY_GET_COLUMNS]);
rows = atoi (split[GEOMETRY_GET_ROWS]);
/* apply values to buttons */
gtk_spin_button_set_value (dialog->geometry_columns_button, cols);
gtk_spin_button_set_value (dialog->geometry_rows_button, rows);
for (gint i = 0; i < N_GEOMETRY_BUTTONS; i++)
{
/* setting the value should not trigger an update in the preference, hence the "value-changed" signal is being blocked */
g_signal_handler_block (dialog->geometry_button[i], dialog->geometry_set_signal_id[i]);
gtk_spin_button_set_value (dialog->geometry_button[i], atoi (split[i]));
/* unblock signal */
g_signal_handler_unblock (dialog->geometry_button[i], dialog->geometry_set_signal_id[i]);
}
g_strfreev (split);
}
......@@ -1716,15 +1728,19 @@ terminal_preferences_dialog_geometry_changed (TerminalPreferencesDialog *dialog,
terminal_return_if_fail (TERMINAL_IS_PREFERENCES_DIALOG (dialog));
terminal_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
cols = gtk_spin_button_get_value_as_int (dialog->geometry_columns_button);
rows = gtk_spin_button_get_value_as_int (dialog->geometry_rows_button);
cols = gtk_spin_button_get_value_as_int (dialog->geometry_button[GEOMETRY_COLUMN]);
rows = gtk_spin_button_get_value_as_int (dialog->geometry_button[GEOMETRY_ROW]);
geometry = g_strdup_printf ("%dx%d", cols, rows);
/* set property */
g_signal_handler_block (dialog->preferences, dialog->geometry_signal_id);
/* setting the property should not trigger an update on the buttons, otherwise it will go on in a loop */
g_signal_handler_block (dialog->preferences, dialog->geometry_notify_signal_id);
g_object_set (G_OBJECT (dialog->preferences), "misc-default-geometry", geometry, NULL);
g_signal_handler_unblock (dialog->preferences, dialog->geometry_signal_id);
/* unblock signal */
g_signal_handler_unblock (dialog->preferences, dialog->geometry_notify_signal_id);
g_free (geometry);
}
......@@ -1753,10 +1769,14 @@ terminal_preferences_dialog_palette_notify (TerminalPreferencesDialog *dialog)
return;
/* apply values to buttons */
for (i = 0; i < 16 && colors[i] != NULL; i++)
for (i = 0; i < N_PALETTE_BUTTONS && colors[i] != NULL; i++)
{
/* setting the color should not trigger an update in the preference, hence the "color-set" signal is being blocked */
g_signal_handler_block (GTK_WIDGET (dialog->palette_button[i]), dialog->palette_set_signal_id[i]);
if (gdk_rgba_parse (&color, colors[i]))
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->buttons[i]), &color);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->palette_button[i]), &color);
/* unblock signal */
g_signal_handler_unblock (GTK_WIDGET (dialog->palette_button[i]), dialog->palette_set_signal_id[i]);
}
g_strfreev (colors);
......@@ -1778,23 +1798,27 @@ terminal_preferences_dialog_palette_changed (TerminalPreferencesDialog *dialog,
array = g_string_sized_new (225);
for (i = 0; i < 16; i++)
for (i = 0; i < N_PALETTE_BUTTONS; i++)
{
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog->buttons[i]), &color);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog->palette_button[i]), &color);
/* append to string */
color_str = gdk_rgba_to_string (&color);
g_string_append (array, color_str);
g_free (color_str);
if (i != 15)
if (i != N_PALETTE_BUTTONS - 1)
g_string_append_c (array, ';');
}
/* set property */
g_signal_handler_block (dialog->preferences, dialog->palette_signal_id);
/* setting the property should not trigger an update on the buttons, otherwise it will go on in a loop */
g_signal_handler_block (dialog->preferences, dialog->palette_notify_signal_id);
g_object_set (dialog->preferences, "color-palette", array->str, NULL);
g_signal_handler_unblock (dialog->preferences, dialog->palette_signal_id);
/* unblock signal */
g_signal_handler_unblock (dialog->preferences, dialog->palette_notify_signal_id);
g_string_free (array, TRUE);
}
......@@ -2125,10 +2149,13 @@ terminal_preferences_dialog_finalize (GObject *object)
/* disconnect signals */
if (G_LIKELY (dialog->bg_image_signal_id != 0))
g_signal_handler_disconnect (dialog->preferences, dialog->bg_image_signal_id);
if (G_LIKELY (dialog->palette_signal_id != 0))
g_signal_handler_disconnect (dialog->preferences, dialog->palette_signal_id);
if (G_LIKELY (dialog->geometry_signal_id != 0))
g_signal_handler_disconnect (dialog->preferences, dialog->geometry_signal_id);
if (G_LIKELY (dialog->palette_notify_signal_id != 0))
g_signal_handler_disconnect (dialog->preferences, dialog->palette_notify_signal_id);
if (G_LIKELY (dialog->geometry_notify_signal_id != 0))
g_signal_handler_disconnect (dialog->preferences, dialog->geometry_notify_signal_id);
/* other signals like the set-signals do not need to be disconnected since the
* instances have already been released and the respective signals taken care of */
/* release our reference on the preferences */
g_object_unref (G_OBJECT (dialog->preferences));
......
......@@ -35,6 +35,7 @@
#include <terminal/terminal-enum-types.h>
#include <terminal/terminal-preferences.h>
#include <terminal/terminal-private.h>
#include <xfconf/xfconf.h>
#define TERMINALRC "xfce4/terminal/terminalrc"
#define TERMINALRC_OLD "Terminal/terminalrc"
......@@ -111,7 +112,6 @@ enum
PROP_USE_DEFAULT_WORKING_DIR,
PROP_DEFAULT_WORKING_DIR,
PROP_MISC_REWRAP_ON_RESIZE,
PROP_MISC_USE_SHIFT_ARROWS_TO_SCROLL,
PROP_MISC_SLIM_TABS,
PROP_MISC_NEW_TAB_ADJACENT,
PROP_MISC_SEARCH_DIALOG_OPACITY,
......@@ -137,53 +137,41 @@ enum
N_PROPERTIES,
};
static void terminal_preferences_finalize (GObject *object);
static void terminal_preferences_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void terminal_preferences_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void terminal_preferences_prop_changed (XfconfChannel *channel,
const gchar *prop_name,
const GValue *value,
TerminalPreferences *preferences);
static void terminal_preferences_load_rc_file (TerminalPreferences *preferences);
struct _TerminalPreferencesClass
{
GObjectClass parent_class;
GObjectClass __parent__;
};
struct _TerminalPreferences
{
GObject parent_instance;
GValue values[N_PROPERTIES];
GObject __parent__;
GFile *file;
GFileMonitor *monitor;
guint64 last_mtime;
XfconfChannel *channel;
guint store_idle_id;
guint loading_in_progress : 1;
gulong property_changed_id;
};
static void terminal_preferences_dispose (GObject *object);
static void terminal_preferences_finalize (GObject *object);
static void terminal_preferences_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void terminal_preferences_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void terminal_preferences_load (TerminalPreferences *preferences);
static void terminal_preferences_schedule_store (TerminalPreferences *preferences);
static gboolean terminal_preferences_store_idle (gpointer user_data);
static void terminal_preferences_store_idle_destroy (gpointer user_data);
static void terminal_preferences_monitor_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
TerminalPreferences *preferences);
static void terminal_preferences_monitor_disconnect (TerminalPreferences *preferences);
static void terminal_preferences_monitor_connect (TerminalPreferences *preferences,
const gchar *filename,
gboolean update_mtime);
static void
transform_color_to_string (const GValue *src,
GValue *dst)
......@@ -192,10 +180,7 @@ transform_color_to_string (const GValue *src,
gchar buffer[16];
color = g_value_get_boxed (src);
g_snprintf (buffer, sizeof (buffer), "#%04x%04x%04x",
(guint) (color->red * 65535),
(guint) (color->green * 65535),
(guint) (color->blue * 65535));
g_snprintf (buffer, sizeof (buffer), "#%04x%04x%04x", (guint) (color->red * 65535), (guint) (color->green * 65535), (guint) (color->blue * 65535));
g_value_set_string (dst, buffer);
}
......@@ -266,6 +251,11 @@ transform_string_to_enum (const GValue *src,
/* don't do anything in case xfconf_init() failed */
static gboolean no_xfconf = FALSE;
G_DEFINE_TYPE (TerminalPreferences, terminal_preferences, G_TYPE_OBJECT)
......@@ -279,21 +269,21 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
{
GObjectClass *gobject_class;
guint i;
const GType enum_types[] = {
GTK_TYPE_POSITION_TYPE,
TERMINAL_TYPE_BACKGROUND_STYLE,
TERMINAL_TYPE_BACKGROUND,
TERMINAL_TYPE_SCROLLBAR,
TERMINAL_TYPE_TITLE,
TERMINAL_TYPE_ERASE_BINDING,
TERMINAL_TYPE_AMBIGUOUS_WIDTH_BINDING,
TERMINAL_TYPE_CURSOR_SHAPE,
TERMINAL_TYPE_TEXT_BLINK_MODE,
TERMINAL_TYPE_RIGHT_CLICK_ACTION
};
const GType enum_types[] =
{
GTK_TYPE_POSITION_TYPE,
TERMINAL_TYPE_BACKGROUND_STYLE,
TERMINAL_TYPE_BACKGROUND,
TERMINAL_TYPE_SCROLLBAR,
TERMINAL_TYPE_TITLE,
TERMINAL_TYPE_ERASE_BINDING,
TERMINAL_TYPE_AMBIGUOUS_WIDTH_BINDING,
TERMINAL_TYPE_CURSOR_SHAPE,
TERMINAL_TYPE_TEXT_BLINK_MODE,
TERMINAL_TYPE_RIGHT_CLICK_ACTION
};
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = terminal_preferences_dispose;
gobject_class->finalize = terminal_preferences_finalize;
gobject_class->get_property = terminal_preferences_get_property;
gobject_class->set_property = terminal_preferences_set_property;
......@@ -1036,16 +1026,6 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* TerminalPreferences:misc-use-shift-arrows-to-scroll:
**/
preferences_props[PROP_MISC_USE_SHIFT_ARROWS_TO_SCROLL] =
g_param_spec_boolean ("misc-use-shift-arrows-to-scroll",
NULL,
"MiscUseShiftArrowsToScroll",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* TerminalPreferences:misc-slim-tabs:
**/
......@@ -1119,8 +1099,8 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* TerminalPreferences:overlay-scrolling:
**/
* TerminalPreferences:overlay-scrolling:
**/
preferences_props[PROP_OVERLAY_SCROLLING] =
g_param_spec_boolean ("overlay-scrolling",
NULL,
......@@ -1221,7 +1201,7 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
"TitleMode",
TERMINAL_TYPE_TITLE,
TERMINAL_TITLE_APPEND,
G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* TerminalPreferences:word-chars:
......@@ -1273,28 +1253,29 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
static void
terminal_preferences_init (TerminalPreferences *preferences)
{
/* load settings */
terminal_preferences_load (preferences);
}
const gchar check_prop[] = "/title-initial";
static void
terminal_preferences_dispose (GObject *object)
{
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
/* don't set a channel if xfconf init failed */
if (no_xfconf)
return;
/* stop file monitoring */
terminal_preferences_monitor_disconnect (preferences);
/* load the channel */
preferences->channel = xfconf_channel_get ("xfce4-terminal");
/* flush preferences */
if (G_UNLIKELY (preferences->store_idle_id != 0))
/* check one of the property to see if there are values */
if (!xfconf_channel_has_property (preferences->channel, check_prop))
{
g_source_remove (preferences->store_idle_id);
terminal_preferences_store_idle (preferences);
/* try to load the old config file & save changes */
terminal_preferences_load_rc_file (preferences);
/* set the string we check */
if (!xfconf_channel_has_property (preferences->channel, check_prop))
xfconf_channel_set_string (preferences->channel, check_prop, _("Terminal"));
}
(*G_OBJECT_CLASS (terminal_preferences_parent_class)->dispose) (object);
preferences->property_changed_id =
g_signal_connect (G_OBJECT (preferences->channel), "property-changed",
G_CALLBACK (terminal_preferences_prop_changed), preferences);
}
......@@ -1302,13 +1283,6 @@ terminal_preferences_dispose (GObject *object)
static void
terminal_preferences_finalize (GObject *object)
{
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
guint n;
for (n = 1; n < N_PROPERTIES; ++n)
if (G_IS_VALUE (preferences->values + n))
g_value_unset (preferences->values + n);
(*G_OBJECT_CLASS (terminal_preferences_parent_class)->finalize) (object);
}
......@@ -1320,21 +1294,40 @@ terminal_preferences_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
GValue *src;
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
GValue src = { 0, };
gchar prop_name[64];
gchar **array;
terminal_return_if_fail (prop_id < N_PROPERTIES);
src = preferences->values + prop_id;
if (G_VALUE_HOLDS (src, pspec->value_type))
/* only set defaults if channel is not set */
if (G_UNLIKELY (preferences->channel == NULL))
{
if (G_LIKELY (pspec->value_type == G_TYPE_STRING))
g_value_set_static_string (value, g_value_get_string (src));
else
g_value_copy (src, value);
g_param_value_set_default (pspec, value);
return;
}
/* build property name */
g_snprintf (prop_name, sizeof (prop_name), "/%s", g_param_spec_get_name (pspec));
if (G_VALUE_TYPE (value) == G_TYPE_STRV)
{
/* handle arrays directly since we cannot transform those */
array = xfconf_channel_get_string_list (preferences->channel, prop_name);
g_value_take_boxed (value, array);
}
else if (xfconf_channel_get_property (preferences->channel, prop_name, &src))
{
if (G_VALUE_TYPE (value) == G_VALUE_TYPE (&src))
g_value_copy (&src, value);
else if (!g_value_transform (&src, value))
g_printerr ("Terminal: Failed to transform property %s\n", prop_name);
g_value_unset (&src);
}
else
{
/* value is not found, return default */
g_param_value_set_default (pspec, value);
}
}
......@@ -1347,92 +1340,75 @@ terminal_preferences_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
GValue *dst;
TerminalPreferences *preferences = TERMINAL_PREFERENCES (object);
GValue dst = { 0, };
gchar prop_name[64];
gchar **array;
terminal_return_if_fail (prop_id < N_PROPERTIES);
terminal_return_if_fail (preferences_props[prop_id] == pspec);
/* leave if the channel is not set */
if (G_UNLIKELY (preferences->channel == NULL))
return;
/* build property name */
g_snprintf (prop_name, sizeof (prop_name), "/%s", g_param_spec_get_name (pspec));
dst = preferences->values + prop_id;
if (!G_IS_VALUE (dst))
if (G_VALUE_HOLDS_ENUM (value))