Re: [Fwd: Re: GDM API Change Request]



     A. Le vendredi 27 janvier 2006 à 15:32 -0800, Brian Cameron a
        écrit :
> Sebastien:
> 
> I went ahead and contacted the release team.  It is looking like I
> will get approval to include this patch in GNOME 2.14.  However,
> Federico has some issues with your patch.  Would you mind responding
> to him, and providing me with a version of the patch that addresses
> his comments? 

Hi,

(I'm not on that list so replying by Ccing people mentionned by the
forwarded mail)


> Please put spaces around equal signs and operators.

Patch updated with that


> You are moving the menu upward by its own height.  Why do you need to
> move it up another 4 pixels?

It was a hack to align the menu with the bar on the bottom. I've dropped
it with the patch update. Brian, do you know if we should use an another
setting that rect.y for it?


> This is horrible.  Can't you just use this instead:
> 
>    gtk_menu_shell_activate_item (menubar, first_menu_item_in_menubar, 
> FALSE);
> 
> ... or do you do that precisely because you need a position_func?  What
> happens if you don't use a position_func?

I do that to position the menu. The menubar is placed on the same place
as the user|password text entry on the canvas (so you don't have the
menubar on the canvas). Without that when you click on a label you get a
menu opened on the middle of the screen which is quite confusing. With
the place change it opens on top of the label where you clicked. 


--
Sebastien Bacher
=== modified file 'gui/greeter/greeter_canvas_item.c'
--- gui/greeter/greeter_canvas_item.c	
+++ gui/greeter/greeter_canvas_item.c	
@@ -200,6 +200,31 @@
 	c->blue = (rgb & 0xff) * 0x101;
 	c->pixel = 0;
 }
+
+static void
+menu_position_func (GtkMenu           *menu,
+                    int               *x,
+                    int               *y,
+                    gboolean          *push_in,
+                    GreeterItemInfo *item)
+{
+	GtkAllocation rect;
+	GtkRequisition  requisition;
+
+	rect = item->allocation; 
+	gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+	*x = rect.x;
+	*y = rect.y - requisition.height;
+	*push_in = TRUE;
+ }
+
+ static void
+ greeter_options_handler (GreeterItemInfo *item, GtkWidget *menubar)
+ {
+	 gtk_menu_popup (GTK_MENU(gtk_menu_item_get_submenu(gtk_container_get_children(GTK_CONTAINER(menubar))->data)), 
+			 NULL, NULL, (GtkMenuPositionFunc)menu_position_func, 
+			 item, 0, gtk_get_current_event_time());
+ }
 
 void
 greeter_item_create_canvas_item (GreeterItemInfo *item)
@@ -395,7 +420,11 @@
 				   "height", (double)rect.height,
 				   "width", (double)rect.width,
 				   NULL);
-
+	    
+	    greeter_item_register_action_callback ("options_button",
+						   (ActionFunc)greeter_options_handler,
+						   menubar);
+	    
 	    /* Here add a tooltip, so that the user knows about F10 */
 	    tooltips = gtk_tooltips_new ();
 	    gtk_tooltips_set_tip (tooltips, GTK_WIDGET (entry),

=== modified file 'gui/greeter/greeter_parser.c'
--- gui/greeter/greeter_parser.c	
+++ gui/greeter/greeter_parser.c	
@@ -1094,6 +1094,11 @@
         {
 	  g_free (*translated_text);
 	  *translated_text = g_strdup (_("_Configure"));
+	}
+      else if (g_ascii_strcasecmp ((char *) prop, "options") == 0)
+        {
+	  g_free (*translated_text);
+	  *translated_text = g_strdup (_("_Options"));
 	}
       else if (g_ascii_strcasecmp ((char *) prop, "caps-lock-warning") == 0)
         {



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