'Switch User' action



Hi

Attached is a patch that implements the 'Switch User' action, making
that show up both on the 'Actions' Menu, and on the 'Actions' applet
menu. It just misses an icon for it.

I don't know what people think about this, and if this is really enough
for fast user switching, but I wanted to send it to see what people
think.

If this goes in, I think gdmflexiserver should be changed to allow the
user to choose an already existing session from a nice and simple
dialog.

So, what do people think?

cheers
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/ChangeLog,v
retrieving revision 1.2293
diff -u -p -r1.2293 ChangeLog
--- ChangeLog	3 Dec 2003 17:46:13 -0000	1.2293
+++ ChangeLog	5 Dec 2003 17:03:49 -0000
@@ -1,3 +1,10 @@
+2003-12-05  Rodrigo Moya <rodrigo ximian com>
+
+	* menu.c:
+	* panel-action-button.[ch]:
+	* panel-enums.h:
+	* panel-menu-bar.c: Added 'Switch User' action.
+
 2003-12-03  Mark McLoughlin  <mark skynet ie>
 
 	Be a bit more paranoid about removing directories from
Index: menu.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/menu.c,v
retrieving revision 1.695
diff -u -p -r1.695 menu.c
--- menu.c	28 Nov 2003 08:59:28 -0000	1.695
+++ menu.c	5 Dec 2003 17:03:54 -0000
@@ -157,7 +157,17 @@ static AppletMenuInfo action_buttons_inf
 	  PANEL_ACTION_SEARCH,
 	  "ACTION:search:NEW",
 	  TRUE },
-	  
+	 
+	{ N_("Switch User"),
+	  N_("Actions"),
+	  "Actions",
+	  N_("Switch to a different user on your computer"),
+	  NULL,
+	  GTK_STOCK_JUMP_TO,
+	  PANEL_ACTION_SWITCH_USER,
+	  "ACTION:switchuser:NEW",
+	  TRUE },
+
 	{ N_("Run"),
 	  N_("Actions"),
 	  "Actions",
Index: panel-action-button.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-action-button.c,v
retrieving revision 1.20
diff -u -p -r1.20 panel-action-button.c
--- panel-action-button.c	13 Nov 2003 12:31:02 -0000	1.20
+++ panel-action-button.c	5 Dec 2003 17:03:55 -0000
@@ -71,6 +71,7 @@ static GConfEnumStringPair panel_action_
 	{ PANEL_ACTION_RUN,          "run"          },
 	{ PANEL_ACTION_SEARCH,       "search"       },
 	{ PANEL_ACTION_SCREENSHOT,   "screenshot"   },
+	{ PANEL_ACTION_SWITCH_USER,  "switch-user"  },
 	{ PANEL_ACTION_FORCE_QUIT,   "force-quit"   },
 };
 
@@ -188,6 +189,24 @@ panel_action_screenshot (GtkWidget *widg
 				    "gnome-panel-screenshot");
 }
 
+/* Switch User
+ */
+void
+panel_action_switch_user (GtkWidget *widget)
+{
+        GdkScreen *screen;
+	char      *argv [2] = {"gdmflexiserver", NULL};
+
+	screen = gtk_widget_get_screen (widget);
+
+	if (egg_screen_execute_async (screen, g_get_home_dir (), 1, argv) < 0)
+		panel_error_dialog (screen,
+				    "cannot_exec_gdmflexiserver",
+				    _("Cannot execute '%s'"),
+				    NULL,
+				    "gdmflexiserver");
+}
+
 /* Force Quit
  */
 static void
@@ -246,6 +265,11 @@ static PanelAction actions [] = {
 		panel_action_screenshot, NULL, NULL
 	},
 	{
+		PANEL_ACTION_SWITCH_USER, GTK_STOCK_JUMP_TO,
+		N_("Switch User"), "gospanel-565",
+		panel_action_switch_user, NULL, NULL
+	},
+	{
 		PANEL_ACTION_FORCE_QUIT, PANEL_STOCK_FORCE_QUIT,
 		N_("Force Quit"), "gospanel-563",
 		panel_action_force_quit, NULL, NULL
Index: panel-action-button.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-action-button.h,v
retrieving revision 1.4
diff -u -p -r1.4 panel-action-button.h
--- panel-action-button.h	26 May 2003 13:41:07 -0000	1.4
+++ panel-action-button.h	5 Dec 2003 17:03:55 -0000
@@ -91,6 +91,7 @@ void       panel_action_logout      (Gtk
 void       panel_action_run_program (GtkWidget *widget);
 void       panel_action_search      (GtkWidget *widget);
 void       panel_action_screenshot  (GtkWidget *widget);
+void       panel_action_switch_user (GtkWidget *widget);
 
 G_END_DECLS
 
Index: panel-enums.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-enums.h,v
retrieving revision 1.4
diff -u -p -r1.4 panel-enums.h
--- panel-enums.h	11 Jun 2003 10:54:49 -0000	1.4
+++ panel-enums.h	5 Dec 2003 17:03:55 -0000
@@ -93,6 +93,7 @@ typedef enum {
         PANEL_ACTION_RUN,
         PANEL_ACTION_SEARCH,
         PANEL_ACTION_SCREENSHOT,
+	PANEL_ACTION_SWITCH_USER,
 	PANEL_ACTION_FORCE_QUIT,
         PANEL_ACTION_LAST
 } PanelActionButtonType;
Index: panel-menu-bar.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-menu-bar.c,v
retrieving revision 1.24
diff -u -p -r1.24 panel-menu-bar.c
--- panel-menu-bar.c	13 Nov 2003 12:31:02 -0000	1.24
+++ panel-menu-bar.c	5 Dec 2003 17:03:55 -0000
@@ -159,6 +159,17 @@ panel_menu_bar_append_actions_menu (Pane
 	item = gtk_separator_menu_item_new ();
 	gtk_menu_shell_append (GTK_MENU_SHELL (menubar->priv->actions_menu), item);
 
+	if (panel_is_program_in_path ("gdmflexiserver")) {
+		panel_menu_bar_append_action_item (
+			menubar,
+			menubar->priv->actions_menu,
+			_("Switch User"),
+			GTK_STOCK_JUMP_TO,
+			_("Switch session to another user"),
+			"ACTION:switchuser:NEW",
+			G_CALLBACK (panel_action_switch_user));
+	}
+	
 	if (panel_is_program_in_path  ("xscreensaver"))
 		panel_menu_bar_append_action_item (
 			menubar,


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