diff options
author | Dan Winship <danw@src.gnome.org> | 2004-02-04 01:33:26 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2004-02-04 01:33:26 +0800 |
commit | ed8f202a40d86bbd2e46c1404ad4eec880c4604e (patch) | |
tree | 9d1cadc7ee1341172022be73320c272f3515f1c0 /shell | |
parent | 42f36a871ae1d6e0b1b27b1ed07e21cd32a2f533 (diff) | |
download | gsoc2013-evolution-ed8f202a40d86bbd2e46c1404ad4eec880c4604e.tar.gz gsoc2013-evolution-ed8f202a40d86bbd2e46c1404ad4eec880c4604e.tar.zst gsoc2013-evolution-ed8f202a40d86bbd2e46c1404ad4eec880c4604e.zip |
Moved to misc/widgets since they depend on libemiscwidgets now, and aren't
* e-activity-handler.c:
* e-activity-handler.h:
* e-task-bar.c:
* e-task-bar.h:
* e-task-widget.c:
* e-task-widget.h: Moved to misc/widgets since they depend on
libemiscwidgets now, and aren't actually used by the shell itself.
* Makefile.am (eshell_HEADERS, libeshell_la_SOURCES): Update
svn path=/trunk/; revision=24590
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 12 | ||||
-rw-r--r-- | shell/Makefile.am | 6 | ||||
-rw-r--r-- | shell/e-activity-handler.c | 420 | ||||
-rw-r--r-- | shell/e-activity-handler.h | 90 | ||||
-rw-r--r-- | shell/e-task-bar.c | 232 | ||||
-rw-r--r-- | shell/e-task-bar.h | 77 | ||||
-rw-r--r-- | shell/e-task-widget.c | 251 | ||||
-rw-r--r-- | shell/e-task-widget.h | 78 |
8 files changed, 12 insertions, 1154 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 8c66c2c48e..f9051b87cd 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,15 @@ +2004-02-03 Dan Winship <danw@ximian.com> + + * e-activity-handler.c: + * e-activity-handler.h: + * e-task-bar.c: + * e-task-bar.h: + * e-task-widget.c: + * e-task-widget.h: Moved to misc/widgets since they depend on + libemiscwidgets now, and aren't actually used by the shell itself. + + * Makefile.am (eshell_HEADERS, libeshell_la_SOURCES): Update + 2004-02-02 Chris Toshok <toshok@ximian.com> * e-component-registry.c (component_info_new): don't generate a diff --git a/shell/Makefile.am b/shell/Makefile.am index 0150b27d93..fc53ea164f 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -101,12 +101,9 @@ eshellincludedir = $(privincludedir)/shell eshellinclude_HEADERS = \ Evolution.h \ - e-activity-handler.h \ e-icon-factory.h \ e-shell-corba-icon-utils.h \ e-shell-utils.h \ - e-task-bar.h \ - e-task-widget.h \ evolution-config-control.h \ evolution-shell-component-utils.h \ evolution-wizard.h @@ -114,15 +111,12 @@ eshellinclude_HEADERS = \ libeshell_la_SOURCES = \ $(IDL_GENERATED) \ $(MARSHAL_GENERATED) \ - e-activity-handler.c \ e-icon-factory.c \ e-shell-corba-icon-utils.c \ e-shell-utils.c \ evolution-config-control.c \ evolution-shell-component-utils.c \ evolution-wizard.c \ - e-task-bar.c \ - e-task-widget.c \ $(eshellinclude_HEADERS) libeshell_la_LIBADD = \ diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c deleted file mode 100644 index d64bcd8f6e..0000000000 --- a/shell/e-activity-handler.c +++ /dev/null @@ -1,420 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-activity-handler.c - * - * Copyright (C) 2001, 2002, 2003 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-activity-handler.h" - -#include <gtk/gtksignal.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-popup-menu.h> - -#include <gal/util/e-util.h> -#include <gal/widgets/e-popup-menu.h> - - -#define PARENT_TYPE G_TYPE_OBJECT -static GObjectClass *parent_class = NULL; - - -#define ICON_SIZE 16 - - -struct _ActivityInfo { - char *component_id; - GdkPixbuf *icon_pixbuf; - guint id; - char *information; - gboolean cancellable; - double progress; - GtkWidget *menu; -}; -typedef struct _ActivityInfo ActivityInfo; - -struct _EActivityHandlerPrivate { - uint next_activity_id; - GList *activity_infos; - GSList *task_bars; -}; - - -/* Utility functions. */ - -static unsigned int -get_new_activity_id (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - - priv = activity_handler->priv; - - return priv->next_activity_id ++; -} - -static GList * -lookup_activity (GList *list, - guint activity_id, - int *order_number_return) -{ - GList *p; - int i; - - for (p = list, i = 0; p != NULL; p = p->next, i ++) { - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) p->data; - if (activity_info->id == activity_id) { - *order_number_return = i; - return p; - } - } - - *order_number_return = -1; - return NULL; -} - - -/* ETaskWidget actions. */ - -static int -task_widget_button_press_event_callback (GtkWidget *widget, - GdkEventButton *button_event, - void *data) -{ - ActivityInfo *activity_info; - - activity_info = (ActivityInfo *) data; - - if (button_event->button == 3) - return activity_info->cancellable; - - if (button_event->button != 1) - return FALSE; - - return TRUE; -} - - -/* Creating and destroying ActivityInfos. */ - -static ActivityInfo * -activity_info_new (const char *component_id, - guint id, - GdkPixbuf *icon, - const char *information, - gboolean cancellable) -{ - ActivityInfo *info; - - info = g_new (ActivityInfo, 1); - info->component_id = g_strdup (component_id); - info->id = id; - info->icon_pixbuf = g_object_ref (icon); - info->information = g_strdup (information); - info->cancellable = cancellable; - info->progress = -1.0; /* (Unknown) */ - info->menu = NULL; - - return info; -} - -static void -activity_info_free (ActivityInfo *info) -{ - g_free (info->component_id); - - g_object_unref (info->icon_pixbuf); - g_free (info->information); - - if (info->menu != NULL) - gtk_widget_destroy (info->menu); - - g_free (info); -} - -static ETaskWidget * -task_widget_new_from_activity_info (ActivityInfo *activity_info) -{ - GtkWidget *widget; - - widget = e_task_widget_new (activity_info->icon_pixbuf, - activity_info->component_id, - activity_info->information); - gtk_widget_show (widget); - - g_signal_connect (widget, "button_press_event", - G_CALLBACK (task_widget_button_press_event_callback), - activity_info); - - return E_TASK_WIDGET (widget); -} - - -/* Task Bar handling. */ - -static void -setup_task_bar (EActivityHandler *activity_handler, - ETaskBar *task_bar) -{ - EActivityHandlerPrivate *priv; - GList *p; - - priv = activity_handler->priv; - - for (p = g_list_last (priv->activity_infos); p != NULL; p = p->prev) { - e_task_bar_prepend_task (task_bar, - task_widget_new_from_activity_info ((ActivityInfo *) p->data)); - } -} - -static void -task_bar_destroy_notify (void *data, - GObject *task_bar_instance) -{ - EActivityHandler *activity_handler; - EActivityHandlerPrivate *priv; - - activity_handler = E_ACTIVITY_HANDLER (data); - priv = activity_handler->priv; - - priv->task_bars = g_slist_remove (priv->task_bars, task_bar_instance); -} - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - EActivityHandler *handler; - EActivityHandlerPrivate *priv; - GList *p; - GSList *sp; - - handler = E_ACTIVITY_HANDLER (object); - priv = handler->priv; - - for (p = priv->activity_infos; p != NULL; p = p->next) { - ActivityInfo *info; - - info = (ActivityInfo *) p->data; - activity_info_free (info); - } - - g_list_free (priv->activity_infos); - priv->activity_infos = NULL; - - for (sp = priv->task_bars; sp != NULL; sp = sp->next) - g_object_weak_unref (G_OBJECT (sp->data), task_bar_destroy_notify, sp->data); - priv->task_bars = NULL; - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -impl_finalize (GObject *object) -{ - EActivityHandler *handler; - EActivityHandlerPrivate *priv; - - handler = E_ACTIVITY_HANDLER (object); - priv = handler->priv; - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -/* GTK+ type stuff. */ - -static void -class_init (GObjectClass *object_class) -{ - parent_class = g_type_class_ref(PARENT_TYPE); - - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; -} - -static void -init (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - - priv = g_new (EActivityHandlerPrivate, 1); - priv->next_activity_id = 1; - priv->activity_infos = NULL; - priv->task_bars = NULL; - - activity_handler->priv = priv; -} - - -EActivityHandler * -e_activity_handler_new (void) -{ - return g_object_new (e_activity_handler_get_type (), 0); -} - -void -e_activity_handler_set_message (EActivityHandler *activity_handler, - const char *message) -{ - EActivityHandlerPrivate *priv; - GSList *i; - - priv = activity_handler->priv; - - for (i = priv->task_bars; i; i = i->next) - e_task_bar_set_message (E_TASK_BAR (i->data), message); -} - -void -e_activity_handler_unset_message (EActivityHandler *activity_handler) -{ - EActivityHandlerPrivate *priv; - GSList *i; - - priv = activity_handler->priv; - - for (i = priv->task_bars; i; i = i->next) - e_task_bar_unset_message (E_TASK_BAR (i->data)); -} - -void -e_activity_handler_attach_task_bar (EActivityHandler *activity_handler, - ETaskBar *task_bar) -{ - EActivityHandlerPrivate *priv; - - g_return_if_fail (activity_handler != NULL); - g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler)); - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - - priv = activity_handler->priv; - - g_object_weak_ref (G_OBJECT (task_bar), task_bar_destroy_notify, activity_handler); - - priv->task_bars = g_slist_prepend (priv->task_bars, task_bar); - - setup_task_bar (activity_handler, task_bar); -} - -/* CORBA methods. */ - -guint -e_activity_handler_operation_started (EActivityHandler *activity_handler, - const char *component_id, - GdkPixbuf *icon_pixbuf, - const char *information, - gboolean cancellable) -{ - EActivityHandlerPrivate *priv; - ActivityInfo *activity_info; - unsigned int activity_id; - GSList *p; - - priv = activity_handler->priv; - - activity_id = get_new_activity_id (activity_handler); - - activity_info = activity_info_new (component_id, activity_id, icon_pixbuf, information, cancellable); - - for (p = priv->task_bars; p != NULL; p = p->next) { - e_task_bar_prepend_task (E_TASK_BAR (p->data), - task_widget_new_from_activity_info (activity_info)); - } - - priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info); - - return activity_id; -} - -void -e_activity_handler_operation_progressing (EActivityHandler *activity_handler, - guint activity_id, - const char *information, - double progress) -{ - EActivityHandlerPrivate *priv = activity_handler->priv; - ActivityInfo *activity_info; - GList *p; - GSList *sp; - int order_number; - - p = lookup_activity (priv->activity_infos, activity_id, &order_number); - if (p == NULL) { - g_warning ("EActivityHandler: unknown operation %d", activity_id); - return; - } - - activity_info = (ActivityInfo *) p->data; - - g_free (activity_info->information); - activity_info->information = g_strdup (information); - - activity_info->progress = progress; - - for (sp = priv->task_bars; sp != NULL; sp = sp->next) { - ETaskBar *task_bar; - ETaskWidget *task_widget; - - task_bar = E_TASK_BAR (sp->data); - task_widget = e_task_bar_get_task_widget (task_bar, order_number); - - e_task_widget_update (task_widget, information, progress); - } -} - -void -e_activity_handler_operation_finished (EActivityHandler *activity_handler, - guint activity_id) -{ - EActivityHandlerPrivate *priv = activity_handler->priv; - GList *p; - GSList *sp; - int order_number; - - p = lookup_activity (priv->activity_infos, activity_id, &order_number); - if (p == NULL) { - g_warning ("e_activity_handler_operation_finished: Unknown activity %d\n", activity_id); - return; - } - - activity_info_free ((ActivityInfo *) p->data); - priv->activity_infos = g_list_remove_link (priv->activity_infos, p); - - for (sp = priv->task_bars; sp != NULL; sp = sp->next) { - ETaskBar *task_bar; - - task_bar = E_TASK_BAR (sp->data); - e_task_bar_remove_task (task_bar, order_number); - } -} - - -E_MAKE_TYPE (e_activity_handler, "EActivityHandler", EActivityHandler, class_init, init, PARENT_TYPE) diff --git a/shell/e-activity-handler.h b/shell/e-activity-handler.h deleted file mode 100644 index fca16f4753..0000000000 --- a/shell/e-activity-handler.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-activity-handler.h - * - * Copyright (C) 2001, 2002, 2003 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _E_ACTIVITY_HANDLER_H_ -#define _E_ACTIVITY_HANDLER_H_ - -#include "Evolution.h" - -#include "e-task-bar.h" - -#include <glib-object.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_ACTIVITY_HANDLER (e_activity_handler_get_type ()) -#define E_ACTIVITY_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_ACTIVITY_HANDLER, EActivityHandler)) -#define E_ACTIVITY_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_ACTIVITY_HANDLER, EActivityHandlerClass)) -#define E_IS_ACTIVITY_HANDLER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) -#define E_IS_ACTIVITY_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER)) - - -typedef struct _EActivityHandler EActivityHandler; -typedef struct _EActivityHandlerPrivate EActivityHandlerPrivate; -typedef struct _EActivityHandlerClass EActivityHandlerClass; - -struct _EActivityHandler { - GObject parent; - - EActivityHandlerPrivate *priv; -}; - -struct _EActivityHandlerClass { - GObjectClass parent_class; -}; - - -GtkType e_activity_handler_get_type (void); - -EActivityHandler *e_activity_handler_new (void); - -void e_activity_handler_attach_task_bar (EActivityHandler *activity_hanlder, - ETaskBar *task_bar); - -void e_activity_handler_set_message (EActivityHandler *activity_handler, - const char *message); - -void e_activity_handler_unset_message (EActivityHandler *activity_handler); - -guint e_activity_handler_operation_started (EActivityHandler *activity_handler, - const char *component_id, - GdkPixbuf *icon_pixbuf, - const char *information, - gboolean cancellable); - -void e_activity_handler_operation_progressing (EActivityHandler *activity_handler, - guint activity_id, - const char *information, - double progress); - -void e_activity_handler_operation_finished (EActivityHandler *activity_handler, - guint activity_id); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_ACTIVITY_HANDLER_H_ */ diff --git a/shell/e-task-bar.c b/shell/e-task-bar.c deleted file mode 100644 index 6f20d11505..0000000000 --- a/shell/e-task-bar.c +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-bar.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-task-bar.h" - -#include <gal/util/e-util.h> -#include "widgets/misc/e-clipped-label.h" - - -struct _ETaskBarPrivate -{ - EClippedLabel *message_label; - GtkHBox *hbox; -}; - -#define PARENT_TYPE gtk_hbox_get_type () -static GtkHBoxClass *parent_class = NULL; - - -/* WARNING: Ugly hack starts here. */ - -#define MAX_ACTIVITIES_PER_COMPONENT 2 - -static void -reduce_displayed_activities_per_component (ETaskBar *task_bar) -{ - GHashTable *component_ids_hash; - GtkBox *box; - GList *p; - - component_ids_hash = g_hash_table_new (g_str_hash, g_str_equal); - - box = GTK_BOX (task_bar->priv->hbox); - - for (p = box->children; p != NULL; p = p->next) { - GtkBoxChild *child; - const char *component_id; - void *hash_item; - - child = (GtkBoxChild *) p->data; - component_id = e_task_widget_get_component_id (E_TASK_WIDGET (child->widget)); - - hash_item = g_hash_table_lookup (component_ids_hash, component_id); - - if (hash_item == NULL) { - gtk_widget_show (child->widget); - g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (1)); - } else { - int num_items; - - num_items = GPOINTER_TO_INT (hash_item); - g_assert (num_items <= MAX_ACTIVITIES_PER_COMPONENT); - - if (num_items == MAX_ACTIVITIES_PER_COMPONENT) { - gtk_widget_hide (child->widget); - } else { - num_items ++; - gtk_widget_show (child->widget); - g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (num_items)); - } - } - } - - g_hash_table_destroy (component_ids_hash); -} - - -static void -class_init (GtkObjectClass *object_class) -{ - parent_class = g_type_class_ref(PARENT_TYPE); -} - -static void -init (ETaskBar *task_bar) -{ - GtkWidget *label, *hbox; - - task_bar->priv = g_new (ETaskBarPrivate, 1); - - gtk_box_set_spacing (GTK_BOX (task_bar), 10); - - label = e_clipped_label_new ("", PANGO_WEIGHT_NORMAL, 1.0); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (task_bar), label, TRUE, TRUE, 0); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - task_bar->priv->message_label = E_CLIPPED_LABEL (label); - - hbox = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (task_bar), hbox); - task_bar->priv->hbox = GTK_HBOX (hbox); -} - - -void -e_task_bar_construct (ETaskBar *task_bar) -{ - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - - /* Nothing to do here. */ -} - -GtkWidget * -e_task_bar_new (void) -{ - ETaskBar *task_bar; - - task_bar = g_object_new (e_task_bar_get_type (), NULL); - e_task_bar_construct (task_bar); - - return GTK_WIDGET (task_bar); -} - -void -e_task_bar_set_message (ETaskBar *task_bar, - const char *message) -{ - if (message) { - gtk_widget_show (GTK_WIDGET (task_bar->priv->message_label)); - e_clipped_label_set_text (task_bar->priv->message_label, - message); - } else { - e_task_bar_unset_message (task_bar); - } -} - -void -e_task_bar_unset_message (ETaskBar *task_bar) -{ - gtk_widget_hide (GTK_WIDGET (task_bar->priv->message_label)); -} - -void -e_task_bar_prepend_task (ETaskBar *task_bar, - ETaskWidget *task_widget) -{ - GtkBoxChild *child_info; - GtkBox *box; - - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - - /* Hah hah. GTK+ sucks. This is adapted from `gtkhbox.c'. */ - - child_info = g_new (GtkBoxChild, 1); - child_info->widget = GTK_WIDGET (task_widget); - child_info->padding = 0; - child_info->expand = TRUE; - child_info->fill = TRUE; - child_info->pack = GTK_PACK_START; - - box = GTK_BOX (task_bar->priv->hbox); - - box->children = g_list_prepend (box->children, child_info); - - gtk_widget_set_parent (GTK_WIDGET (task_widget), GTK_WIDGET (task_bar->priv->hbox)); - - if (GTK_WIDGET_REALIZED (task_bar)) - gtk_widget_realize (GTK_WIDGET (task_widget)); - - if (GTK_WIDGET_VISIBLE (task_bar) && GTK_WIDGET_VISIBLE (task_widget)) { - if (GTK_WIDGET_MAPPED (task_bar)) - gtk_widget_map (GTK_WIDGET (task_widget)); - gtk_widget_queue_resize (GTK_WIDGET (task_widget)); - } - - reduce_displayed_activities_per_component (task_bar); - - gtk_widget_show (GTK_WIDGET (task_bar->priv->hbox)); -} - -void -e_task_bar_remove_task (ETaskBar *task_bar, - int n) -{ - ETaskWidget *task_widget; - - g_return_if_fail (task_bar != NULL); - g_return_if_fail (E_IS_TASK_BAR (task_bar)); - g_return_if_fail (n >= 0); - - task_widget = e_task_bar_get_task_widget (task_bar, n); - gtk_widget_destroy (GTK_WIDGET (task_widget)); - - reduce_displayed_activities_per_component (task_bar); - - if (g_list_length (GTK_BOX (task_bar->priv->hbox)->children) == 0) - gtk_widget_hide (GTK_WIDGET (task_bar->priv->hbox)); -} - -ETaskWidget * -e_task_bar_get_task_widget (ETaskBar *task_bar, - int n) -{ - GtkBoxChild *child_info; - - g_return_val_if_fail (task_bar != NULL, NULL); - g_return_val_if_fail (E_IS_TASK_BAR (task_bar), NULL); - - child_info = (GtkBoxChild *) g_list_nth (GTK_BOX (task_bar->priv->hbox)->children, n)->data; - - return E_TASK_WIDGET (child_info->widget); -} - - -E_MAKE_TYPE (e_task_bar, "ETaskBar", ETaskBar, class_init, init, PARENT_TYPE) diff --git a/shell/e-task-bar.h b/shell/e-task-bar.h deleted file mode 100644 index e91e5fab65..0000000000 --- a/shell/e-task-bar.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-bar.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _E_TASK_BAR_H_ -#define _E_TASK_BAR_H_ - -#include "e-task-widget.h" - -#include <gtk/gtkhbox.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_TASK_BAR (e_task_bar_get_type ()) -#define E_TASK_BAR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TASK_BAR, ETaskBar)) -#define E_TASK_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_BAR, ETaskBarClass)) -#define E_IS_TASK_BAR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TASK_BAR)) -#define E_IS_TASK_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_BAR)) - - -typedef struct _ETaskBar ETaskBar; -typedef struct _ETaskBarPrivate ETaskBarPrivate; -typedef struct _ETaskBarClass ETaskBarClass; - -struct _ETaskBar { - GtkHBox parent; - - ETaskBarPrivate *priv; -}; - -struct _ETaskBarClass { - GtkHBoxClass parent_class; -}; - - -GtkType e_task_bar_get_type (void); -void e_task_bar_construct (ETaskBar *task_bar); -GtkWidget *e_task_bar_new (void); - -void e_task_bar_set_message (ETaskBar *task_bar, - const char *message); -void e_task_bar_unset_message (ETaskBar *task_bar); - -void e_task_bar_prepend_task (ETaskBar *task_bar, - ETaskWidget *task_widget); -void e_task_bar_remove_task (ETaskBar *task_bar, - int n); - -ETaskWidget *e_task_bar_get_task_widget (ETaskBar *task_bar, - int n); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TASK_BAR_H_ */ diff --git a/shell/e-task-widget.c b/shell/e-task-widget.c deleted file mode 100644 index c6cd524c2f..0000000000 --- a/shell/e-task-widget.c +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-widget.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-task-widget.h" - -#include <gtk/gtkframe.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkimage.h> -#include <gtk/gtktooltips.h> - -#include <libgnome/gnome-i18n.h> - -#include <gal/util/e-util.h> - - -#define SPACING 2 - -#define PARENT_TYPE (gtk_event_box_get_type ()) -static GtkEventBoxClass *parent_class = NULL; - -struct _ETaskWidgetPrivate { - char *component_id; - - GtkTooltips *tooltips; - - GdkPixbuf *icon_pixbuf; - GtkWidget *label; - GtkWidget *image; -}; - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - ETaskWidget *task_widget; - ETaskWidgetPrivate *priv; - - task_widget = E_TASK_WIDGET (object); - - priv = task_widget->priv; - - if (priv->tooltips != NULL) { - g_object_unref (priv->tooltips); - priv->tooltips = NULL; - } - - if (priv->icon_pixbuf != NULL) { - g_object_unref (priv->icon_pixbuf); - priv->icon_pixbuf = NULL; - } - - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -impl_finalize (GObject *object) -{ - ETaskWidget *task_widget; - ETaskWidgetPrivate *priv; - - task_widget = E_TASK_WIDGET (object); - priv = task_widget->priv; - - g_free (priv->component_id); - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -class_init (GObjectClass *object_class) -{ - parent_class = g_type_class_ref(PARENT_TYPE); - - object_class->dispose = impl_dispose; - object_class->finalize = impl_finalize; -} - -static void -init (ETaskWidget *task_widget) -{ - ETaskWidgetPrivate *priv; - - priv = g_new (ETaskWidgetPrivate, 1); - - priv->component_id = NULL; - priv->tooltips = NULL; - priv->icon_pixbuf = NULL; - priv->label = NULL; - priv->image = NULL; - - task_widget->priv = priv; -} - - -void -e_task_widget_construct (ETaskWidget *task_widget, - GdkPixbuf *icon_pixbuf, - const char *component_id, - const char *information) -{ - ETaskWidgetPrivate *priv; - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkWidget *box; - GtkWidget *frame; - - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - g_return_if_fail (icon_pixbuf != NULL); - g_return_if_fail (component_id != NULL); - g_return_if_fail (information != NULL); - - priv = task_widget->priv; - - priv->component_id = g_strdup (component_id); - - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); - gtk_container_add (GTK_CONTAINER (task_widget), frame); - gtk_widget_show (frame); - - box = gtk_hbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (frame), box); - gtk_widget_show (box); - - gtk_widget_set_size_request (box, 1, -1); - - priv->icon_pixbuf = g_object_ref (icon_pixbuf); - - gdk_pixbuf_render_pixmap_and_mask (icon_pixbuf, &pixmap, &mask, 128); - - priv->image = gtk_image_new_from_pixmap (pixmap, mask); - gtk_widget_show (priv->image); - gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, TRUE, 0); - - priv->label = gtk_label_new (""); - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); - gtk_widget_show (priv->label); - gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0); - - gdk_pixmap_unref (pixmap); - g_object_unref (mask); - - priv->tooltips = gtk_tooltips_new (); - g_object_ref (priv->tooltips); - gtk_object_sink (GTK_OBJECT (priv->tooltips)); - - e_task_widget_update (task_widget, information, -1.0); -} - -GtkWidget * -e_task_widget_new (GdkPixbuf *icon_pixbuf, - const char *component_id, - const char *information) -{ - ETaskWidget *task_widget; - - g_return_val_if_fail (icon_pixbuf != NULL, NULL); - g_return_val_if_fail (information != NULL, NULL); - - task_widget = g_object_new (e_task_widget_get_type (), NULL); - e_task_widget_construct (task_widget, icon_pixbuf, component_id, information); - - return GTK_WIDGET (task_widget); -} - - -void -e_task_widget_update (ETaskWidget *task_widget, - const char *information, - double completion) -{ - ETaskWidgetPrivate *priv; - char *text; - - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); - g_return_if_fail (information != NULL); - - priv = task_widget->priv; - - if (completion < 0.0) { - text = g_strdup_printf (_("%s (...)"), information); - } else { - int percent_complete; - - percent_complete = (int) (completion * 100.0 + .5); - text = g_strdup_printf (_("%s (%d%% complete)"), information, percent_complete); - } - - gtk_label_set_text (GTK_LABEL (priv->label), text); - - gtk_tooltips_set_tip (priv->tooltips, GTK_WIDGET (task_widget), text, NULL); - - g_free (text); -} - -void -e_task_wiget_alert (ETaskWidget *task_widget) -{ - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); -} - -void -e_task_wiget_unalert (ETaskWidget *task_widget) -{ - g_return_if_fail (task_widget != NULL); - g_return_if_fail (E_IS_TASK_WIDGET (task_widget)); -} - - -const char * -e_task_widget_get_component_id (ETaskWidget *task_widget) -{ - g_return_val_if_fail (task_widget != NULL, NULL); - g_return_val_if_fail (E_IS_TASK_WIDGET (task_widget), NULL); - - return task_widget->priv->component_id; -} - - -E_MAKE_TYPE (e_task_widget, "ETaskWidget", ETaskWidget, class_init, init, PARENT_TYPE) diff --git a/shell/e-task-widget.h b/shell/e-task-widget.h deleted file mode 100644 index 6173623a80..0000000000 --- a/shell/e-task-widget.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-task-widget.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _E_TASK_WIDGET_H_ -#define _E_TASK_WIDGET_H_ - -#include <gtk/gtkeventbox.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_TASK_WIDGET (e_task_widget_get_type ()) -#define E_TASK_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TASK_WIDGET, ETaskWidget)) -#define E_TASK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_WIDGET, ETaskWidgetClass)) -#define E_IS_TASK_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TASK_WIDGET)) -#define E_IS_TASK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_WIDGET)) - - -typedef struct _ETaskWidget ETaskWidget; -typedef struct _ETaskWidgetPrivate ETaskWidgetPrivate; -typedef struct _ETaskWidgetClass ETaskWidgetClass; - -struct _ETaskWidget { - GtkEventBox parent; - - ETaskWidgetPrivate *priv; -}; - -struct _ETaskWidgetClass { - GtkEventBoxClass parent_class; -}; - - -GtkType e_task_widget_get_type (void); -void e_task_widget_construct (ETaskWidget *task_widget, - GdkPixbuf *icon_pixbuf, - const char *component_id, - const char *information); -GtkWidget *e_task_widget_new (GdkPixbuf *icon_pixbuf, - const char *component_id, - const char *information); - -void e_task_widget_update (ETaskWidget *task_widget, - const char *information, - double completion); - -void e_task_wiget_alert (ETaskWidget *task_widget); -void e_task_wiget_unalert (ETaskWidget *task_widget); - -const char *e_task_widget_get_component_id (ETaskWidget *task_widget); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TASK_WIDGET_H_ */ |