diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | embed/downloader-view.c | 11 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 25 | ||||
-rw-r--r-- | lib/ephy-dialog.h | 4 | ||||
-rwxr-xr-x | src/pdm-dialog.c | 20 | ||||
-rw-r--r-- | src/prefs-dialog.c | 62 |
6 files changed, 97 insertions, 41 deletions
@@ -1,3 +1,19 @@ +2004-10-22 Christian Persch <chpe@cvs.gnome.org> + + * lib/ephy-dialog.c: (ephy_dialog_get_controls): + * lib/ephy-dialog.h: + + Add varargs version of ephy_dialog_get_control to get more + than one control at a time. + + * embed/downloader-view.c: (downloader_view_build_ui): + * src/pdm-dialog.c: (pdm_dialog_show_help), (pdm_dialog_init): + * src/prefs-dialog.c: (prefs_dialog_show_help), + (setup_add_language_dialog), (create_language_section), + (prefs_dialog_init): + + Use that. + 2004-10-21 Jordi Mallach <jordi@sindominio.net> * doc/Makefile.am: diff --git a/embed/downloader-view.c b/embed/downloader-view.c index 4b1023d00..56abd15c6 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -568,10 +568,13 @@ downloader_view_build_ui (DownloaderView *dv) NULL); /* lookup needed widgets */ - priv->window = ephy_dialog_get_control(d, properties[PROP_WINDOW].id); - priv->treeview = ephy_dialog_get_control (d, properties[PROP_TREEVIEW].id); - priv->pause_button = ephy_dialog_get_control (d, properties[PROP_PAUSE_BUTTON].id); - priv->abort_button = ephy_dialog_get_control (d, properties[PROP_ABORT_BUTTON].id); + ephy_dialog_get_controls + (d, + properties[PROP_WINDOW].id, &priv->window, + properties[PROP_TREEVIEW].id, &priv->treeview, + properties[PROP_PAUSE_BUTTON].id, &priv->pause_button, + properties[PROP_ABORT_BUTTON].id, &priv->abort_button, + NULL); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)), GTK_SELECTION_BROWSE); diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 09ead6a75..234680c4b 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -1228,6 +1228,31 @@ ephy_dialog_get_control (EphyDialog *dialog, return info->widget; } +void +ephy_dialog_get_controls (EphyDialog *dialog, + const char *property_id, + ...) +{ + PropertyInfo *info; + GtkWidget **wptr; + va_list varargs; + + va_start (varargs, property_id); + + while (property_id != NULL) + { + info = lookup_info (dialog, property_id); + g_return_if_fail (info != NULL); + + wptr = va_arg (varargs, GtkWidget **); + *wptr = info->widget; + + property_id = va_arg (varargs, const char *); + } + + va_end (varargs); +} + gboolean ephy_dialog_get_value (EphyDialog *dialog, const char *property_id, diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h index cb9d88c9e..9cf7aebf7 100644 --- a/lib/ephy-dialog.h +++ b/lib/ephy-dialog.h @@ -121,6 +121,10 @@ void ephy_dialog_set_modal (EphyDialog *dialog, GtkWidget *ephy_dialog_get_control (EphyDialog *dialog, const char *property_id); +void ephy_dialog_get_controls (EphyDialog *dialog, + const char *first_property_id, + ...); + gboolean ephy_dialog_get_value (EphyDialog *dialog, const char *property_id, GValue *value); diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 89876bf9b..7a45aabbe 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -191,14 +191,14 @@ pdm_dialog_show_help (PdmDialog *pd) "managing-passwords" }; - window = ephy_dialog_get_control (EPHY_DIALOG (pd), properties[PROP_WINDOW].id); - g_return_if_fail (GTK_IS_WINDOW (window)); - - notebook = ephy_dialog_get_control (EPHY_DIALOG (pd), properties[PROP_NOTEBOOK].id); - g_return_if_fail (notebook != NULL); + ephy_dialog_get_controls + (EPHY_DIALOG (pd), + properties[PROP_WINDOW].id, &window, + properties[PROP_NOTEBOOK].id, ¬ebook, + NULL); id = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); - g_assert (id == 0 || id == 1); + g_return_if_fail (id == 0 || id == 1); ephy_gui_help (GTK_WINDOW (window), "epiphany", help_preferences[id]); } @@ -816,8 +816,11 @@ pdm_dialog_init (PdmDialog *dialog) "pdm_dialog", NULL); - window = ephy_dialog_get_control (EPHY_DIALOG (dialog), - properties[PROP_WINDOW].id); + ephy_dialog_get_controls (EPHY_DIALOG (dialog), + properties[PROP_WINDOW].id, &window, + properties[PROP_NOTEBOOK].id, ¬ebook, + NULL); + gtk_window_set_icon_name (GTK_WINDOW (window), "web-browser"); /** @@ -861,7 +864,6 @@ pdm_dialog_init (PdmDialog *dialog) cookies->construct (cookies); passwords->construct (passwords); - notebook = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[PROP_NOTEBOOK].id); sync_notebook_tab (notebook, NULL, 0, dialog); g_signal_connect (G_OBJECT (notebook), "switch_page", G_CALLBACK (sync_notebook_tab), dialog); diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index b2529eb62..e5e8004e0 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -416,8 +416,10 @@ prefs_dialog_show_help (EphyDialog *dialog) "language-preferences" }; - window = ephy_dialog_get_control (dialog, properties[WINDOW_PROP].id); - notebook = ephy_dialog_get_control (dialog, properties[NOTEBOOK_PROP].id); + ephy_dialog_get_controls (dialog, + properties[WINDOW_PROP].id, &window, + properties[NOTEBOOK_PROP].id, ¬ebook, + NULL); id = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); id = CLAMP (id, 0, 3); @@ -821,8 +823,10 @@ setup_add_language_dialog (PrefsDialog *pd) gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sortmodel), COL_LANG_NAME, GTK_SORT_ASCENDING); - treeview = GTK_TREE_VIEW (ephy_dialog_get_control - (dialog, add_lang_props[LANGUAGE_PROP].id)); + ephy_dialog_get_controls (dialog, + add_lang_props[LANGUAGE_PROP].id, &treeview, + add_lang_props[LANGUAGE_DIALOG].id, &window, + NULL); gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), FALSE); @@ -844,7 +848,6 @@ setup_add_language_dialog (PrefsDialog *pd) selection = gtk_tree_view_get_selection (treeview); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - window = ephy_dialog_get_control (dialog, add_lang_props[LANGUAGE_DIALOG].id); g_signal_connect (window, "response", G_CALLBACK (add_lang_dialog_response_cb), pd); @@ -977,9 +980,16 @@ create_language_section (EphyDialog *dialog) GtkTreeSelection *selection; GSList *list, *l, *ulist = NULL; + ephy_dialog_get_controls + (dialog, + properties[LANGUAGE_TREEVIEW_PROP].id, &treeview, + properties[LANGUAGE_ADD_BUTTON_PROP].id, &pd->priv->lang_add_button, + properties[LANGUAGE_REMOVE_BUTTON_PROP].id, &pd->priv->lang_remove_button, + properties[LANGUAGE_UP_BUTTON_PROP].id, &pd->priv->lang_up_button, + properties[LANGUAGE_DOWN_BUTTON_PROP].id, &pd->priv->lang_down_button, + NULL); + /* setup the languages treeview */ - treeview = GTK_TREE_VIEW (ephy_dialog_get_control - (dialog, properties[LANGUAGE_TREEVIEW_PROP].id)); pd->priv->lang_treeview = treeview; gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE); @@ -1013,15 +1023,6 @@ create_language_section (EphyDialog *dialog) g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (language_editor_selection_changed_cb), pd); - pd->priv->lang_add_button = ephy_dialog_get_control - (dialog, properties[LANGUAGE_ADD_BUTTON_PROP].id); - pd->priv->lang_remove_button = ephy_dialog_get_control - (dialog, properties[LANGUAGE_REMOVE_BUTTON_PROP].id); - pd->priv->lang_up_button = ephy_dialog_get_control - (dialog, properties[LANGUAGE_UP_BUTTON_PROP].id); - pd->priv->lang_down_button = ephy_dialog_get_control - (dialog, properties[LANGUAGE_DOWN_BUTTON_PROP].id); - list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE); /* uniquify list */ @@ -1151,7 +1152,8 @@ prefs_dialog_init (PrefsDialog *pd) { EphyDialog *dialog = EPHY_DIALOG (pd); EphyEncodings *encodings; - GtkWidget *window, *button, *combo; + GtkWidget *window, *curr_button, *blank_button; + GtkWidget *variable_combo, *monospace_combo; GtkCellRenderer *renderer; gboolean sensitive; @@ -1171,27 +1173,31 @@ prefs_dialog_init (PrefsDialog *pd) properties[AUTO_ENCODING_LABEL_PROP].id, NULL); - window = ephy_dialog_get_control (dialog, properties[WINDOW_PROP].id); + ephy_dialog_get_controls + (dialog, + properties[WINDOW_PROP].id, &window, + properties[HOMEPAGE_CURRENT_PROP].id, &curr_button, + properties[HOMEPAGE_BLANK_PROP].id, &blank_button, + properties[VARIABLE_PROP].id, &variable_combo, + properties[MONOSPACE_PROP].id, &monospace_combo, + NULL); + gtk_window_set_icon_name (GTK_WINDOW (window), GTK_STOCK_PREFERENCES); /* set homepage button sensitivity */ sensitive = eel_gconf_key_is_writable (CONF_GENERAL_HOMEPAGE); - button = ephy_dialog_get_control (dialog, properties[HOMEPAGE_CURRENT_PROP].id); - gtk_widget_set_sensitive (button, sensitive); - button = ephy_dialog_get_control (dialog, properties[HOMEPAGE_BLANK_PROP].id); - gtk_widget_set_sensitive (button, sensitive); + gtk_widget_set_sensitive (curr_button, sensitive); + gtk_widget_set_sensitive (blank_button, sensitive); - combo = ephy_dialog_get_control (dialog, properties[VARIABLE_PROP].id); renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (variable_combo), renderer, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (variable_combo), renderer, "text", 0, NULL); ephy_dialog_set_data_column (dialog, properties[VARIABLE_PROP].id, 0); - combo = ephy_dialog_get_control (dialog, properties[MONOSPACE_PROP].id); renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (monospace_combo), renderer, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (monospace_combo), renderer, "text", 0, NULL); ephy_dialog_set_data_column (dialog, properties[MONOSPACE_PROP].id, 0); |