Replace activity_client with activity_id. (set_status_message): Use the

* gui/component/addressbook.c (struct AddressbookView): Replace
activity_client with activity_id.
(set_status_message): Use the EActivityHandler from the
AddressbookComponent.

* gui/component/addressbook-component.c (struct
_AddressbookComponentPrivate): New member activity_handler.
(addressbook_component_init): Init.
(impl_dispose): Unref.
(addressbook_component_peek_activity_handler): New.
(impl_createControls): Return an ETaskBar as the statusbar control
and attach it to the activity handler.

svn path=/trunk/; revision=23560
This commit is contained in:
Ettore Perazzoli
2003-12-02 04:53:57 +00:00
parent d904b8e0d8
commit 215a9c0ea3
4 changed files with 62 additions and 29 deletions

View File

@ -1,3 +1,18 @@
2003-12-01 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook.c (struct AddressbookView): Replace
activity_client with activity_id.
(set_status_message): Use the EActivityHandler from the
AddressbookComponent.
* gui/component/addressbook-component.c (struct
_AddressbookComponentPrivate): New member activity_handler.
(addressbook_component_init): Init.
(impl_dispose): Unref.
(addressbook_component_peek_activity_handler): New.
(impl_createControls): Return an ETaskBar as the statusbar control
and attach it to the activity handler.
2003-12-01 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c (impl_createControls):

View File

@ -33,6 +33,8 @@
#include "widgets/misc/e-source-selector.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
#include "e-task-bar.h"
#include <string.h>
#include <bonobo/bonobo-i18n.h>
#include <gtk/gtkscrolledwindow.h>
@ -53,6 +55,8 @@ struct _AddressbookComponentPrivate {
GConfClient *gconf_client;
ESourceList *source_list;
GtkWidget *source_selector;
EActivityHandler *activity_handler;
};
@ -156,8 +160,10 @@ impl_createControls (PortableServer_Servant servant,
AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
GtkWidget *selector;
GtkWidget *selector_scrolled_window;
GtkWidget *statusbar_widget;
BonoboControl *sidebar_control;
BonoboControl *view_control;
BonoboControl *statusbar_control;
selector = e_source_selector_new (addressbook_component->priv->source_list);
e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE);
@ -183,18 +189,16 @@ impl_createControls (PortableServer_Servant servant,
G_OBJECT (addressbook_component), 0);
load_uri_for_selection (E_SOURCE_SELECTOR (selector), view_control);
statusbar_widget = e_task_bar_new ();
gtk_widget_show (statusbar_widget);
statusbar_control = bonobo_control_new (statusbar_widget);
e_activity_handler_attach_task_bar (addressbook_component->priv->activity_handler,
E_TASK_BAR (statusbar_widget));
*corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev);
*corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev);
/* FIXME temporary for testing. */
{
GtkWidget *label = gtk_label_new ("Hey hey this is the addressbook");
BonoboControl *control;
gtk_widget_show (label);
control = bonobo_control_new (label);
*corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (control), ev);
}
*corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev);
}
static GNOME_Evolution_CreatableItemTypeList *
@ -300,6 +304,11 @@ impl_dispose (GObject *object)
priv->gconf_client = NULL;
}
if (priv->activity_handler != NULL) {
g_object_unref (priv->activity_handler);
priv->activity_handler = NULL;
}
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
@ -347,6 +356,8 @@ addressbook_component_init (AddressbookComponent *component)
priv->source_list = e_source_list_new_for_gconf (priv->gconf_client,
"/apps/evolution/addressbook/sources");
priv->activity_handler = e_activity_handler_new ();
/* Create default addressbooks if there are no groups */
groups = e_source_list_peek_groups (priv->source_list);
if (!groups) {
@ -407,4 +418,14 @@ addressbook_component_peek (void)
return component;
}
EActivityHandler *
addressbook_component_peek_activity_handler (AddressbookComponent *component)
{
g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL);
return component->priv->activity_handler;
}
BONOBO_TYPE_FUNC_FULL (AddressbookComponent, GNOME_Evolution_Component, PARENT_TYPE, addressbook_component)

View File

@ -26,6 +26,7 @@
#include <bonobo/bonobo-object.h>
#include "Evolution.h"
#include "e-activity-handler.h"
#define ADDRESSBOOK_TYPE_COMPONENT (addressbook_component_get_type ())
#define ADDRESSBOOK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADDRESSBOOK_TYPE_COMPONENT, AddressbookComponent))
@ -55,5 +56,7 @@ GType addressbook_component_get_type (void);
AddressbookComponent *addressbook_component_peek (void);
EActivityHandler *addressbook_component_peek_activity_handler (AddressbookComponent *component);
#endif /* _ADDRESSBOOK_COMPONENT_H_ */

View File

@ -42,7 +42,7 @@
#include "e-util/e-passwords.h"
#include "evolution-shell-component-utils.h"
#include "evolution-activity-client.h"
#include "e-activity-handler.h"
#include "e-contact-editor.h"
#include "addressbook-config.h"
#include "addressbook.h"
@ -59,7 +59,7 @@
/* This is used for the addressbook status bar */
#define EVOLUTION_CONTACTS_PROGRESS_IMAGE "evolution-contacts-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
static GdkPixbuf *progress_icon = NULL;
#define d(x)
@ -74,7 +74,7 @@ typedef struct {
gint ecml_changed_id;
GtkWidget *vbox;
EBook *book;
EvolutionActivityClient *activity;
guint activity_id;
BonoboControl *control;
BonoboPropertyBag *properties;
GConfClient *gconf_client;
@ -913,29 +913,23 @@ retrieve_shell_view_interface_from_control (BonoboControl *control)
static void
set_status_message (EABView *eav, const char *message, AddressbookView *view)
{
EActivityHandler *activity_handler = addressbook_component_peek_activity_handler (addressbook_component_peek ());
if (!message || !*message) {
if (view->activity) {
g_object_unref (view->activity);
view->activity = NULL;
}
}
#if 0 /* EPFIXME */
else if (!view->activity) {
int display;
if (view->activity_id != 0)
view->activity_id = 0;
} else if (view->activity_id == 0) {
char *clientid = g_strdup_printf ("%p", view);
if (progress_icon[0] == NULL)
progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CONTACTS_PROGRESS_IMAGE, NULL);
if (progress_icon == NULL)
progress_icon = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CONTACTS_PROGRESS_IMAGE, NULL);
view->activity = evolution_activity_client_new (addressbook_component_get_shell_client(), clientid,
progress_icon, message, TRUE, &display);
view->activity_id = e_activity_handler_operation_started (activity_handler, clientid,
progress_icon, message, TRUE);
g_free (clientid);
}
#endif
else {
evolution_activity_client_update (view->activity, message, -1.0);
} else {
e_activity_handler_operation_progressing (activity_handler, view->activity_id, message, -1.0);
}
}