From 6372444cb284d9401011a3e9945f20299e3f38a1 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 14 Jul 2000 01:08:56 +0000 Subject: Removed all the global variables for preferences, since now we just use 2000-07-13 Federico Mena Quintero * preferences.h: Removed all the global variables for preferences, since now we just use GConf. * preferences.c (set_prefs_widgets): Formatting fixes. (prefs_dialog): Actually destroy the dialog once we are done. * image-view.c (image_view_init): Set the initial zoom factor to 1.0. This had been accidentally removed. (ImageViewPrivate): Removed the full_screen_zoom thing, since it does not belong here. (image_view_destroy): Reset notification IDs to zero. (image_view_set_full_screen_zoom): Removed function. (image_view_get_full_screen_zoom): Ditto. * window.c (window_open_image): Actually call window_get_auto_size(). (window_set_auto_size): Do not queue a draw, since it is not needed. (window_destroy): Eeeek! Free the private structure *after* we are done using it! (window_destroy): Also remove the auto_size_notify_id. * commands.c (cmd_cb_full_screen): Get the preferences from the GConf client. --- shell/preferences.c | 120 +++++++++++++++++++++++++++++++++------------------- shell/preferences.h | 31 -------------- 2 files changed, 76 insertions(+), 75 deletions(-) (limited to 'shell') diff --git a/shell/preferences.c b/shell/preferences.c index b338fe99..958a957e 100644 --- a/shell/preferences.c +++ b/shell/preferences.c @@ -32,6 +32,8 @@ #include "e-dialog-widgets.h" #include "preferences.h" + + /* Glade definition and contents of the preferences dialog */ static GladeXML *p_xml; @@ -47,10 +49,11 @@ static GtkWidget *p_window_auto_size; static GtkWidget *p_open_new_window; static GtkWidget *p_full_screen_sb_policy; static GtkWidget *p_full_screen_zoom_radio; -static GSList *p_full_screen_zoom; static GtkWidget *p_full_screen_fit_standard; static GtkWidget *p_full_screen_bevel; + + /* Brings attention to a window by raising it and giving it focus */ static void raise_and_focus (GtkWidget *widget) @@ -122,12 +125,14 @@ static void apply_cb (GnomePropertyBox *pbox, gint page_num, gpointer data) { GConfClient *client; - + if (page_num != -1) return; client = gconf_client_get_default(); + /* View options */ + gconf_client_set_int (client, "/apps/eog/view/interp_type", e_dialog_option_menu_get (GTK_WIDGET (p_interp_type), interp_types), NULL); @@ -143,6 +148,8 @@ apply_cb (GnomePropertyBox *pbox, gint page_num, gpointer data) gconf_client_set_int (client, "/apps/eog/view/scroll", e_dialog_toggle_get (GTK_WIDGET (p_scroll)), NULL); + /* Window options */ + gconf_client_set_int (client, "/apps/eog/window/sb_policy", e_dialog_option_menu_get (GTK_WIDGET (p_window_sb_policy), sb_policies), NULL); @@ -151,6 +158,8 @@ apply_cb (GnomePropertyBox *pbox, gint page_num, gpointer data) gconf_client_set_bool (client, "/apps/eog/window/open_new_window", e_dialog_toggle_get (GTK_WIDGET (p_open_new_window)), NULL); + /* Full screen options */ + gconf_client_set_int (client, "/apps/eog/full_screen/sb_policy", e_dialog_option_menu_get (GTK_WIDGET (p_full_screen_sb_policy), sb_policies), NULL); @@ -163,7 +172,6 @@ apply_cb (GnomePropertyBox *pbox, gint page_num, gpointer data) e_dialog_toggle_get (GTK_WIDGET (p_full_screen_bevel)), NULL); gtk_object_unref (GTK_OBJECT (client)); - } /* Loads the preferences dialog from the Glade file */ @@ -225,44 +233,62 @@ set_prefs_widgets (void) client = gconf_client_get_default (); - e_dialog_option_menu_set (GTK_WIDGET (p_interp_type), gconf_client_get_int ( - client, "/apps/eog/view/interp_type", - NULL), interp_types); - e_dialog_option_menu_set (GTK_WIDGET (p_check_type), gconf_client_get_int ( - client, "/apps/eog/view/check_type", - NULL), check_types); - e_dialog_option_menu_set (GTK_WIDGET (p_check_size), gconf_client_get_int ( - client, "/apps/eog/view/check_size", - NULL), check_sizes); - e_dialog_option_menu_set (GTK_WIDGET (p_dither), gconf_client_get_int ( - client, "/apps/eog/view/dither", - NULL), dither_types); - e_dialog_toggle_set (GTK_WIDGET (p_scroll), gconf_client_get_int ( - client, "/apps/eog/view/scroll", - NULL)); - - e_dialog_option_menu_set (GTK_WIDGET (p_window_sb_policy), gconf_client_get_int ( - client, "/apps/eog/window/sb_policy", - NULL), sb_policies); - e_dialog_toggle_set (GTK_WIDGET (p_window_auto_size), gconf_client_get_bool ( - client, "/apps/eog/window/auto_size", - NULL)); - e_dialog_toggle_set (GTK_WIDGET (p_open_new_window), gconf_client_get_bool ( - client, "/apps/eog/window/open_new_window", - NULL)); - - e_dialog_option_menu_set (GTK_WIDGET (p_full_screen_sb_policy), gconf_client_get_int ( - client, "/apps/eog/full_screen/sb_policy", - NULL), sb_policies); - e_dialog_radio_set (GTK_WIDGET (p_full_screen_zoom_radio), gconf_client_get_int ( - client, "/apps/eog/full_screen/zoom", - NULL), full_screen_zooms); - e_dialog_toggle_set (GTK_WIDGET (p_full_screen_fit_standard), gconf_client_get_bool ( - client, "/apps/eog/full_screen/fit_standard", - NULL)); - e_dialog_toggle_set (GTK_WIDGET (p_full_screen_bevel), gconf_client_get_bool ( - client, "/apps/eog/full_screen/bevel", - NULL)); + /* View options */ + + e_dialog_option_menu_set (GTK_WIDGET (p_interp_type), + gconf_client_get_int ( + client, "/apps/eog/view/interp_type", + NULL), interp_types); + e_dialog_option_menu_set (GTK_WIDGET (p_check_type), + gconf_client_get_int ( + client, "/apps/eog/view/check_type", + NULL), check_types); + e_dialog_option_menu_set (GTK_WIDGET (p_check_size), + gconf_client_get_int ( + client, "/apps/eog/view/check_size", + NULL), check_sizes); + e_dialog_option_menu_set (GTK_WIDGET (p_dither), + gconf_client_get_int ( + client, "/apps/eog/view/dither", + NULL), dither_types); + e_dialog_toggle_set (GTK_WIDGET (p_scroll), + gconf_client_get_int ( + client, "/apps/eog/view/scroll", + NULL)); + + /* Window options */ + + e_dialog_option_menu_set (GTK_WIDGET (p_window_sb_policy), + gconf_client_get_int ( + client, "/apps/eog/window/sb_policy", + NULL), sb_policies); + e_dialog_toggle_set (GTK_WIDGET (p_window_auto_size), + gconf_client_get_bool ( + client, "/apps/eog/window/auto_size", + NULL)); + e_dialog_toggle_set (GTK_WIDGET (p_open_new_window), + gconf_client_get_bool ( + client, "/apps/eog/window/open_new_window", + NULL)); + + /* Full screen options */ + + e_dialog_option_menu_set (GTK_WIDGET (p_full_screen_sb_policy), + gconf_client_get_int ( + client, "/apps/eog/full_screen/sb_policy", + NULL), sb_policies); + e_dialog_radio_set (GTK_WIDGET (p_full_screen_zoom_radio), + gconf_client_get_int ( + client, "/apps/eog/full_screen/zoom", + NULL), full_screen_zooms); + e_dialog_toggle_set (GTK_WIDGET (p_full_screen_fit_standard), + gconf_client_get_bool ( + client, "/apps/eog/full_screen/fit_standard", + NULL)); + e_dialog_toggle_set (GTK_WIDGET (p_full_screen_bevel), + gconf_client_get_bool ( + client, "/apps/eog/full_screen/bevel", + NULL)); gtk_object_unref (GTK_OBJECT (client)); } @@ -271,16 +297,22 @@ set_prefs_widgets (void) static void hook_prefs_widgets (void) { + /* View options */ + e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_interp_type)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_check_type)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_check_size)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_dither)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_scroll)); + /* Window options */ + e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_window_sb_policy)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_window_auto_size)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_open_new_window)); + /* Full screen options */ + e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_full_screen_sb_policy)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_full_screen_zoom_radio)); e_dialog_widget_hook_property (GTK_WIDGET (p_dialog), GTK_WIDGET (p_full_screen_fit_standard)); @@ -317,8 +349,8 @@ prefs_dialog (void) gtk_object_unref (GTK_OBJECT (p_xml)); p_xml = NULL; -#if 0 - gtk_widget_destroy (p_dialog); -#endif + /* The stupid thing already destroyed itself, so we don't destroy it + * ourselves. + */ p_dialog = NULL; } diff --git a/shell/preferences.h b/shell/preferences.h index e5b6e029..e5d7a5cf 100644 --- a/shell/preferences.h +++ b/shell/preferences.h @@ -25,9 +25,6 @@ #include #include -/* Interpolation type for views */ -extern GdkInterpType prefs_interp_type; - /* Type of checks for views */ typedef enum { CHECK_TYPE_DARK, @@ -38,8 +35,6 @@ typedef enum { CHECK_TYPE_WHITE } CheckType; -extern CheckType prefs_check_type; - /* Check size for views */ typedef enum { CHECK_SIZE_SMALL, @@ -47,31 +42,12 @@ typedef enum { CHECK_SIZE_LARGE } CheckSize; -extern CheckSize prefs_check_size; - -/* Dither type */ -extern GdkRgbDither prefs_dither; - /* Scrolling type for views */ typedef enum { SCROLL_NORMAL, SCROLL_TWO_PASS } ScrollType; -extern ScrollType prefs_scroll; - -/* Scrollbar policy for image windows */ -extern GtkPolicyType prefs_window_sb_policy; - -/* Pick window size and zoom factor automatically for image windows */ -extern gboolean prefs_window_auto_size; - -/* Open images in a new window */ -extern gboolean prefs_open_new_window; - -/* Scrollbar policy for full screen mode */ -extern GtkPolicyType prefs_full_screen_sb_policy; - /* Automatic zoom for full screen mode */ typedef enum { FULL_SCREEN_ZOOM_1, @@ -79,13 +55,6 @@ typedef enum { FULL_SCREEN_ZOOM_FIT } FullScreenZoom; -extern FullScreenZoom prefs_full_screen_zoom; - -/* Fit standard-sized images to full screen mode */ -extern gboolean prefs_full_screen_fit_standard; - -/* Put a bevel around the edge of the screen */ -extern gboolean prefs_full_screen_bevel; void prefs_init (void); -- cgit v1.2.1