[evolution-patches] Patch for bug/bounty #127536




-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
Minden számítógép azonos sebességgel vár.
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1344
diff -u -r1.1344 ChangeLog
--- shell/ChangeLog	23 Nov 2003 16:54:59 -0000	1.1344
+++ shell/ChangeLog	24 Nov 2003 15:47:35 -0000
@@ -1,3 +1,9 @@
+2003-11-24  ERDI Gergo  <cactus cactus rulez org>
+
+	* e-shell-window.c (setup_offline_toggle): Merge the
+	online/offline toggle into the status bar as a proper Bonobo
+	Control
+
 2003-11-23  JP Rosevear  <jpr ximian com>
 
 	* Makefile.am: remove gtk deprecated flag
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.14
diff -u -r1.14 e-shell-window.c
--- shell/e-shell-window.c	19 Nov 2003 09:43:17 -0000	1.14
+++ shell/e-shell-window.c	24 Nov 2003 15:47:37 -0000
@@ -49,6 +49,7 @@
 #include <bonobo/bonobo-object.h>
 #include <bonobo/bonobo-ui-util.h>
 #include <bonobo/bonobo-widget.h>
+#include <bonobo/bonobo-control.h>
 
 #include <libgnome/gnome-i18n.h>
 
@@ -101,10 +102,8 @@
 	GtkTooltips *tooltips;
 
 	/* The status bar widgetry.  */
-	GtkWidget *status_bar;
 	GtkWidget *offline_toggle;
 	GtkWidget *offline_toggle_image;
-	GtkWidget *menu_hint_label;
 	GtkWidget *task_bar;
 };
 
@@ -359,7 +358,7 @@
 				  EShellWindow *window)
 {
 	EShellWindowPrivate *priv = window->priv;
-	ComponentView *component_view;
+	ComponentView *component_view = NULL;
 	GSList *p;
 
 	for (p = priv->component_views; p != NULL; p = p->next) {
@@ -404,25 +403,6 @@
 	update_send_receive_sensitivity (window);
 }
 
-static void
-ui_engine_add_hint_callback (BonoboUIEngine *engine,
-			     const char *hint,
-			     EShellWindow *window)
-{
-	gtk_label_set_text (GTK_LABEL (window->priv->menu_hint_label), hint);
-	gtk_widget_show (window->priv->menu_hint_label);
-	gtk_widget_hide (window->priv->task_bar);
-}
-
-static void
-ui_engine_remove_hint_callback (BonoboUIEngine *engine,
-				EShellWindow *window)
-{
-	gtk_widget_hide (window->priv->menu_hint_label);
-	gtk_widget_show (window->priv->task_bar);
-}
-
-
 /* Widgetry.  */
 
 static void
@@ -475,58 +455,51 @@
 
 	update_offline_toggle_status (window);
 
-	g_assert (priv->status_bar != NULL);
-
-	gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->offline_toggle, FALSE, TRUE, 0);
-}
-
-static void
-setup_menu_hint_label (EShellWindow *window)
-{
-	EShellWindowPrivate *priv;
-
-	priv = window->priv;
-
-	priv->menu_hint_label = gtk_label_new ("");
-	gtk_misc_set_alignment (GTK_MISC (priv->menu_hint_label), 0.0, 0.5);
-
-	gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->menu_hint_label, TRUE, TRUE, 0);
+	gtk_widget_show_all (toggle);
 }
 
 static void
 setup_task_bar (EShellWindow *window)
 {
-	EShellWindowPrivate *priv;
-
-	priv = window->priv;
+        EShellWindowPrivate *priv;
 
-	priv->task_bar = e_task_bar_new ();
+        priv = window->priv;
 
-	g_assert (priv->status_bar != NULL);
-
-	gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->task_bar, TRUE, TRUE, 0);
-	gtk_widget_show (priv->task_bar);
+        priv->task_bar = e_task_bar_new ();
+        gtk_widget_show (priv->task_bar);
 }
 
+
 static void
 setup_status_bar (EShellWindow *window)
 {
-	EShellWindowPrivate *priv;
-	BonoboUIEngine *ui_engine;
-
-	priv = window->priv;
-
-	priv->status_bar = gtk_hbox_new (FALSE, 2);
-	gtk_widget_show (priv->status_bar);
-
+	BonoboControl *control;
+	BonoboUIComponent *uic = window->priv->ui_component;
+	
 	setup_offline_toggle (window);
-	setup_menu_hint_label (window);
 	setup_task_bar (window);
 
-	ui_engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (window));
- 
-	g_signal_connect (ui_engine, "add_hint", G_CALLBACK (ui_engine_add_hint_callback), window);
-	g_signal_connect (ui_engine, "remove_hint", G_CALLBACK (ui_engine_remove_hint_callback), window);
+	/*
+	uic = window->priv->uic = bonobo_ui_component_new_default ();
+	bonobo_ui_component_set_container (
+		uic, BONOBO_OBJREF (bonobo_window_get_ui_container (window)),
+		NULL);
+	*/
+	bonobo_ui_component_set_translate (uic, "/",
+					   "<status>"
+					   "  <control name=\"offline_toggle\"/>\n"
+					   "  <item name=\"main\"/>\n"
+					   "  <control name=\"taskbar\"/>\n"
+					   "</status>",
+					   NULL);
+	
+	control = bonobo_control_new (window->priv->offline_toggle);
+	bonobo_ui_component_object_set (uic, "/status/offline_toggle", BONOBO_OBJREF (control), NULL);
+	bonobo_object_unref (control);
+
+	control = bonobo_control_new (window->priv->task_bar);
+	bonobo_ui_component_object_set (uic, "/status/taskbar", BONOBO_OBJREF (control), NULL);
+	bonobo_object_unref (control);
 }
 
 static void
@@ -535,7 +508,6 @@
 	EShellWindowPrivate *priv = window->priv;
 	EComponentRegistry *registry = e_shell_peek_component_registry (priv->shell);
 	GtkWidget *paned;
-	GtkWidget *contents_vbox;
 	GSList *p;
 	int button_id;
 
@@ -571,12 +543,9 @@
 
 	setup_status_bar (window);
 
-	contents_vbox = gtk_vbox_new (FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (contents_vbox), paned, TRUE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (contents_vbox), priv->status_bar, FALSE, TRUE, 0);
-	gtk_widget_show_all (contents_vbox);
+	gtk_widget_show_all (paned);
 
-	bonobo_window_set_contents (BONOBO_WINDOW (window), contents_vbox);
+	bonobo_window_set_contents (BONOBO_WINDOW (window), paned);
 }
 
 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2898
diff -u -r1.2898 ChangeLog
--- mail/ChangeLog	24 Nov 2003 01:38:11 -0000	1.2898
+++ mail/ChangeLog	24 Nov 2003 15:47:42 -0000
@@ -1,3 +1,8 @@
+2003-11-24  ERDI Gergo  <cactus cactus rulez org>
+
+	* em-folder-view.c (emfv_on_url_cb): Send a BonoboUI status
+	message when the user mouses over a URL
+
 2003-11-24  Radek Doulik  <rodo ximian com>
 
 	* em-format-html.c (efh_text_plain): use new colors
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.14
diff -u -r1.14 em-folder-view.c
--- mail/em-folder-view.c	14 Nov 2003 16:20:17 -0000	1.14
+++ mail/em-folder-view.c	24 Nov 2003 15:47:45 -0000
@@ -102,6 +102,11 @@
 
 static void emfv_setting_setup(EMFolderView *emfv);
 
+static void emfv_on_url_cb(GObject *emitter, const gchar *url, EMFolderView *emfv);
+static gchar * get_url_hint (const gchar *url);
+
+
+
 static const EMFolderViewEnable emfv_enable_map[];
 
 struct _EMFolderViewPrivate {
@@ -147,6 +152,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 (G_OBJECT (emfv->preview->formathtml.html), "on_url",G_CALLBACK (emfv_on_url_cb), emfv);
 
 	p->invisible = gtk_invisible_new();
 	g_object_ref(p->invisible);
@@ -1545,6 +1551,7 @@
 		e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
 
 		emfv_enable_menus(emfv);
+		bonobo_ui_component_set_translate (uic, "/", "<status><item name=\"main\"/></status>", NULL);
 	} else {
 		const BonoboUIVerb *v;
 
@@ -2012,4 +2019,46 @@
 								(GConfClientNotifyFunc)emfv_setting_notify,
 								emfv, NULL, NULL);
 	g_object_unref(gconf);
+}
+
+
+static void
+emfv_on_url_cb(GObject *emitter, const gchar *url, EMFolderView *emfv)
+{
+	char *nice_url = url ? get_url_hint (url) : 0;
+	
+	if (emfv->uic)
+	{
+		bonobo_ui_component_set_status (emfv->uic, nice_url, NULL);
+		/* Make sure the node keeps existing if nice_url == 0 */
+		if (!nice_url)
+			bonobo_ui_component_set_translate (emfv->uic, "/",
+							   "<status>\n"
+							   "  <item name=\"main\"/>\n"
+							   "</status>",
+							   NULL);
+	}
+	
+	g_free (nice_url);
+}
+
+static gchar *
+get_url_hint (const gchar *url)
+{
+	gchar       *scheme = 0, *scheme_end, *retval;
+	
+	g_return_val_if_fail (url != 0, g_strdup (""));
+	
+	scheme_end = index (url, ':');
+	if (scheme_end)	
+		scheme = g_strndup (url, scheme_end - url);
+	
+	if (scheme && !strcmp (scheme, "mailto"))
+		retval = g_strdup_printf (_("Click to mail %s"), scheme_end + 1);
+	else
+		retval = g_strdup_printf (_("Click to open %s"), url);
+	
+	g_free (scheme);
+	
+	return retval;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]