diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-10-31 06:58:12 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-10-31 06:58:12 +0800 |
commit | 362396c2bf69c659b5fcea2eaf3ed17b6ff93b09 (patch) | |
tree | 14f36a7f87ca3e938a14e43efa13a0b14d196a4d /src/prefs-dialog.c | |
parent | 87e9353728c1115e7f60b1f7bb63e79723888907 (diff) | |
download | gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar.gz gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar.bz2 gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar.lz gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar.xz gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.tar.zst gsoc2013-epiphany-362396c2bf69c659b5fcea2eaf3ed17b6ff93b09.zip |
Remove glade callbacks, and connect from code instead.
2005-10-30 Christian Persch <chpe@cvs.gnome.org>
* data/glade/epiphany.glade:
* data/glade/prefs-dialog.glade:
* data/glade/print.glade:
* embed/downloader-view.c: (update_buttons),
(downloader_view_build_ui), (download_dialog_pause),
(download_dialog_stop), (download_dialog_response_cb),
(download_dialog_delete_event_cb):
* embed/print-dialog.c: (ephy_print_setup_dialog_response_cb),
(ephy_print_setup_dialog_new):
* src/ephy-encoding-dialog.c: (ephy_encoding_dialog_init):
* src/pdm-dialog.c: (show_cookies_properties),
(cookies_properties_clicked_cb), (pdm_dialog_cookies_construct),
(passwords_show_toggled_cb), (pdm_dialog_passwords_construct),
(pdm_dialog_response_cb), (pdm_dialog_init), (pdm_dialog_finalize):
* src/prefs-dialog.c: (create_language_section),
(prefs_dialog_response_cb), (prefs_clear_cache_button_clicked_cb),
(set_homepage_entry), (prefs_homepage_current_button_clicked_cb),
(prefs_homepage_blank_button_clicked_cb), (prefs_dialog_init):
Remove glade callbacks, and connect from code instead.
Diffstat (limited to 'src/prefs-dialog.c')
-rw-r--r-- | src/prefs-dialog.c | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index e0ad5891a..2ec678c6b 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -66,27 +66,6 @@ static void prefs_dialog_class_init (PrefsDialogClass *klass); static void prefs_dialog_init (PrefsDialog *pd); -/* Glade callbacks */ -void prefs_clear_cache_button_clicked_cb (GtkWidget *button, - gpointer data); -void prefs_dialog_response_cb (GtkDialog *widget, - gint response_id, - EphyDialog *dialog); -void prefs_homepage_current_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog); -void prefs_homepage_blank_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog); -void prefs_language_more_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog); -void language_editor_add_button_clicked_cb (GtkWidget *button, - PrefsDialog *pd); -void language_editor_remove_button_clicked_cb (GtkWidget *button, - PrefsDialog *pd); -void language_editor_up_button_clicked_cb (GtkWidget *button, - PrefsDialog *pd); -void language_editor_down_button_clicked_cb (GtkWidget *button, - PrefsDialog *pd); - #include "languages.h" static const char * const cookies_accept_enum [] = @@ -156,6 +135,7 @@ enum ALLOW_JS_PROP, ACCEPT_COOKIES_PROP, DISK_CACHE_PROP, + CLEAR_CACHE_BUTTON_PROP, /* Language */ AUTO_ENCODING_PROP, @@ -198,6 +178,7 @@ EphyDialogProperty properties [] = { "enable_javascript_checkbutton", CONF_SECURITY_JAVASCRIPT_ENABLED, PT_AUTOAPPLY, 0 }, { "cookies_radiobutton", CONF_SECURITY_COOKIES_ACCEPT, PT_AUTOAPPLY, G_TYPE_STRING }, { "disk_cache_spin", CONF_NETWORK_CACHE_SIZE, PT_AUTOAPPLY, 0 }, + { "clear_cache_button", NULL, PT_NORMAL, 0 }, /* Languages */ { "auto_encoding_combo", CONF_LANGUAGE_AUTODETECT_ENCODING, PT_AUTOAPPLY, G_TYPE_STRING }, @@ -889,7 +870,7 @@ setup_add_language_dialog (PrefsDialog *pd) return dialog; } -void +static void language_editor_add_button_clicked_cb (GtkWidget *button, PrefsDialog *pd) { @@ -905,7 +886,7 @@ language_editor_add_button_clicked_cb (GtkWidget *button, ephy_dialog_show (pd->priv->add_lang_dialog); } -void +static void language_editor_remove_button_clicked_cb (GtkWidget *button, PrefsDialog *pd) { @@ -924,7 +905,7 @@ language_editor_remove_button_clicked_cb (GtkWidget *button, language_editor_update_buttons (pd); } -void +static void language_editor_up_button_clicked_cb (GtkWidget *button, PrefsDialog *pd) { @@ -956,7 +937,7 @@ language_editor_up_button_clicked_cb (GtkWidget *button, language_editor_update_buttons (pd); } -void +static void language_editor_down_button_clicked_cb (GtkWidget *button, PrefsDialog *pd) { @@ -1024,6 +1005,15 @@ create_language_section (EphyDialog *dialog) properties[LANGUAGE_DOWN_BUTTON_PROP].id, &pd->priv->lang_down_button, NULL); + g_signal_connect (pd->priv->lang_add_button, "clicked", + G_CALLBACK (language_editor_add_button_clicked_cb), dialog); + g_signal_connect (pd->priv->lang_remove_button, "clicked", + G_CALLBACK (language_editor_remove_button_clicked_cb), dialog); + g_signal_connect (pd->priv->lang_up_button, "clicked", + G_CALLBACK (language_editor_up_button_clicked_cb), dialog); + g_signal_connect (pd->priv->lang_down_button, "clicked", + G_CALLBACK (language_editor_down_button_clicked_cb), dialog); + /* setup the languages treeview */ pd->priv->lang_treeview = treeview; @@ -1181,14 +1171,83 @@ create_download_path_button (EphyDialog *dialog) gtk_widget_set_sensitive (button, eel_gconf_key_is_writable (CONF_STATE_DOWNLOAD_DIR)); g_free (dir); } - + +static void +prefs_dialog_response_cb (GtkDialog *widget, + int response, + EphyDialog *dialog) +{ + if (response == GTK_RESPONSE_HELP) + { + prefs_dialog_show_help (dialog); + return; + } + + g_object_unref (dialog); +} + +static void +prefs_clear_cache_button_clicked_cb (GtkWidget *button, + PrefsDialog *dialog) +{ + EphyEmbedShell *shell; + EphyEmbedSingle *single; + EphyFaviconCache *cache; + + shell = ephy_embed_shell_get_default (); + + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (shell)); + ephy_embed_single_clear_cache (single); + + cache = EPHY_FAVICON_CACHE (ephy_embed_shell_get_favicon_cache (shell)); + ephy_favicon_cache_clear (cache); +} + +static void +set_homepage_entry (EphyDialog *dialog, + const char *new_location) +{ + GValue value = { 0, }; + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, new_location); + ephy_dialog_set_value (dialog, properties[HOMEPAGE_ENTRY_PROP].id, &value); + g_value_unset (&value); +} + +static void +prefs_homepage_current_button_clicked_cb (GtkWidget *button, + EphyDialog *dialog) +{ + EphySession *session; + EphyWindow *window; + EphyTab *tab; + + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ())); + window = ephy_session_get_active_window (session); + + /* can't do anything in this case */ + if (window == NULL) return; + + tab = ephy_window_get_active_tab (window); + g_return_if_fail (tab != NULL); + + set_homepage_entry (dialog, ephy_tab_get_address (tab)); +} + +static void +prefs_homepage_blank_button_clicked_cb (GtkWidget *button, + EphyDialog *dialog) +{ + set_homepage_entry (dialog, NULL); +} static void prefs_dialog_init (PrefsDialog *pd) { EphyDialog *dialog = EPHY_DIALOG (pd); EphyEncodings *encodings; GtkWidget *window, *curr_button, *blank_button; - GtkWidget *variable_combo, *monospace_combo; + GtkWidget *variable_combo, *monospace_combo, *clear_cache_button; GtkCellRenderer *renderer; gboolean sensitive; @@ -1210,10 +1269,19 @@ prefs_dialog_init (PrefsDialog *pd) properties[HOMEPAGE_BLANK_PROP].id, &blank_button, properties[VARIABLE_PROP].id, &variable_combo, properties[MONOSPACE_PROP].id, &monospace_combo, + properties[CLEAR_CACHE_BUTTON_PROP].id, &clear_cache_button, NULL); gtk_window_set_icon_name (GTK_WINDOW (window), GTK_STOCK_PREFERENCES); + g_signal_connect (window, "response", + G_CALLBACK (prefs_dialog_response_cb), dialog); + + g_signal_connect (curr_button, "clicked", + G_CALLBACK (prefs_homepage_current_button_clicked_cb), dialog); + g_signal_connect (blank_button, "clicked", + G_CALLBACK (prefs_homepage_blank_button_clicked_cb), dialog); + /* set homepage button sensitivity */ sensitive = eel_gconf_key_is_writable (CONF_GENERAL_HOMEPAGE); gtk_widget_set_sensitive (curr_button, sensitive); @@ -1234,6 +1302,9 @@ prefs_dialog_init (PrefsDialog *pd) create_fonts_language_menu (dialog); + g_signal_connect (clear_cache_button, "clicked", + G_CALLBACK (prefs_clear_cache_button_clicked_cb), dialog); + encodings = EPHY_ENCODINGS (ephy_embed_shell_get_encodings (EPHY_EMBED_SHELL (ephy_shell))); @@ -1248,74 +1319,3 @@ prefs_dialog_init (PrefsDialog *pd) create_download_path_button (dialog); } - -void -prefs_dialog_response_cb (GtkDialog *widget, - gint response_id, - EphyDialog *dialog) -{ - if (response_id == GTK_RESPONSE_CLOSE) - { - g_object_unref (dialog); - } - else if (response_id == GTK_RESPONSE_HELP) - { - prefs_dialog_show_help (dialog); - } -} - -void -prefs_clear_cache_button_clicked_cb (GtkWidget *button, - gpointer data) -{ - EphyEmbedShell *shell; - EphyEmbedSingle *single; - EphyFaviconCache *cache; - - shell = ephy_embed_shell_get_default (); - - single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (shell)); - ephy_embed_single_clear_cache (single); - - cache = EPHY_FAVICON_CACHE (ephy_embed_shell_get_favicon_cache (shell)); - ephy_favicon_cache_clear (cache); -} - -static void -set_homepage_entry (EphyDialog *dialog, - const char *new_location) -{ - GValue value = { 0, }; - - g_value_init (&value, G_TYPE_STRING); - g_value_set_string (&value, new_location); - ephy_dialog_set_value (dialog, properties[HOMEPAGE_ENTRY_PROP].id, &value); - g_value_unset (&value); -} - -void -prefs_homepage_current_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog) -{ - EphySession *session; - EphyWindow *window; - EphyTab *tab; - - session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ())); - window = ephy_session_get_active_window (session); - - /* can't do anything in this case */ - if (window == NULL) return; - - tab = ephy_window_get_active_tab (window); - g_return_if_fail (tab != NULL); - - set_homepage_entry (dialog, ephy_tab_get_address (tab)); -} - -void -prefs_homepage_blank_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog) -{ - set_homepage_entry (dialog, NULL); -} |