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 GObject * eom_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { 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; 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_settings_bind (priv->view_settings, EOM_CONF_VIEW_INTERPOLATE, G_OBJECT (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); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_AUTOROTATE, G_OBJECT (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); g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_BACKGROUND_COLOR, bg_color_button, "color", G_SETTINGS_BIND_DEFAULT, pd_string_to_color_mapping, pd_color_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); 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); break; case EOM_TRANSP_CHECKED: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (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); break; } g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR, color_button, "color", G_SETTINGS_BIND_DEFAULT, pd_string_to_color_mapping, pd_color_to_string_mapping, NULL, NULL); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_UPSCALE, 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); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_RANDOM, G_OBJECT (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); random_change_cb (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_RANDOM, 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); gtk_widget_show_all (plugin_manager); return object; }
static GObject * eom_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { 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 *loop_check; GtkWidget *seconds_spin; GtkWidget *plugin_manager; GtkWidget *plugin_manager_container; GObject *object; GdkColor color; gchar *value; object = G_OBJECT_CLASS (eom_preferences_dialog_parent_class)->constructor (type, n_construct_properties, construct_params); priv = EOM_PREFERENCES_DIALOG (object)->priv; 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, "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_settings_bind (priv->view_settings, EOM_CONF_VIEW_INTERPOLATE, G_OBJECT (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); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_AUTOROTATE, G_OBJECT (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); value = g_settings_get_string (priv->view_settings, EOM_CONF_VIEW_BACKGROUND_COLOR); if (gdk_color_parse (value, &color)){ gtk_color_button_set_color (GTK_COLOR_BUTTON (bg_color_button), &color); } g_free (value); g_object_set_data (G_OBJECT (bg_color_button), GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_BACKGROUND_COLOR); g_signal_connect (G_OBJECT (bg_color_button), "color-set", G_CALLBACK (pd_color_change_cb), priv->view_settings); g_object_set_data (G_OBJECT (color_radio), GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (color_radio), GSETTINGS_OBJECT_VALUE, "COLOR"); g_signal_connect (G_OBJECT (color_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), priv->view_settings); g_object_set_data (G_OBJECT (checkpattern_radio), GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (checkpattern_radio), GSETTINGS_OBJECT_VALUE, "CHECK_PATTERN"); g_signal_connect (G_OBJECT (checkpattern_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), priv->view_settings); g_object_set_data (G_OBJECT (background_radio), GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANSPARENCY); g_object_set_data (G_OBJECT (background_radio), GSETTINGS_OBJECT_VALUE, "NONE"); g_signal_connect (G_OBJECT (background_radio), "toggled", G_CALLBACK (pd_radio_toggle_cb), priv->view_settings); value = g_settings_get_string (priv->view_settings, EOM_CONF_VIEW_TRANSPARENCY); if (g_ascii_strcasecmp (value, "COLOR") == 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (color_radio), TRUE); } else if (g_ascii_strcasecmp (value, "CHECK_PATTERN") == 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkpattern_radio), TRUE); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (background_radio), TRUE); } g_free (value); value = g_settings_get_string (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR); if (gdk_color_parse (value, &color)) { gtk_color_button_set_color (GTK_COLOR_BUTTON (color_button), &color); } g_object_set_data (G_OBJECT (color_button), GSETTINGS_OBJECT_KEY, EOM_CONF_VIEW_TRANS_COLOR); g_signal_connect (G_OBJECT (color_button), "color-set", G_CALLBACK (pd_color_change_cb), priv->view_settings); g_free (value); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_UPSCALE, G_OBJECT (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); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_SECONDS, G_OBJECT (seconds_spin), "value", G_SETTINGS_BIND_DEFAULT); plugin_manager = eom_plugin_manager_new (); g_assert (plugin_manager != NULL); gtk_box_pack_start (GTK_BOX (plugin_manager_container), plugin_manager, TRUE, TRUE, 0); gtk_widget_show_all (plugin_manager); return object; }