GDM API Change Request




Release Team:

Yesterday Sebastien Bacher proposed the following patch to GDM which
I think would be good to add to GDM for the 2.14 release, but it affects
API.  Since the API freeze has passed, I wanted to get permission to
add this change.  Note that this change just adds a new feature to
the GDM XML theme format, and doesn't break any existing interfaces
exposed.

This change adds a new button type to the GDM XML format called
"options_button" which brings up the same menu that you see when you
hit the F10 key in the GDM greeter program.  This menu offers all
the options that you normally see when you select the System,
Session, and Language Buttons

This allows themes to use the new options_button so the theme only
has a single button which allows access to all GDM options instead
of having three buttons.  GDM still supports the three button style,
so existing themes that use them will not be affected.

If the release team approves this change before Monday's UI freeze,
I intend to update the three themes that get installed with GDM
(circles, happygnome and happygnome-list) to use this new button
instead of the three buttons (if this is okay).

Can this change go in?

Thanks,

Brian

P.S.  The patch is pretty straightforward.  The menu_position_func
      just provides some logic to control where the menu appears so
      it will popup where the button is placed instead of always
      below the entry field.

=== 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-4;
+	*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)
@@ -396,6 +421,9 @@
 				   "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]