aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorERDI Gergo <cactus@cactus.rulez.org>2004-01-07 22:29:08 +0800
committerÉRDI Gergo <cactus@src.gnome.org>2004-01-07 22:29:08 +0800
commite2b0897d8088cb4c118f4564e9f6de2845de3176 (patch)
tree23af259b80ece4d26fe94085123f326e7f60582b
parent79373d6650bfb2f10b91772e10aafcd52badfb26 (diff)
downloadgsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar.gz
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar.bz2
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar.lz
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar.xz
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.tar.zst
gsoc2013-evolution-e2b0897d8088cb4c118f4564e9f6de2845de3176.zip
Emit a hover-url signal when the user mouses over a URL, ...
2004-01-04 ERDI Gergo <cactus@cactus.rulez.org> * em-folder-view.c (emfv_on_url_cb): Emit a hover-url signal when the user mouses over a URL, ... (emfv_hover_url_impl): ... and use BonoboUI to change the status bar message... (em_folder_view_set_statusbar): ... unless we are asked not to, ... * mail-component.c (impl_createControls): ... like in the case of the mail component, ... (view_hover_url_cb): ... that uses the ActivityHandler to do the same Add these together, and #127536 is neatly solved. 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 svn path=/trunk/; revision=24086
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-folder-view.c70
-rw-r--r--mail/em-folder-view.h6
-rw-r--r--mail/em-format-html-display.c20
-rw-r--r--mail/em-format-html-display.h2
-rw-r--r--mail/mail-component.c10
-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
11 files changed, 213 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 14b58feb70..17bc446c59 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -56,6 +56,21 @@
* em-format.c (em_format_find_handler): make virtual, rename to
emf_find_handler.
+2004-01-04 ERDI Gergo <cactus@cactus.rulez.org>
+
+ * em-folder-view.c (emfv_on_url_cb): Emit a hover-url signal when
+ the user mouses over a URL, ...
+ (emfv_hover_url_impl): ... and use BonoboUI to change the status
+ bar message...
+ (em_folder_view_set_statusbar): ... unless we are asked not to, ...
+
+ * mail-component.c (impl_createControls): ... like in the case of
+ the mail component, ...
+ (view_hover_url_cb): ... that uses the ActivityHandler to do the
+ same
+
+ Add these together, and #127536 is neatly solved.
+
2004-01-04 David Woodhouse <dwmw2@infradead.org>
* em-format-html-display.c: Mail warning grammar typo fix.
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 997e64a4c9..ab35e7a090 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -66,6 +66,7 @@
#include "em-message-browser.h"
#include "message-list.h"
#include "em-utils.h"
+#include "em-marshal.h"
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/htmlobject.h>
@@ -103,6 +104,9 @@ static void filter_type_current (EMFolderView *emfv, int type);
static void emfv_setting_setup(EMFolderView *emfv);
+static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv);
+static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri);
+
static const EMFolderViewEnable emfv_enable_map[];
struct _EMFolderViewPrivate {
@@ -119,6 +123,13 @@ struct _EMFolderViewPrivate {
static GtkVBoxClass *emfv_parent;
+enum {
+ EMFV_ON_URL,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
static void emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv);
static void emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv);
@@ -132,6 +143,8 @@ emfv_init(GObject *o)
p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate));
+ emfv->statusbar_active = TRUE;
+
emfv->ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-message.xml");
emfv->ui_app_name = "evolution-mail";
@@ -148,6 +161,7 @@ emfv_init(GObject *o)
emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new();
g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv);
g_signal_connect(emfv->preview, "popup_event", G_CALLBACK(emfv_format_popup_event), emfv);
+ g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv);
p->invisible = gtk_invisible_new();
g_object_ref(p->invisible);
@@ -229,6 +243,17 @@ emfv_class_init(GObjectClass *klass)
((EMFolderViewClass *)klass)->set_folder_uri = emfv_set_folder_uri;
((EMFolderViewClass *)klass)->set_message = emfv_set_message;
((EMFolderViewClass *)klass)->activate = emfv_activate;
+
+ ((EMFolderViewClass *)klass)->on_url = emfv_on_url;
+
+ signals[EMFV_ON_URL] = g_signal_new ("on-url",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMFolderViewClass, on_url),
+ NULL, NULL,
+ em_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE,
+ 2, G_TYPE_STRING, G_TYPE_STRING);
}
GType
@@ -1550,6 +1575,8 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
emfv_enable_menus(emfv);
+ if (emfv->statusbar_active)
+ bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", NULL);
} else {
const BonoboUIVerb *v;
@@ -1628,6 +1655,18 @@ em_folder_view_get_popup_target(EMFolderView *emfv)
return t;
}
+void
+em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar)
+{
+ g_return_if_fail (emfv);
+
+ emfv->statusbar_active = statusbar;
+
+ if (statusbar && emfv->uic)
+ bonobo_ui_component_set_translate (emfv->uic, "/",
+ "<status><item name=\"main\"/></status>", NULL);
+}
+
/* ********************************************************************** */
struct mst_t {
@@ -2049,3 +2088,34 @@ emfv_setting_setup(EMFolderView *emfv)
emfv, NULL, NULL);
g_object_unref(gconf);
}
+
+static void
+emfv_on_url (EMFolderView *emfv, const char *uri, const char *nice_uri)
+{
+ if (emfv->statusbar_active) {
+ if (emfv->uic) {
+ bonobo_ui_component_set_status (emfv->uic, nice_uri, NULL);
+ /* Make sure the node keeps existing if nice_url == NULL */
+ if (!nice_uri)
+ bonobo_ui_component_set_translate (
+ emfv->uic, "/", "<status><item name=\"main\"/></status>", NULL);
+ }
+ }
+}
+
+static void
+emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv)
+{
+ char *nice_url = NULL;
+
+ if (url) {
+ if (strncmp (url, "mailto:", 7) == 0)
+ nice_url = g_strdup_printf (_("Click to mail %s"), url + 7);
+ else
+ nice_url = g_strdup_printf (_("Click to open %s"), url);
+ }
+
+ g_signal_emit (emfv, signals[EMFV_ON_URL], 0, url, nice_url);
+
+ g_free (nice_url);
+}
diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h
index 080b19eb6a..96c7ad97d0 100644
--- a/mail/em-folder-view.h
+++ b/mail/em-folder-view.h
@@ -78,6 +78,7 @@ struct _EMFolderView {
int mark_seen_timeout; /* local copy of gconf stuff */
int mark_seen:1;
int preview_active:1; /* is preview being used */
+ int statusbar_active:1; /* should we manage the statusbar messages ourselves? */
};
struct _EMFolderViewClass {
@@ -89,6 +90,9 @@ struct _EMFolderViewClass {
void (*set_folder_uri)(EMFolderView *emfv, const char *uri);
void (*set_folder)(EMFolderView *emfv, struct _CamelFolder *folder, const char *uri);
void (*set_message)(EMFolderView *emfv, const char *uid);
+
+ /* Signals */
+ void (*on_url)(EMFolderView *emfv, const char *uri, const char *nice_uri);
};
GType em_folder_view_get_type(void);
@@ -110,6 +114,8 @@ int em_folder_view_print(EMFolderView *emfv, int preview);
/* this could be on message-list */
guint32 em_folder_view_disable_mask(EMFolderView *emfv);
+void em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index eaccf32e47..2c9b3c513e 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -106,6 +106,7 @@ struct _EMFormatHTMLDisplayPrivate {
static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh);
static void efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd);
+static void efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd);
struct _attach_puri {
EMFormatPURI puri;
@@ -140,6 +141,7 @@ static void efhd_builtin_init(EMFormatHTMLDisplayClass *efhc);
enum {
EFHD_LINK_CLICKED,
EFHD_POPUP_EVENT,
+ EFHD_ON_URL,
EFHD_LAST_SIGNAL,
};
@@ -290,6 +292,16 @@ efhd_class_init(GObjectClass *klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_POINTER, G_TYPE_POINTER);
+ efhd_signals[EFHD_ON_URL] =
+ g_signal_new("on_url",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(EMFormatHTMLDisplayClass, on_url),
+ NULL, NULL,
+ gtk_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
efhd_builtin_init((EMFormatHTMLDisplayClass *)klass);
}
@@ -324,6 +336,7 @@ EMFormatHTMLDisplay *em_format_html_display_new(void)
g_signal_connect(efhd->formathtml.html, "iframe_created", G_CALLBACK(efhd_iframe_created), efhd);
g_signal_connect(efhd->formathtml.html, "link_clicked", G_CALLBACK(efhd_html_link_clicked), efhd);
+ g_signal_connect(efhd->formathtml.html, "on_url", G_CALLBACK(efhd_html_on_url), efhd);
g_signal_connect(efhd->formathtml.html, "button_press_event", G_CALLBACK(efhd_html_button_press_event), efhd);
return efhd;
@@ -593,6 +606,13 @@ efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efh
}
static void
+efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd)
+{
+ d(printf("on_url event '%s'\n", url));
+ g_signal_emit((GObject *)efhd, efhd_signals[EFHD_ON_URL], 0, url);
+}
+
+static void
efhd_complete(EMFormat *emf)
{
EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)emf;
diff --git a/mail/em-format-html-display.h b/mail/em-format-html-display.h
index cf78642112..1bf1b395d8 100644
--- a/mail/em-format-html-display.h
+++ b/mail/em-format-html-display.h
@@ -35,6 +35,8 @@ struct _EMFormatHTMLDisplayClass {
void (*link_clicked)(EMFormatHTMLDisplay *efhd, const char *uri);
/* a part or a link button pressed event */
int (*popup_event)(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const char *uri, struct _CamelMimePart *part);
+ /* the mouse is over a link */
+ void (*on_url)(EMFormatHTMLDisplay *efhd, const char *uri);
};
GType em_format_html_display_get_type(void);
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 442b17e9ac..a764e1b7c6 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -319,6 +319,13 @@ impl_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
+static void
+view_on_url (GObject *emitter, const char *url, const char *nice_url, MailComponent *mail_component)
+{
+ MailComponentPrivate *priv = mail_component->priv;
+
+ e_activity_handler_set_message (priv->activity_handler, nice_url);
+}
/* Evolution::Component CORBA methods. */
@@ -342,6 +349,9 @@ impl_createControls (PortableServer_Servant servant,
tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model);
em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget);
em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session);
+
+ g_signal_connect (view_widget, "on-url", G_CALLBACK (view_on_url), mail_component);
+ em_folder_view_set_statusbar ((EMFolderView*)view_widget, FALSE);
statusbar_widget = e_task_bar_new ();
e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget));
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,