Re: [Evolution-hackers] Status bar
- From: ERDI Gergo <cactus cactus rulez org>
- To: Not Zed <notzed ximian com>
- Cc: Ettore Perazzoli <ettore ximian com>, evolution-hackers ximian com
- Subject: Re: [Evolution-hackers] Status bar
- Date: Fri, 5 Dec 2003 12:57:51 +0100 (CET)
Hi,
> I think you should call it 'on-url', its really only proxying the
> gtkhtml event anyway.
OK I changed its name, but it's not just a proxy since the signature
changes from void () (const char*) to void () (const char*, const char*)
> Actually i dont understand why you are exporting this signal anyway?
>
> You have two places the status is set, one from the signal callback in
> em-folder-view via the <status> tag, and the other from the callback
> in mail-component via activity client status.
I thought I already explained it.
The problem is that there are two competing ways to set the statusbar, and
parts of Evolution use both.
THe main shell uses its own Evolution::Component interface, thus when the
mail component is embedded in the main window, it has to use this.
On the other hand, Bonobo proper uses the Bonobo::UI interface. This is
the interface used when you double-click a mail message and it is opened
in a separate window.
> as i've statued beofre, i dont understand this logic. why not set it
> to "" intsead of NULL, so you don't have to do this messy stuff?
like I said, look at the implementation of bonobo_ui_component_set_status:
if (text == NULL ||
text [0] == '\0') {
/*
* FIXME: Remove what was there to reveal other msgs
* NB. if we're using the same UI component as the view
* was merged in with, this will result in us loosing our
* status bar altogether - sub-optimal.
*/
bonobo_ui_component_rm (component, "/status/main", opt_ev);
so that's why. I realise that there has been some problems in the minor
details in the patch (I haven't done any straight-C GTK+ hacking since
ages), but please assume that I know what I'm doing :)
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2930
diff -u -r1.2930 ChangeLog
--- mail/ChangeLog 3 Dec 2003 19:24:34 -0000 1.2930
+++ mail/ChangeLog 5 Dec 2003 11:54:51 -0000
@@ -1,3 +1,19 @@
+2003-12-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.
+
+
2003-12-03 Jeffrey Stedfast <fejj ximian com>
* em-folder-view.c (emfv_set_folder): Sync the folder before
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.17
diff -u -r1.17 em-folder-view.c
--- mail/em-folder-view.c 3 Dec 2003 19:24:43 -0000 1.17
+++ mail/em-folder-view.c 5 Dec 2003 11:54:55 -0000
@@ -65,6 +65,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>
@@ -102,6 +103,9 @@
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 {
@@ -114,10 +118,19 @@
GtkWidget *invisible;
char *selection_uri;
+
+ gboolean do_statusbar;
};
static GtkVBoxClass *emfv_parent;
+enum {
+ ON_URL,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0, };
+
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);
@@ -129,8 +142,10 @@
gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE);
- p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate));
+ p = emfv->priv = g_new0(struct _EMFolderViewPrivate, 1);
+ p->do_statusbar = TRUE;
+
emfv->ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-message.xml");
emfv->ui_app_name = "evolution-mail";
@@ -147,6 +162,7 @@
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->formathtml.html, "on_url", G_CALLBACK (emfv_on_url_cb), emfv);
p->invisible = gtk_invisible_new();
g_object_ref(p->invisible);
@@ -228,6 +244,17 @@
((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[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
@@ -1547,6 +1574,8 @@
e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
emfv_enable_menus(emfv);
+ if (emfv->priv->do_statusbar)
+ bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", NULL);
} else {
const BonoboUIVerb *v;
@@ -1625,6 +1654,18 @@
return t;
}
+void
+em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar)
+{
+ g_return_if_fail (emfv);
+
+ emfv->priv->do_statusbar = statusbar;
+
+ if (statusbar && emfv->uic)
+ bonobo_ui_component_set_translate (emfv->uic, "/",
+ "<status><item name=\"main\"/></status>", NULL);
+}
+
/* ********************************************************************** */
struct mst_t {
@@ -2016,3 +2057,34 @@
emfv, NULL, NULL);
g_object_unref(gconf);
}
+
+static void
+emfv_on_url (EMFolderView *emfv, const char *uri, const char *nice_uri)
+{
+ if (emfv->priv->do_statusbar)
+ {
+ if (emfv->uic) {
+ bonobo_ui_component_set_status (emfv->uic, nice_uri, NULL);
+ /* Make sure the node keeps existing if nice_url == 0 */
+ 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 = 0;
+
+ 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[ON_URL], 0, url, nice_url);
+
+ g_free (nice_url);
+}
Index: mail/em-folder-view.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.h,v
retrieving revision 1.3
diff -u -r1.3 em-folder-view.h
--- mail/em-folder-view.h 19 Sep 2003 18:54:09 -0000 1.3
+++ mail/em-folder-view.h 5 Dec 2003 11:54:55 -0000
@@ -84,11 +84,14 @@
GtkVBoxClass parent_class;
/* if used as a control, used to activate/deactivate custom menu's */
- void (*activate)(EMFolderView *, struct _BonoboUIComponent *uic, int state);
+ void (*activate) (EMFolderView *, struct _BonoboUIComponent *uic, int state);
- 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);
+ 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);
@@ -107,6 +110,8 @@
int em_folder_view_print(EMFolderView *emfv, int preview);
+void em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar);
+
/* this could be on message-list */
guint32 em_folder_view_disable_mask(EMFolderView *emfv);
Index: mail/mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.33
diff -u -r1.33 mail-component.c
--- mail/mail-component.c 2 Dec 2003 23:29:09 -0000 1.33
+++ mail/mail-component.c 5 Dec 2003 11:54:57 -0000
@@ -319,6 +319,12 @@
(* 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. */
@@ -361,6 +367,9 @@
g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
+
+ g_signal_connect (view_widget, "on-url", G_CALLBACK (view_on_url), mail_component);
+ em_folder_view_set_statusbar ((EMFolderView*)view_widget, FALSE);
}
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1354
diff -u -r1.1354 ChangeLog
--- shell/ChangeLog 3 Dec 2003 20:08:14 -0000 1.1354
+++ shell/ChangeLog 5 Dec 2003 11:54:59 -0000
@@ -1,3 +1,12 @@
+2003-12-04 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-03 Ettore Perazzoli <ettore ximian com>
[Fix for #51619.]
Index: shell/e-activity-handler.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-activity-handler.c,v
retrieving revision 1.34
diff -u -r1.34 e-activity-handler.c
--- shell/e-activity-handler.c 3 Dec 2003 17:59:27 -0000 1.34
+++ shell/e-activity-handler.c 5 Dec 2003 11:55:00 -0000
@@ -279,6 +279,30 @@
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,
Index: shell/e-activity-handler.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-activity-handler.h,v
retrieving revision 1.8
diff -u -r1.8 e-activity-handler.h
--- shell/e-activity-handler.h 2 Dec 2003 03:41:33 -0000 1.8
+++ shell/e-activity-handler.h 5 Dec 2003 11:55:00 -0000
@@ -63,6 +63,11 @@
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,
Index: shell/e-task-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-task-bar.c,v
retrieving revision 1.9
diff -u -r1.9 e-task-bar.c
--- shell/e-task-bar.c 2 Dec 2002 03:23:57 -0000 1.9
+++ shell/e-task-bar.c 5 Dec 2003 11:55:00 -0000
@@ -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 @@
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 @@
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 @@
}
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 @@
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 @@
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);
}
Index: shell/e-task-bar.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-task-bar.h,v
retrieving revision 1.3
diff -u -r1.3 e-task-bar.h
--- shell/e-task-bar.h 27 Oct 2001 01:09:28 -0000 1.3
+++ shell/e-task-bar.h 5 Dec 2003 11:55:01 -0000
@@ -44,7 +44,9 @@
typedef struct _ETaskBarClass ETaskBarClass;
struct _ETaskBar {
- GtkHBox parent;
+ GtkHBox parent;
+
+ ETaskBarPrivate *priv;
};
struct _ETaskBarClass {
@@ -56,6 +58,10 @@
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,
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus cactus rulez org =---'
Miért olyan hosszú szó az, hogy rövidítés?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]