aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorMichael Meeks <michael@helixcode.com>2000-10-19 09:30:10 +0800
committerMichael Meeks <mmeeks@src.gnome.org>2000-10-19 09:30:10 +0800
commit85b15ae2a12828fdfd946133750705601ced2847 (patch)
treed935522aebf345a78f7406c472977c5c997e2103 /addressbook/gui
parent0e2492ca585ff69aae41b6b2b72a76c46daa7f47 (diff)
downloadgsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar.gz
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar.bz2
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar.lz
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar.xz
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.tar.zst
gsoc2013-evolution-85b15ae2a12828fdfd946133750705601ced2847.zip
update to new UI handler. (update_view_type): split from
2000-10-19 Michael Meeks <michael@helixcode.com> * gui/component/addressbook.c (change_view_type): update to new UI handler. (update_view_type): split from (change_view_type). (control_activate): add an update_view_type. svn path=/trunk/; revision=6011
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c98
1 files changed, 53 insertions, 45 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 51e6e297d3..b096b2bde7 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -46,8 +46,6 @@ typedef struct {
char *uri;
} AddressbookView;
-static void change_view_type (AddressbookView *view, EAddressbookViewType view_type);
-
static void
card_added_cb (EBook* book, EBookStatus status, const char *id,
gpointer user_data)
@@ -129,22 +127,6 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
gtk_object_sink(GTK_OBJECT(card));
}
-static void
-toggle_view_as_cb (BonoboUIHandler *uih, void *user_data, const char *path)
-{
- AddressbookView *view = user_data;
- EAddressbookViewType view_type;
-
- gtk_object_get(GTK_OBJECT(view),
- "type", &view_type,
- NULL);
-
- if (view_type == E_ADDRESSBOOK_VIEW_TABLE)
- change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD);
- else
- change_view_type (view, E_ADDRESSBOOK_VIEW_TABLE);
-}
-
#ifdef HAVE_LDAP
static void
null_cb (EBook *book, EBookStatus status, gpointer closure)
@@ -310,6 +292,57 @@ stop_loading_cb (BonoboUIHandler *uih, void *user_data, const char *path)
e_addressbook_view_stop(view->view);
}
+static void
+update_view_type (AddressbookView *view)
+{
+ BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control);
+ EAddressbookViewType view_type;
+
+ if (!uic || bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
+ return;
+
+ gtk_object_get (GTK_OBJECT (view->view), "type", &view_type, NULL);
+
+ switch (view_type) {
+ case E_ADDRESSBOOK_VIEW_TABLE:
+ if (uic)
+ bonobo_ui_component_set_prop (uic, "/menu/View/AsTable",
+ "label", N_("As _Minicards"), NULL);
+
+ break;
+ case E_ADDRESSBOOK_VIEW_MINICARD:
+ if (uic)
+ bonobo_ui_component_set_prop (uic, "/menu/View/AsTable",
+ "label", N_("As _Table"), NULL);
+ break;
+ default:
+ g_warning ("view_type must be either TABLE or MINICARD\n");
+ return;
+ }
+}
+
+static void
+change_view_type (AddressbookView *view, EAddressbookViewType view_type)
+{
+ gtk_object_set (GTK_OBJECT (view->view), "type", view_type, NULL);
+
+ update_view_type (view);
+}
+
+static void
+toggle_view_as_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ AddressbookView *view = user_data;
+ EAddressbookViewType view_type;
+
+ gtk_object_get (GTK_OBJECT (view->view), "type", &view_type, NULL);
+
+ if (view_type == E_ADDRESSBOOK_VIEW_TABLE)
+ change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD);
+ else
+ change_view_type (view, E_ADDRESSBOOK_VIEW_TABLE);
+}
+
BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
BONOBO_UI_UNSAFE_VERB ("ViewAsTable", toggle_view_as_cb),
@@ -366,6 +399,8 @@ control_activate (BonoboControl *control,
bonobo_object_corba_objref (BONOBO_OBJECT (search_control)),
NULL);
+ update_view_type (view);
+
bonobo_ui_component_thaw (uic, NULL);
}
@@ -515,33 +550,6 @@ set_prop (BonoboPropertyBag *bag,
}
}
-static void
-change_view_type (AddressbookView *view, EAddressbookViewType view_type)
-{
- BonoboUIHandler *uih = bonobo_control_get_ui_handler (view->control);
-
- gtk_object_set(GTK_OBJECT(view->view),
- "type", view_type,
- NULL);
-
- switch (view_type) {
- case E_ADDRESSBOOK_VIEW_TABLE:
- if (uih)
- bonobo_ui_handler_menu_set_label (uih, "/View/Toggle View",
- N_("As _Minicards"));
- break;
- case E_ADDRESSBOOK_VIEW_MINICARD:
- if (uih)
- bonobo_ui_handler_menu_set_label (uih, "/View/Toggle View",
- N_("As _Table"));
- break;
- default:
- g_warning ("view_type must be either TABLE or MINICARD\n");
- return;
- }
-}
-
-
BonoboControl *
addressbook_factory_new_control (void)
{