aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-10-31 06:58:12 +0800
committerChristian Persch <chpe@src.gnome.org>2005-10-31 06:58:12 +0800
commit362396c2bf69c659b5fcea2eaf3ed17b6ff93b09 (patch)
tree14f36a7f87ca3e938a14e43efa13a0b14d196a4d /src
parent87e9353728c1115e7f60b1f7bb63e79723888907 (diff)
downloadgsoc2013-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')
-rw-r--r--src/ephy-encoding-dialog.c13
-rwxr-xr-xsrc/pdm-dialog.c402
-rw-r--r--src/prefs-dialog.c196
3 files changed, 308 insertions, 303 deletions
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 8d9f1cb71..261b8f4b5 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -43,6 +43,7 @@
enum
{
+ WINDOW_PROP,
SCROLLED_WINDOW_PROP,
AUTOMATIC_PROP,
MANUAL_PROP
@@ -51,6 +52,7 @@ enum
static const
EphyDialogProperty properties [] =
{
+ { "encoding_dialog", NULL, PT_NORMAL, 0 },
{ "scrolled_window", NULL, PT_NORMAL, 0 },
{ "automatic_button", NULL, PT_NORMAL, 0 },
{ "manual_button", NULL, PT_NORMAL, 0 },
@@ -73,9 +75,6 @@ struct _EphyEncodingDialogPrivate
static void ephy_encoding_dialog_class_init (EphyEncodingDialogClass *klass);
static void ephy_encoding_dialog_init (EphyEncodingDialog *ge);
-void ephy_encoding_dialog_response_cb (GtkWidget *widget,
- int response,
- EphyEncodingDialog *dialog);
static GObjectClass *parent_class = NULL;
@@ -223,7 +222,7 @@ activate_choice (EphyEncodingDialog *dialog)
}
}
-void
+static void
ephy_encoding_dialog_response_cb (GtkWidget *widget,
int response,
EphyEncodingDialog *dialog)
@@ -286,7 +285,7 @@ automatic_toggled_cb (GtkToggleButton *button, EphyEncodingDialog *dialog)
static void
ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
{
- GtkWidget *treeview, *scroller, *button;
+ GtkWidget *treeview, *scroller, *button, *window;
GtkTreeSelection *selection;
EphyNode *node;
@@ -302,6 +301,10 @@ ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
"encoding_dialog",
NULL);
+ window = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[WINDOW_PROP].id);
+ g_signal_connect (window, "response",
+ G_CALLBACK (ephy_encoding_dialog_response_cb), dialog);
+
dialog->priv->filter = ephy_node_filter_new ();
node = ephy_encodings_get_all (dialog->priv->encodings);
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index a71cc7411..6fb5e444a 100755
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -127,17 +127,6 @@ static void pdm_dialog_class_init (PdmDialogClass *klass);
static void pdm_dialog_init (PdmDialog *dialog);
static void pdm_dialog_finalize (GObject *object);
-/* Glade callbacks */
-void pdm_dialog_close_button_clicked_cb (GtkWidget *button,
- PdmDialog *dialog);
-void pdm_dialog_cookies_properties_button_clicked_cb (GtkWidget *button,
- PdmDialog *dialog);
-void pdm_dialog_passwords_show_cb (GtkWidget *checkbox,
- PdmDialog *dialog);
-void pdm_dialog_response_cb (GtkDialog *widget,
- int response,
- PdmDialog *dialog);
-
static GObjectClass *parent_class = NULL;
GType
@@ -361,6 +350,156 @@ setup_action (PdmActionInfo *action)
/* "Cookies" tab */
static void
+show_cookies_properties (PdmDialog *dialog,
+ EphyCookie *info)
+{
+ GtkWidget *gdialog;
+ GtkWidget *table;
+ GtkWidget *label;
+ GtkWidget *parent;
+ GtkWidget *dialog_vbox;
+ char *str;
+
+ parent = ephy_dialog_get_control (EPHY_DIALOG(dialog),
+ properties[PROP_WINDOW].id);
+
+ gdialog = gtk_dialog_new_with_buttons
+ (_("Cookie Properties"),
+ GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, 0, NULL);
+ ephy_state_add_window (GTK_WIDGET (gdialog), "cookie_properties",
+ -1, -1, FALSE,
+ EPHY_STATE_WINDOW_SAVE_SIZE | EPHY_STATE_WINDOW_SAVE_POSITION);
+ gtk_dialog_set_has_separator (GTK_DIALOG(gdialog), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (gdialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (gdialog)->vbox), 2);
+
+ table = gtk_table_new (2, 4, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_widget_show (table);
+
+ str = g_strconcat ("<b>", _("Content:"), "</b>", NULL);
+ label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+ label = gtk_label_new (info->value);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
+
+ str = g_strconcat ("<b>", _("Path:"), "</b>", NULL);
+ label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+ label = gtk_label_new (info->path);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 1, 2);
+
+ str = g_strconcat ("<b>", _("Send for:"), "</b>", NULL);
+ label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+ label = gtk_label_new (info->is_secure ? _("Encrypted connections only") : _("Any type of connection") );
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 2, 3);
+
+ str = g_strconcat ("<b>", _("Expires:"), "</b>", NULL);
+ label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+ if (info->is_session)
+ {
+ str = g_strdup (_("End of current session"));
+ }
+ else
+ {
+ struct tm t;
+ char s[128];
+ const char *fmt_hack = "%c";
+ strftime (s, sizeof(s), fmt_hack, localtime_r (&info->expires, &t));
+ str = g_locale_to_utf8 (s, -1, NULL, NULL, NULL);
+ }
+ label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4);
+
+ dialog_vbox = GTK_DIALOG(gdialog)->vbox;
+ gtk_box_pack_start (GTK_BOX(dialog_vbox),
+ table,
+ FALSE, FALSE, 0);
+
+ gtk_window_group_add_window (ephy_gui_ensure_window_group (GTK_WINDOW (parent)),
+ GTK_WINDOW (gdialog));
+
+ gtk_dialog_run (GTK_DIALOG (gdialog));
+
+ gtk_widget_destroy (gdialog);
+}
+
+static void
+cookies_properties_clicked_cb (GtkWidget *button,
+ PdmDialog *dialog)
+{
+ GtkTreeModel *model;
+ GValue val = {0, };
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ EphyCookie *cookie;
+ GList *l;
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (dialog->priv->cookies->treeview);
+ l = gtk_tree_selection_get_selected_rows
+ (selection, &model);
+
+ path = (GtkTreePath *)l->data;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get_value
+ (model, &iter, COL_COOKIES_DATA, &val);
+ cookie = (EphyCookie *) g_value_get_boxed (&val);
+
+ show_cookies_properties (dialog, cookie);
+
+ g_value_unset (&val);
+
+ g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (l);
+}
+
+static void
cookies_treeview_selection_changed_cb (GtkTreeSelection *selection,
PdmDialog *dialog)
{
@@ -383,11 +522,17 @@ pdm_dialog_cookies_construct (PdmActionInfo *info)
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
+ GtkWidget *button;
LOG ("pdm_dialog_cookies_construct");
- treeview = GTK_TREE_VIEW (ephy_dialog_get_control
- (EPHY_DIALOG (dialog), properties[PROP_COOKIES_TREEVIEW].id));
+ ephy_dialog_get_controls (EPHY_DIALOG (dialog),
+ properties[PROP_COOKIES_TREEVIEW].id, &treeview,
+ properties[PROP_COOKIES_PROPERTIES].id, &button,
+ NULL);
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (cookies_properties_clicked_cb), dialog);
/* set tree model */
liststore = gtk_list_store_new (4,
@@ -624,6 +769,23 @@ pdm_dialog_cookie_remove (PdmActionInfo *info,
/* "Passwords" tab */
static void
+passwords_show_toggled_cb (GtkWidget *button,
+ PdmDialog *dialog)
+{
+ GtkTreeView *treeview;
+ GtkTreeViewColumn *column;
+ gboolean active;
+
+ treeview = GTK_TREE_VIEW (ephy_dialog_get_control
+ (EPHY_DIALOG(dialog), properties[PROP_PASSWORDS_TREEVIEW].id));
+ column = gtk_tree_view_get_column (treeview, COL_PASSWORDS_PASSWORD);
+
+ active = gtk_toggle_button_get_active ((GTK_TOGGLE_BUTTON (button)));
+
+ gtk_tree_view_column_set_visible (column, active);
+}
+
+static void
pdm_dialog_passwords_construct (PdmActionInfo *info)
{
PdmDialog *dialog = info->dialog;
@@ -632,11 +794,17 @@ pdm_dialog_passwords_construct (PdmActionInfo *info)
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
+ GtkWidget *button;
LOG ("pdm_dialog_passwords_construct");
- treeview = GTK_TREE_VIEW (ephy_dialog_get_control
- (EPHY_DIALOG(dialog), properties[PROP_PASSWORDS_TREEVIEW].id));
+ ephy_dialog_get_controls (EPHY_DIALOG (dialog),
+ properties[PROP_PASSWORDS_TREEVIEW].id, &treeview,
+ properties[PROP_PASSWORDS_SHOW].id, &button,
+ NULL);
+
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (passwords_show_toggled_cb), dialog);
/* set tree model */
liststore = gtk_list_store_new (4,
@@ -816,6 +984,23 @@ sync_notebook_tab (GtkWidget *notebook,
}
static void
+pdm_dialog_response_cb (GtkDialog *widget,
+ int response,
+ PdmDialog *dialog)
+{
+ switch (response)
+ {
+ case GTK_RESPONSE_CLOSE:
+ g_object_unref (dialog);
+ break;
+ case GTK_RESPONSE_HELP:
+ pdm_dialog_show_help (dialog);
+ break;
+ default:
+ break;
+ }
+}
+static void
pdm_dialog_init (PdmDialog *dialog)
{
PdmActionInfo *cookies, *passwords;
@@ -836,6 +1021,8 @@ pdm_dialog_init (PdmDialog *dialog)
gtk_window_set_icon_name (GTK_WINDOW (window), "web-browser");
+ g_signal_connect (window, "response",
+ G_CALLBACK (pdm_dialog_response_cb), dialog);
/**
* Group all Properties and Remove buttons in the same size group to
* avoid the little jerk you get otherwise when switching pages because
@@ -901,188 +1088,3 @@ pdm_dialog_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-
-static void
-show_cookies_properties (PdmDialog *dialog,
- EphyCookie *info)
-{
- GtkWidget *gdialog;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *parent;
- GtkWidget *dialog_vbox;
- char *str;
-
- parent = ephy_dialog_get_control (EPHY_DIALOG(dialog),
- properties[PROP_WINDOW].id);
-
- gdialog = gtk_dialog_new_with_buttons
- (_("Cookie Properties"),
- GTK_WINDOW (parent),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE, 0, NULL);
- ephy_state_add_window (GTK_WIDGET (gdialog), "cookie_properties",
- -1, -1, FALSE,
- EPHY_STATE_WINDOW_SAVE_SIZE | EPHY_STATE_WINDOW_SAVE_POSITION);
- gtk_dialog_set_has_separator (GTK_DIALOG(gdialog), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (gdialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (gdialog)->vbox), 2);
-
- table = gtk_table_new (2, 4, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), 5);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
- gtk_widget_show (table);
-
- str = g_strconcat ("<b>", _("Content:"), "</b>", NULL);
- label = gtk_label_new (str);
- g_free (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
- GTK_FILL, GTK_FILL, 0, 0);
-
- label = gtk_label_new (info->value);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
-
- str = g_strconcat ("<b>", _("Path:"), "</b>", NULL);
- label = gtk_label_new (str);
- g_free (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
- GTK_FILL, GTK_FILL, 0, 0);
-
- label = gtk_label_new (info->path);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 1, 2);
-
- str = g_strconcat ("<b>", _("Send for:"), "</b>", NULL);
- label = gtk_label_new (str);
- g_free (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
- GTK_FILL, GTK_FILL, 0, 0);
-
- label = gtk_label_new (info->is_secure ? _("Encrypted connections only") : _("Any type of connection") );
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 2, 3);
-
- str = g_strconcat ("<b>", _("Expires:"), "</b>", NULL);
- label = gtk_label_new (str);
- g_free (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
- GTK_FILL, GTK_FILL, 0, 0);
-
- if (info->is_session)
- {
- str = g_strdup (_("End of current session"));
- }
- else
- {
- struct tm t;
- char s[128];
- const char *fmt_hack = "%c";
- strftime (s, sizeof(s), fmt_hack, localtime_r (&info->expires, &t));
- str = g_locale_to_utf8 (s, -1, NULL, NULL, NULL);
- }
- label = gtk_label_new (str);
- g_free (str);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_widget_show (label);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4);
-
- dialog_vbox = GTK_DIALOG(gdialog)->vbox;
- gtk_box_pack_start (GTK_BOX(dialog_vbox),
- table,
- FALSE, FALSE, 0);
-
- gtk_window_group_add_window (ephy_gui_ensure_window_group (GTK_WINDOW (parent)),
- GTK_WINDOW (gdialog));
-
- gtk_dialog_run (GTK_DIALOG (gdialog));
-
- gtk_widget_destroy (gdialog);
-}
-
-void
-pdm_dialog_cookies_properties_button_clicked_cb (GtkWidget *button,
- PdmDialog *dialog)
-{
- GtkTreeModel *model;
- GValue val = {0, };
- GtkTreeIter iter;
- GtkTreePath *path;
- EphyCookie *cookie;
- GList *l;
- GtkTreeSelection *selection;
-
- selection = gtk_tree_view_get_selection (dialog->priv->cookies->treeview);
- l = gtk_tree_selection_get_selected_rows
- (selection, &model);
-
- path = (GtkTreePath *)l->data;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get_value
- (model, &iter, COL_COOKIES_DATA, &val);
- cookie = (EphyCookie *) g_value_get_boxed (&val);
-
- show_cookies_properties (dialog, cookie);
-
- g_value_unset (&val);
-
- g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (l);
-}
-
-void
-pdm_dialog_passwords_show_cb (GtkWidget *button,
- PdmDialog *dialog)
-{
- GtkTreeView *treeview;
- GtkTreeViewColumn *column;
- gboolean active;
-
- treeview = GTK_TREE_VIEW (ephy_dialog_get_control
- (EPHY_DIALOG(dialog), properties[PROP_PASSWORDS_TREEVIEW].id));
- column = gtk_tree_view_get_column (treeview, COL_PASSWORDS_PASSWORD);
-
- active = gtk_toggle_button_get_active ((GTK_TOGGLE_BUTTON (button)));
-
- gtk_tree_view_column_set_visible (column, active);
-}
-
-void
-pdm_dialog_response_cb (GtkDialog *widget,
- gint response,
- PdmDialog *dialog)
-{
- switch (response)
- {
- case GTK_RESPONSE_CLOSE:
- g_object_unref (dialog);
- break;
- case GTK_RESPONSE_HELP:
- pdm_dialog_show_help (dialog);
- break;
- default:
- break;
- }
-}
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);
-}