summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/Makefile.am2
-rw-r--r--data/eom-preferences-dialog.ui20
-rw-r--r--src/eom-preferences-dialog.c335
-rw-r--r--src/eom-preferences-dialog.h7
-rw-r--r--src/eom-window.c4
-rw-r--r--src/eom.gresource.xml1
6 files changed, 178 insertions, 191 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index f822dd5..fdcce09 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -22,7 +22,6 @@ gsettings_SCHEMAS = org.mate.eom.gschema.xml
uidir = $(pkgdatadir)
ui_DATA = \
- eom-preferences-dialog.ui \
eom-toolbar.xml
pkgconfigdir = $(libdir)/pkgconfig
@@ -33,6 +32,7 @@ EXTRA_DIST = \
eom.css \
eom-image-properties-dialog.ui \
eom-multiple-save-as-dialog.ui \
+ eom-preferences-dialog.ui \
eom-ui.xml \
metadata-sidebar.ui \
$(DESKTOP_IN_FILES) \
diff --git a/data/eom-preferences-dialog.ui b/data/eom-preferences-dialog.ui
index 5b17d78..7e2d676 100644
--- a/data/eom-preferences-dialog.ui
+++ b/data/eom-preferences-dialog.ui
@@ -2,6 +2,7 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.14"/>
+ <requires lib="libpeas-gtk" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100</property>
@@ -9,20 +10,18 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkDialog" id="eom_preferences_dialog">
+ <template class="EomPreferencesDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Eye of MATE Preferences</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
@@ -369,7 +368,7 @@
</packing>
</child>
<child>
- <object class="GtkColorButton" id="color_button">
+ <object class="GtkColorButton" id="transp_color_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -700,7 +699,16 @@
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<child>
- <placeholder/>
+ <object class="PeasGtkPluginManager" id="plugin_manager">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
@@ -734,5 +742,5 @@
<style>
<class name="eom-preferences-dialog"/>
</style>
- </object>
+ </template>
</interface>
diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c
index d4a59ad..bfc7e9f 100644
--- a/src/eom-preferences-dialog.c
+++ b/src/eom-preferences-dialog.c
@@ -45,11 +45,28 @@ struct _EomPreferencesDialogPrivate {
GSettings *view_settings;
GSettings *ui_settings;
GSettings *fullscreen_settings;
+
+ GtkWidget *interpolate_check;
+ GtkWidget *extrapolate_check;
+ GtkWidget *autorotate_check;
+ GtkWidget *bg_color_check;
+ GtkWidget *bg_color_button;
+ GtkWidget *color_radio;
+ GtkWidget *checkpattern_radio;
+ GtkWidget *background_radio;
+ GtkWidget *transp_color_button;
+
+ GtkWidget *upscale_check;
+ GtkWidget *random_check;
+ GtkWidget *loop_check;
+ GtkWidget *seconds_spin;
+
+ GtkWidget *plugin_manager;
};
static GObject *instance = NULL;
-G_DEFINE_TYPE_WITH_PRIVATE (EomPreferencesDialog, eom_preferences_dialog, EOM_TYPE_DIALOG);
+G_DEFINE_TYPE_WITH_PRIVATE (EomPreferencesDialog, eom_preferences_dialog, GTK_TYPE_DIALOG);
static gboolean
pd_string_to_rgba_mapping (GValue *value,
@@ -123,229 +140,191 @@ eom_preferences_response_cb (GtkDialog *dlg, gint res_id, gpointer data)
}
}
-static GObject *
-eom_preferences_dialog_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
-
+static void
+eom_preferences_dialog_class_init (EomPreferencesDialogClass *klass)
+{
+ GtkWidgetClass *widget_class = (GtkWidgetClass*) klass;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/mate/eom/ui/eom-preferences-dialog.ui");
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ interpolate_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ extrapolate_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ autorotate_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ bg_color_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ bg_color_button);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ color_radio);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ checkpattern_radio);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ background_radio);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ transp_color_button);
+
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ upscale_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ random_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ loop_check);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ seconds_spin);
+
+ gtk_widget_class_bind_template_child_private (widget_class,
+ EomPreferencesDialog,
+ plugin_manager);
+}
+
+static void
+eom_preferences_dialog_init (EomPreferencesDialog *pref_dlg)
{
EomPreferencesDialogPrivate *priv;
- GtkWidget *dlg;
- GtkWidget *interpolate_check;
- GtkWidget *extrapolate_check;
- GtkWidget *autorotate_check;
- GtkWidget *bg_color_check;
- GtkWidget *bg_color_button;
- GtkWidget *color_radio;
- GtkWidget *checkpattern_radio;
- GtkWidget *background_radio;
- GtkWidget *color_button;
- GtkWidget *upscale_check;
- GtkWidget *random_check;
- GtkWidget *loop_check;
- GtkWidget *seconds_spin;
- GtkWidget *plugin_manager;
- GtkWidget *plugin_manager_container;
- GObject *object;
-
- object = G_OBJECT_CLASS (eom_preferences_dialog_parent_class)->constructor
- (type, n_construct_properties, construct_params);
-
- priv = EOM_PREFERENCES_DIALOG (object)->priv;
+
+ pref_dlg->priv = eom_preferences_dialog_get_instance_private (pref_dlg);
+ priv = pref_dlg->priv;
+
+ gtk_widget_init_template (GTK_WIDGET (pref_dlg));
priv->view_settings = g_settings_new (EOM_CONF_VIEW);
priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN);
- eom_dialog_construct (EOM_DIALOG (object),
- "eom-preferences-dialog.ui",
- "eom_preferences_dialog");
-
- eom_dialog_get_controls (EOM_DIALOG (object),
- "eom_preferences_dialog", &dlg,
- "interpolate_check", &interpolate_check,
- "extrapolate_check", &extrapolate_check,
- "autorotate_check", &autorotate_check,
- "bg_color_check", &bg_color_check,
- "bg_color_button", &bg_color_button,
- "color_radio", &color_radio,
- "checkpattern_radio", &checkpattern_radio,
- "background_radio", &background_radio,
- "color_button", &color_button,
- "upscale_check", &upscale_check,
- "random_check", &random_check,
- "loop_check", &loop_check,
- "seconds_spin", &seconds_spin,
- "plugin_manager_container", &plugin_manager_container,
- NULL);
-
- g_signal_connect (G_OBJECT (dlg),
- "response",
- G_CALLBACK (eom_preferences_response_cb),
- dlg);
+ g_signal_connect (G_OBJECT (pref_dlg),
+ "response",
+ G_CALLBACK (eom_preferences_response_cb),
+ pref_dlg);
g_settings_bind (priv->view_settings,
- EOM_CONF_VIEW_INTERPOLATE,
- G_OBJECT (interpolate_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_VIEW_INTERPOLATE,
+ priv->interpolate_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->view_settings,
- EOM_CONF_VIEW_EXTRAPOLATE,
- G_OBJECT (extrapolate_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_VIEW_EXTRAPOLATE,
+ priv->extrapolate_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->view_settings,
- EOM_CONF_VIEW_AUTOROTATE,
- G_OBJECT (autorotate_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_VIEW_AUTOROTATE,
+ priv->autorotate_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->view_settings,
- EOM_CONF_VIEW_USE_BG_COLOR,
- G_OBJECT (bg_color_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_VIEW_USE_BG_COLOR,
+ priv->bg_color_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind_with_mapping (priv->view_settings,
- EOM_CONF_VIEW_BACKGROUND_COLOR,
- bg_color_button, "rgba",
- G_SETTINGS_BIND_DEFAULT,
- pd_string_to_rgba_mapping,
- pd_rgba_to_string_mapping,
- NULL, NULL);
-
- g_object_set_data (G_OBJECT (color_radio),
- GSETTINGS_OBJECT_VALUE,
- GINT_TO_POINTER (EOM_TRANSP_COLOR));
-
- g_signal_connect (G_OBJECT (color_radio),
- "toggled",
- G_CALLBACK (pd_transp_radio_toggle_cb),
- priv->view_settings);
-
- g_object_set_data (G_OBJECT (checkpattern_radio),
- GSETTINGS_OBJECT_VALUE,
- GINT_TO_POINTER (EOM_TRANSP_CHECKED));
-
- g_signal_connect (G_OBJECT (checkpattern_radio),
- "toggled",
- G_CALLBACK (pd_transp_radio_toggle_cb),
- priv->view_settings);
-
- g_object_set_data (G_OBJECT (background_radio),
- GSETTINGS_OBJECT_VALUE,
- GINT_TO_POINTER (EOM_TRANSP_BACKGROUND));
-
- g_signal_connect (G_OBJECT (background_radio),
- "toggled",
- G_CALLBACK (pd_transp_radio_toggle_cb),
- priv->view_settings);
+ EOM_CONF_VIEW_BACKGROUND_COLOR,
+ priv->bg_color_button, "rgba",
+ G_SETTINGS_BIND_DEFAULT,
+ pd_string_to_rgba_mapping,
+ pd_rgba_to_string_mapping,
+ NULL, NULL);
+ g_object_set_data (G_OBJECT (priv->color_radio),
+ GSETTINGS_OBJECT_VALUE,
+ GINT_TO_POINTER (EOM_TRANSP_COLOR));
+
+ g_signal_connect (G_OBJECT (priv->color_radio),
+ "toggled",
+ G_CALLBACK (pd_transp_radio_toggle_cb),
+ priv->view_settings);
+
+ g_object_set_data (G_OBJECT (priv->checkpattern_radio),
+ GSETTINGS_OBJECT_VALUE,
+ GINT_TO_POINTER (EOM_TRANSP_CHECKED));
+
+ g_signal_connect (G_OBJECT (priv->checkpattern_radio),
+ "toggled",
+ G_CALLBACK (pd_transp_radio_toggle_cb),
+ priv->view_settings);
+
+ g_object_set_data (G_OBJECT (priv->background_radio),
+ GSETTINGS_OBJECT_VALUE,
+ GINT_TO_POINTER (EOM_TRANSP_BACKGROUND));
+
+ g_signal_connect (G_OBJECT (priv->background_radio),
+ "toggled",
+ G_CALLBACK (pd_transp_radio_toggle_cb),
+ priv->view_settings);
switch (g_settings_get_enum (priv->view_settings,
EOM_CONF_VIEW_TRANSPARENCY))
{
case EOM_TRANSP_COLOR:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (color_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->color_radio), TRUE);
break;
case EOM_TRANSP_CHECKED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkpattern_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkpattern_radio), TRUE);
break;
default:
// Log a warning and use EOM_TRANSP_BACKGROUND as fallback
g_warn_if_reached ();
case EOM_TRANSP_BACKGROUND:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (background_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->background_radio), TRUE);
break;
}
g_settings_bind_with_mapping (priv->view_settings,
- EOM_CONF_VIEW_TRANS_COLOR,
- color_button, "rgba",
- G_SETTINGS_BIND_DEFAULT,
- pd_string_to_rgba_mapping,
- pd_rgba_to_string_mapping,
- NULL, NULL);
+ EOM_CONF_VIEW_TRANS_COLOR,
+ priv->transp_color_button, "rgba",
+ G_SETTINGS_BIND_DEFAULT,
+ pd_string_to_rgba_mapping,
+ pd_rgba_to_string_mapping,
+ NULL, NULL);
g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_UPSCALE,
- upscale_check, "active", G_SETTINGS_BIND_DEFAULT);
+ priv->upscale_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->fullscreen_settings,
- EOM_CONF_FULLSCREEN_LOOP,
- G_OBJECT (loop_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_FULLSCREEN_LOOP,
+ priv->loop_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->fullscreen_settings,
- EOM_CONF_FULLSCREEN_RANDOM,
- G_OBJECT (random_check),
- "active",
- G_SETTINGS_BIND_DEFAULT);
+ EOM_CONF_FULLSCREEN_RANDOM,
+ priv->random_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect (priv->fullscreen_settings,
- "changed::" EOM_CONF_FULLSCREEN_RANDOM,
- G_CALLBACK (random_change_cb),
- loop_check);
+ "changed::" EOM_CONF_FULLSCREEN_RANDOM,
+ G_CALLBACK (random_change_cb),
+ priv->loop_check);
random_change_cb (priv->fullscreen_settings,
- EOM_CONF_FULLSCREEN_RANDOM,
- loop_check);
+ EOM_CONF_FULLSCREEN_RANDOM,
+ priv->loop_check);
g_settings_bind (priv->fullscreen_settings,
- EOM_CONF_FULLSCREEN_SECONDS,
- G_OBJECT (seconds_spin),
- "value",
- G_SETTINGS_BIND_DEFAULT);
-
- plugin_manager = peas_gtk_plugin_manager_new (NULL);
-
- g_assert (plugin_manager != NULL);
-
- gtk_box_pack_start (GTK_BOX (plugin_manager_container),
- plugin_manager,
- TRUE,
- TRUE,
- 0);
+ EOM_CONF_FULLSCREEN_SECONDS,
+ priv->seconds_spin, "value",
+ G_SETTINGS_BIND_DEFAULT);
- gtk_widget_show_all (plugin_manager);
-
- return object;
+ gtk_widget_show_all (priv->plugin_manager);
}
-static void
-eom_preferences_dialog_dispose (GObject *object)
-{
- EomPreferencesDialog *pref_dlg = EOM_PREFERENCES_DIALOG (object);
-
- g_object_unref (pref_dlg->priv->view_settings);
- g_object_unref (pref_dlg->priv->fullscreen_settings);
- g_object_unref (pref_dlg->priv->ui_settings);
-
- G_OBJECT_CLASS (eom_preferences_dialog_parent_class)->dispose (object);
-}
-
-static void
-eom_preferences_dialog_class_init (EomPreferencesDialogClass *class)
-{
- GObjectClass *g_object_class = (GObjectClass *) class;
-
- g_object_class->constructor = eom_preferences_dialog_constructor;
- g_object_class->dispose = eom_preferences_dialog_dispose;
-}
-
-static void
-eom_preferences_dialog_init (EomPreferencesDialog *pref_dlg)
-{
- pref_dlg->priv = eom_preferences_dialog_get_instance_private (pref_dlg);
-
- pref_dlg->priv->view_settings = g_settings_new (EOM_CONF_VIEW);
- pref_dlg->priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN);
- pref_dlg->priv->ui_settings = g_settings_new (EOM_CONF_UI);
-}
-
-GObject *
-eom_preferences_dialog_get_instance (GtkWindow *parent)
+GtkWidget *eom_preferences_dialog_get_instance (GtkWindow *parent)
{
if (instance == NULL) {
instance = g_object_new (EOM_TYPE_PREFERENCES_DIALOG,
- "parent-window", parent,
NULL);
}
- return instance;
+ if (parent)
+ gtk_window_set_transient_for (GTK_WINDOW (instance), parent);
+
+ return GTK_WIDGET(instance);
}
diff --git a/src/eom-preferences-dialog.h b/src/eom-preferences-dialog.h
index dd7d184..da912d0 100644
--- a/src/eom-preferences-dialog.h
+++ b/src/eom-preferences-dialog.h
@@ -22,7 +22,6 @@
#ifndef __EOM_PREFERENCES_DIALOG_H__
#define __EOM_PREFERENCES_DIALOG_H__
-#include "eom-dialog.h"
#include "eom-image.h"
#include "eom-thumb-view.h"
@@ -45,20 +44,20 @@ typedef struct _EomPreferencesDialogPrivate EomPreferencesDialogPrivate;
#define EOM_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EOM_TYPE_PREFERENCES_DIALOG, EomPreferencesDialogClass))
struct _EomPreferencesDialog {
- EomDialog dialog;
+ GtkDialog dialog;
EomPreferencesDialogPrivate *priv;
};
struct _EomPreferencesDialogClass {
- EomDialogClass parent_class;
+ GtkDialogClass parent_class;
};
G_GNUC_INTERNAL
GType eom_preferences_dialog_get_type (void) G_GNUC_CONST;
G_GNUC_INTERNAL
-GObject *eom_preferences_dialog_get_instance (GtkWindow *parent);
+GtkWidget *eom_preferences_dialog_get_instance (GtkWindow *parent);
G_END_DECLS
diff --git a/src/eom-window.c b/src/eom-window.c
index 84598b4..783a451 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -2400,7 +2400,7 @@ static void
eom_window_cmd_preferences (GtkAction *action, gpointer user_data)
{
EomWindow *window;
- GObject *pref_dlg;
+ GtkWidget *pref_dlg;
g_return_if_fail (EOM_IS_WINDOW (user_data));
@@ -2408,7 +2408,7 @@ eom_window_cmd_preferences (GtkAction *action, gpointer user_data)
pref_dlg = eom_preferences_dialog_get_instance (GTK_WINDOW (window));
- eom_dialog_show (EOM_DIALOG (pref_dlg));
+ gtk_widget_show (pref_dlg);
}
#define EOM_TB_EDITOR_DLG_RESET_RESPONSE 128
diff --git a/src/eom.gresource.xml b/src/eom.gresource.xml
index 66826c6..1904e8c 100644
--- a/src/eom.gresource.xml
+++ b/src/eom.gresource.xml
@@ -4,6 +4,7 @@
<file>eom.css</file>
<file compressed="true" preprocess="xml-stripblanks">eom-image-properties-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">eom-multiple-save-as-dialog.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">eom-preferences-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">eom-ui.xml</file>
<file compressed="true" preprocess="xml-stripblanks">metadata-sidebar.ui</file>
<file>pixmaps/thumbnail-frame.png</file>