Re: [evolution-patches] Show popup menu of e-source-selector with Shift+F10



Patch committed into HEAD with the suggested modifications.
Not Zed, thanks for the review.
    Harry

Not Zed wrote:

Looks fine.

i'd probably do it as

...
  gboolean res=FALSE;
...

  if (source) {
    emit event ( ... ... &res);
}

return res;

becuase fewer return paths make for simpler code, but it's simple enough anyway.
 
  On Fri, 2004-10-08 at 15:22 +0800, Harry Lu wrote:
Hi,
    Modified patch for HEAD is attached. Please review it.
    Thanks!
       Harry

Harry Lu wrote:
Hi,
   Attached is the patch for HEAD. Please review it.
   Thanks!
      Harry

text/plain attachment (popup_menu3.diff)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.327
diff -u -r1.327 ChangeLog
--- ChangeLog	6 Oct 2004 14:12:53 -0000	1.327
+++ ChangeLog	8 Oct 2004 07:16:13 -0000
@@ -1,3 +1,9 @@
+2004-10-08  Harry Lu  <harry lu sun com>
+
+	* e-source-selector.c: (e_source_selector_popup_menu),
+	(class_init): implement popup_menu so that popup menu can
+	be shown with Shift+F10.
+
 2004-10-06  JP Rosevear  <jpr novell com>
  
  	Fixes #66164
Index: e-source-selector.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-source-selector.c,v
retrieving revision 1.23
diff -u -r1.23 e-source-selector.c
--- e-source-selector.c	6 Oct 2004 03:22:01 -0000	1.23
+++ e-source-selector.c	8 Oct 2004 07:16:13 -0000
@@ -661,6 +661,24 @@
 	(* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
+static gboolean
+e_source_selector_popup_menu (GtkWidget *widget)
+{
+	ESourceSelector *selector = E_SOURCE_SELECTOR (widget);
+	ESource *source = e_source_selector_peek_primary_selection (selector);
+
+	if (source) {
+		gboolean res = FALSE;
+
+		g_object_ref (source);
+		g_signal_emit (selector, signals[POPUP_EVENT], 0, source, NULL, &res);
+		g_object_unref (source);
+
+		return res;
+	}
+
+	return FALSE;
+}
 
 /* Initialization.  */
 static gboolean
@@ -677,9 +695,12 @@
 class_init (ESourceSelectorClass *class)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (class);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
 	object_class->dispose  = impl_dispose;
 	object_class->finalize = impl_finalize;
+
+	widget_class->popup_menu = e_source_selector_popup_menu;
 
 	parent_class = g_type_class_peek_parent (class);
 
    
--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer


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