gdm r6568 - in trunk: . gui/user-switch-applet
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6568 - in trunk: . gui/user-switch-applet
- Date: Tue, 14 Oct 2008 00:07:30 +0000 (UTC)
Author: mccann
Date: Tue Oct 14 00:07:30 2008
New Revision: 6568
URL: http://svn.gnome.org/viewvc/gdm?rev=6568&view=rev
Log:
2008-10-13 William Jon McCann <jmccann redhat com>
* gui/user-switch-applet/applet.c (on_control_panel_activate),
(create_sub_menu):
Add System Preferences menu item.
Modified:
trunk/ChangeLog
trunk/gui/user-switch-applet/applet.c
Modified: trunk/gui/user-switch-applet/applet.c
==============================================================================
--- trunk/gui/user-switch-applet/applet.c (original)
+++ trunk/gui/user-switch-applet/applet.c Tue Oct 14 00:07:30 2008
@@ -56,6 +56,7 @@
GtkWidget *menubar;
GtkWidget *menuitem;
GtkWidget *menu;
+ GtkWidget *control_panel_item;
GtkWidget *separator_item;
GtkWidget *lock_screen_item;
GtkWidget *login_screen_item;
@@ -757,6 +758,48 @@
}
static void
+on_control_panel_activate (GtkMenuItem *item,
+ gpointer data)
+{
+ char *args[2];
+ GError *error;
+ GdkScreen *screen;
+ gboolean res;
+ GdmAppletData *adata;
+
+ adata = data;
+
+ args[0] = g_find_program_in_path ("gnome-control-center");
+ if (args[0] == NULL) {
+ return;
+ }
+ args[1] = NULL;
+
+ if (gtk_widget_has_screen (GTK_WIDGET (adata->applet))) {
+ screen = gtk_widget_get_screen (GTK_WIDGET (adata->applet));
+ } else {
+ screen = gdk_screen_get_default ();
+ }
+
+ error = NULL;
+ res = gdk_spawn_on_screen (screen,
+ g_get_home_dir (),
+ args,
+ NULL,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ &error);
+ if (! res) {
+ g_warning (_("Can't lock screen: %s"), error->message);
+ g_error_free (error);
+ }
+
+ g_free (args[0]);
+}
+
+static void
on_lock_screen_activate (GtkMenuItem *item,
gpointer data)
{
@@ -783,8 +826,6 @@
static void
create_sub_menu (GdmAppletData *adata)
{
- GSList *users;
-
adata->menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (adata->menuitem), adata->menu);
g_signal_connect (adata->menu, "style-set",
@@ -806,6 +847,22 @@
G_CALLBACK (on_manager_user_added),
adata);
+
+ adata->control_panel_item = gtk_image_menu_item_new_with_label (_("System Preferences..."));
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->control_panel_item),
+ gtk_image_new ());
+ gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
+ adata->control_panel_item);
+ g_signal_connect (adata->control_panel_item, "style-set",
+ G_CALLBACK (menuitem_style_set_cb), adata);
+ g_signal_connect (adata->control_panel_item, "destroy",
+ G_CALLBACK (menuitem_destroy_cb), adata);
+ g_signal_connect (adata->control_panel_item, "activate",
+ G_CALLBACK (on_control_panel_activate), adata);
+ adata->items = g_slist_prepend (adata->items, adata->control_panel_item);
+ gtk_widget_show (adata->control_panel_item);
+
+
adata->separator_item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu), adata->separator_item);
g_signal_connect (adata->separator_item, "destroy",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]