aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook-config.c
diff options
context:
space:
mode:
authorRodney Dawes <dobey@novell.com>2004-06-02 21:02:09 +0800
committerRodney Dawes <dobey@src.gnome.org>2004-06-02 21:02:09 +0800
commit81a9c1e88d1c08fd59c6492686b45d53919a99b6 (patch)
tree4c343f83d6d8ecae0f9c0d7d6fdd5f63462e72d0 /addressbook/gui/component/addressbook-config.c
parentdb1a6f1329c552b0370d295263fe9dbe552dd1a2 (diff)
downloadgsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar.gz
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar.bz2
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar.lz
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar.xz
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.tar.zst
gsoc2013-evolution-81a9c1e88d1c08fd59c6492686b45d53919a99b6.zip
Don't need these two functions any more (source_to_dialog,
2004-06-02 Rodney Dawes <dobey@novell.com> * gui/component/addressbook-config.c (focus_help, add_focus_handler): Don't need these two functions any more (source_to_dialog, auth_optionmenu_func): Don't try to change the notebook page or set the widget sensitive, for a notebook that doesn't exist any more (reparent_to_vbox): Don't need this function any more, as the widgets are all contained in the same dialog in the glade now (setup_general_tab, setup_connecting_tab, setup_searching_tab): We don't need to do the focus-based "tooltip" stuff any more We just use tooltips on the widgets now (ssl_optionmenu_selected, add_ssl_activate_cb): We don't need the ssl_optionmenu_selected callback any more, as the tooltips are just set on the necessary widgets now (query_for_supported_bases): Set the border widths on the dialog's vbox and action_area to be compliant with the HIG (addressbook_add_server_dialog): Unref the GConfClient object (addressbook_config_edit_source): Create the source_list so that we can actually save the changes that we make here Create the GladeXML with only the widget subtree that we need to use here, to avoid popping up other visible dialogs Set the border widths on the dialog's vbox and action_area to be compliant with the HIG We don't need to reparent widgets to vboxes any more, as the widgets are now part of the dialog's widget tree If we are without LDAP or not in LDAP mode, then hide the notebook borders, and change the border size of its child to appear as though we are a normal non-LDAP dialog We don't need to set the type hint on the window as we are no a real GtkDialog * gui/component/ldap-config.glade: Update the properties dialogs to be compliant with the HIG layout Get rid of some of the extra windows and put their children in the appropriate places in the properties dialog Make the properties dialog be a real GtkDialog Fixes #41141 svn path=/trunk/; revision=26153
Diffstat (limited to 'addressbook/gui/component/addressbook-config.c')
-rw-r--r--addressbook/gui/component/addressbook-config.c123
1 files changed, 24 insertions, 99 deletions
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index 0f24f168ea..76c82bec34 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -66,27 +66,6 @@ typedef struct {
int page_num;
} FocusHelpClosure;
-static void
-focus_help (GtkWidget *w, GdkEventFocus *event, FocusHelpClosure *closure)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK(closure->notebook), closure->page_num);
-}
-
-static void
-add_focus_handler (GtkWidget *widget, GtkWidget *notebook, int page_num)
-{
- FocusHelpClosure *focus_closure = g_new0 (FocusHelpClosure, 1);
- focus_closure->notebook = notebook;
- focus_closure->page_num = page_num;
-
- g_signal_connect_data (G_OBJECT (widget),
- "focus_in_event" /* XXX */,
- G_CALLBACK (focus_help),
- focus_closure,
- (GClosureNotify) g_free,
- (GConnectFlags)0);
-}
-
typedef struct _AddressbookSourceDialog AddressbookSourceDialog;
typedef void (*ModifyFunc)(GtkWidget *item, AddressbookSourceDialog *dialog);
@@ -451,10 +430,8 @@ source_to_dialog (AddressbookSourceDialog *dialog)
gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth);
if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1);
gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1);
}
- gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope);
@@ -547,18 +524,6 @@ addressbook_add_server_dialog_cancel (GtkWidget *widget, AddressbookSourceDialog
}
static void
-reparent_to_vbox (AddressbookSourceDialog *dialog, char *vbox_name, char *widget_name)
-{
- GtkWidget *vbox, *widget;
-
- vbox = glade_xml_get_widget (dialog->gui, vbox_name);
- widget = glade_xml_get_widget (dialog->gui, widget_name);
-
- gtk_widget_reparent (widget, vbox);
- gtk_box_set_child_packing (GTK_BOX (vbox), widget, TRUE, TRUE, 0, GTK_PACK_START);
-}
-
-static void
auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
{
dialog->auth = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)),
@@ -567,13 +532,10 @@ auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
dialog->general_modify_func (item, dialog);
if (dialog->auth == 0) {
- gtk_widget_set_sensitive (dialog->auth_label_notebook, FALSE);
gtk_widget_set_sensitive (dialog->auth_entry_notebook, FALSE);
}
else {
- gtk_widget_set_sensitive (dialog->auth_label_notebook, TRUE);
gtk_widget_set_sensitive (dialog->auth_entry_notebook, TRUE);
- gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1);
gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1);
}
}
@@ -588,43 +550,27 @@ add_auth_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
static void
setup_general_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func)
{
- GtkWidget *general_tab_help;
GtkWidget *menu;
- general_tab_help = glade_xml_get_widget (dialog->gui, "general-tab-help");
-
dialog->general_modify_func = modify_func;
dialog->host = glade_xml_get_widget (dialog->gui, "server-name-entry");
g_signal_connect (dialog->host, "changed",
G_CALLBACK (modify_func), dialog);
- if (general_tab_help)
- add_focus_handler (dialog->host, general_tab_help, 0);
-
- dialog->auth_label_notebook = glade_xml_get_widget (dialog->gui, "auth-label-notebook");
dialog->auth_entry_notebook = glade_xml_get_widget (dialog->gui, "auth-entry-notebook");
dialog->email = glade_xml_get_widget (dialog->gui, "email-entry");
g_signal_connect (dialog->email, "changed",
G_CALLBACK (modify_func), dialog);
- if (general_tab_help)
- add_focus_handler (dialog->email, general_tab_help, 1);
-
dialog->binddn = glade_xml_get_widget (dialog->gui, "dn-entry");
if (dialog->binddn)
g_signal_connect (dialog->binddn, "changed",
G_CALLBACK (modify_func), dialog);
- if (general_tab_help)
- add_focus_handler (dialog->binddn, general_tab_help, 2);
-
dialog->auth_optionmenu = glade_xml_get_widget (dialog->gui, "auth-optionmenu");
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->auth_optionmenu));
gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_auth_activate_cb, dialog);
-
- if (general_tab_help)
- add_focus_handler (dialog->auth_optionmenu, general_tab_help, 3);
}
static gboolean
@@ -667,24 +613,10 @@ ssl_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
}
static void
-ssl_optionmenu_selected (GtkWidget *item, AddressbookSourceDialog *dialog)
-{
- GtkWidget *connecting_tab_help;
- int ssl_type = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)),
- item);
-
- connecting_tab_help = glade_xml_get_widget (dialog->gui, "connecting-tab-help");
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK(connecting_tab_help), ssl_type + 1);
-}
-
-static void
add_ssl_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
{
g_signal_connect (item, "activate",
G_CALLBACK (ssl_optionmenu_activated), dialog);
- g_signal_connect (item, "select",
- G_CALLBACK (ssl_optionmenu_selected), dialog);
}
static void
@@ -713,19 +645,11 @@ static void
setup_connecting_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func)
{
GtkWidget *menu;
- GtkWidget *connecting_tab_help;
dialog->connecting_modify_func = modify_func;
- connecting_tab_help = glade_xml_get_widget (dialog->gui, "connecting-tab-help");
-
dialog->port_combo = glade_xml_get_widget (dialog->gui, "port-combo");
- if (connecting_tab_help) {
- add_focus_handler (dialog->port_combo, connecting_tab_help, 0);
- add_focus_handler (GTK_COMBO(dialog->port_combo)->entry, connecting_tab_help, 0);
- }
-
g_signal_connect (GTK_COMBO(dialog->port_combo)->entry, "changed",
G_CALLBACK (modify_func), dialog);
g_signal_connect (GTK_COMBO(dialog->port_combo)->entry, "changed",
@@ -852,6 +776,10 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "supported-bases-dialog", NULL);
dialog = glade_xml_get_widget (gui, "supported-bases-dialog");
+ gtk_widget_realize (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
+
supported_bases_table = glade_xml_get_widget (gui, "supported-bases-table");
gtk_widget_show (supported_bases_table);
selection_model = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(supported_bases_table)));
@@ -910,15 +838,11 @@ setup_searching_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func)
{
GtkWidget *menu;
GtkWidget *rootdn_button;
- GtkWidget *searching_tab_help;
dialog->searching_modify_func = modify_func;
- searching_tab_help = glade_xml_get_widget (dialog->gui, "searching-tab-help");
dialog->rootdn = glade_xml_get_widget (dialog->gui, "rootdn-entry");
- if (searching_tab_help)
- add_focus_handler (dialog->rootdn, searching_tab_help, 0);
if (modify_func)
g_signal_connect (dialog->rootdn, "changed",
@@ -926,17 +850,11 @@ setup_searching_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func)
dialog->scope_optionmenu = glade_xml_get_widget (dialog->gui, "scope-optionmenu");
- if (searching_tab_help)
- add_focus_handler (dialog->scope_optionmenu, searching_tab_help, 1);
-
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu));
gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_scope_activate_cb, dialog);
dialog->timeout_scale = glade_xml_get_widget (dialog->gui, "timeout-scale");
- if (searching_tab_help)
- add_focus_handler (dialog->timeout_scale, searching_tab_help, 2);
-
if (modify_func)
g_signal_connect (GTK_RANGE(dialog->timeout_scale)->adjustment,
"value_changed",
@@ -1121,6 +1039,8 @@ addressbook_add_server_dialog (void)
g_object_weak_ref (G_OBJECT (sdialog->window),
addressbook_source_dialog_destroy, sdialog);
+ g_object_unref (gconf_client);
+
/* make sure we fill in the default values */
source_to_dialog_new (sdialog);
@@ -1336,10 +1256,17 @@ void
addressbook_config_edit_source (GtkWidget *parent, ESource *source)
{
AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
- GtkWidget *general_tab_help;
+ GConfClient *gconf_client;
- sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
+ gconf_client = gconf_client_get_default ();
+ sdialog->source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources");
+ g_object_unref (gconf_client);
+
+ sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "account-editor-window", NULL);
sdialog->window = glade_xml_get_widget (sdialog->gui, "account-editor-window");
+ gtk_widget_realize (sdialog->window);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (sdialog->window)->vbox), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (sdialog->window)->action_area), 12);
sdialog->source = source;
sdialog->source_group = e_source_peek_group (source);
@@ -1350,17 +1277,10 @@ addressbook_config_edit_source (GtkWidget *parent, ESource *source)
#ifdef HAVE_LDAP
- /* general tab */
- general_tab_help = glade_xml_get_widget (sdialog->gui, "general-tab-help");
- reparent_to_vbox (sdialog, "account-editor-general-ldap-vbox", "general-tab");
setup_general_tab (sdialog, editor_modify_cb);
- /* connecting tab */
- reparent_to_vbox (sdialog, "account-editor-connecting-vbox", "connecting-tab");
setup_connecting_tab (sdialog, editor_modify_cb);
- /* searching tab */
- reparent_to_vbox (sdialog, "account-editor-searching-vbox", "searching-tab");
setup_searching_tab (sdialog, editor_modify_cb);
#endif
@@ -1372,16 +1292,22 @@ addressbook_config_edit_source (GtkWidget *parent, ESource *source)
#ifdef HAVE_LDAP
if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) {
- gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox"));
gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox"));
gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox"));
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (sdialog->notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (sdialog->notebook), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (glade_xml_get_widget (sdialog->gui, "account-editor-general-vbox")), 0);
+ gtk_window_set_default_size (GTK_WINDOW (sdialog->window), 332, 124);
} else {
- add_focus_handler (sdialog->display_name, general_tab_help, 4);
+ gtk_widget_show (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox"));
+ gtk_widget_show (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox"));
}
#else
- gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox"));
gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox"));
gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox"));
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (sdialog->notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (sdialog->notebook), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (glade_xml_get_widget (sdialog->gui, "account-editor-general-vbox")), 0);
#endif
source_to_dialog (sdialog);
@@ -1397,7 +1323,6 @@ addressbook_config_edit_source (GtkWidget *parent, ESource *source)
gtk_widget_set_sensitive (sdialog->ok_button, FALSE);
- gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
gtk_widget_show (sdialog->window);