aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog9
-rw-r--r--shell/e-activity-handler.c24
-rw-r--r--shell/e-activity-handler.h5
-rw-r--r--shell/e-task-bar.c50
-rw-r--r--shell/e-task-bar.h8
5 files changed, 90 insertions, 6 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 05c28b39e2..8567caf2ad 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-05 ERDI Gergo <cactus@cactus.rulez.org>
+
+ * e-task-bar.c (init): Create a separate label to the left of the
+ progress messages...
+ (e_task_bar_message): ...and allow components to set it...
+
+ * e-activity-handler.c (e_activity_handler_message): ...through
+ this new ActivityHandler method
+
2003-12-30 JP Rosevear <jpr@ximian.com>
* e-setup.[hc]: these just handle creating the ~/evolution dir and
diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c
index a6900edd93..d64bcd8f6e 100644
--- a/shell/e-activity-handler.c
+++ b/shell/e-activity-handler.c
@@ -279,6 +279,30 @@ 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,
diff --git a/shell/e-activity-handler.h b/shell/e-activity-handler.h
index 46826c8eb3..fca16f4753 100644
--- a/shell/e-activity-handler.h
+++ b/shell/e-activity-handler.h
@@ -63,6 +63,11 @@ 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,
diff --git a/shell/e-task-bar.c b/shell/e-task-bar.c
index 522d473373..7a706fd290 100644
--- a/shell/e-task-bar.c
+++ b/shell/e-task-bar.c
@@ -27,8 +27,15 @@
#include "e-task-bar.h"
#include <gal/util/e-util.h>
+#include <gtk/gtklabel.h>
+struct _ETaskBarPrivate
+{
+ GtkLabel *message_label;
+ GtkHBox *hbox;
+};
+
#define PARENT_TYPE gtk_hbox_get_type ()
static GtkHBoxClass *parent_class = NULL;
@@ -46,7 +53,7 @@ reduce_displayed_activities_per_component (ETaskBar *task_bar)
component_ids_hash = g_hash_table_new (g_str_hash, g_str_equal);
- box = GTK_BOX (task_bar);
+ box = GTK_BOX (task_bar->priv->hbox);
for (p = box->children; p != NULL; p = p->next) {
GtkBoxChild *child;
@@ -90,7 +97,22 @@ class_init (GtkObjectClass *object_class)
static void
init (ETaskBar *task_bar)
{
- /* Nothing to do here. */
+ GtkWidget *label, *hbox;
+
+ task_bar->priv = g_new (ETaskBarPrivate, 1);
+
+ gtk_box_set_spacing (GTK_BOX (task_bar), 10);
+
+ label = gtk_label_new ("");
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (task_bar), label, FALSE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ task_bar->priv->message_label = GTK_LABEL (label);
+
+ hbox = gtk_hbox_new (0, FALSE);
+ gtk_widget_show (hbox);
+ gtk_container_add (GTK_CONTAINER (task_bar), hbox);
+ task_bar->priv->hbox = GTK_HBOX (hbox);
}
@@ -115,6 +137,24 @@ e_task_bar_new (void)
}
void
+e_task_bar_set_message (ETaskBar *task_bar,
+ const char *message)
+{
+ if (message) {
+ gtk_widget_show (GTK_WIDGET (task_bar->priv->message_label));
+ gtk_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)
{
@@ -135,11 +175,11 @@ e_task_bar_prepend_task (ETaskBar *task_bar,
child_info->fill = TRUE;
child_info->pack = GTK_PACK_START;
- box = GTK_BOX (task_bar);
+ 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));
+ 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));
@@ -178,7 +218,7 @@ e_task_bar_get_task_widget (ETaskBar *task_bar,
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)->children, n)->data;
+ child_info = (GtkBoxChild *) g_list_nth (GTK_BOX (task_bar->priv->hbox)->children, n)->data;
return E_TASK_WIDGET (child_info->widget);
}
diff --git a/shell/e-task-bar.h b/shell/e-task-bar.h
index c20ca1871c..e91e5fab65 100644
--- a/shell/e-task-bar.h
+++ b/shell/e-task-bar.h
@@ -44,7 +44,9 @@ typedef struct _ETaskBarPrivate ETaskBarPrivate;
typedef struct _ETaskBarClass ETaskBarClass;
struct _ETaskBar {
- GtkHBox parent;
+ GtkHBox parent;
+
+ ETaskBarPrivate *priv;
};
struct _ETaskBarClass {
@@ -56,6 +58,10 @@ 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,