summaryrefslogtreecommitdiffstats
path: root/meta-gnome
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-06-21 12:50:56 +0200
committerKoen Kooi <koen@dominion.thruhere.net>2011-06-21 12:55:41 +0200
commit972778cee8ace679228e4763152aaee648101127 (patch)
tree7c07c0a495a4783d478bf0aebe3bb848f803021f /meta-gnome
parent31be11bf1c4c4529cb9010c87bc105693b939dcf (diff)
downloadmeta-openembedded-972778cee8ace679228e4763152aaee648101127.tar.gz
gdm: fix build against newer gnome-panel
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-gnome')
-rw-r--r--meta-gnome/recipes-gnome/gdm/gdm-2.32.2/0001-Remove-user-switch-applet.patch2281
-rw-r--r--meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb3
2 files changed, 2283 insertions, 1 deletions
diff --git a/meta-gnome/recipes-gnome/gdm/gdm-2.32.2/0001-Remove-user-switch-applet.patch b/meta-gnome/recipes-gnome/gdm/gdm-2.32.2/0001-Remove-user-switch-applet.patch
new file mode 100644
index 000000000..03f51c1e4
--- /dev/null
+++ b/meta-gnome/recipes-gnome/gdm/gdm-2.32.2/0001-Remove-user-switch-applet.patch
@@ -0,0 +1,2281 @@
1From 0a4fe802edbd2e8a016161f08283e4b467c6762e Mon Sep 17 00:00:00 2001
2From: Koen Kooi <koen@dominion.thruhere.net>
3Date: Tue, 21 Jun 2011 12:48:39 +0200
4Subject: [PATCH] Remove user switch applet
5
6This hasn't been updated to work with gnome-panel > 2.30.0, so just drop it
7
8Upstream-status: unacceptable, backport
9
10Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
11---
12 configure.ac | 8 -
13 gui/Makefile.am | 2 -
14 .../GNOME_FastUserSwitchApplet.server.in.in | 38 -
15 .../GNOME_FastUserSwitchApplet.xml | 20 -
16 gui/user-switch-applet/Makefile.am | 67 -
17 gui/user-switch-applet/applet.c | 1662 --------------------
18 gui/user-switch-applet/gdm-entry-menu-item.c | 304 ----
19 gui/user-switch-applet/gdm-entry-menu-item.h | 51 -
20 po/POTFILES.in | 4 -
21 po/POTFILES.skip | 1 -
22 10 files changed, 0 insertions(+), 2157 deletions(-)
23 delete mode 100644 gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
24 delete mode 100644 gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
25 delete mode 100644 gui/user-switch-applet/Makefile.am
26 delete mode 100644 gui/user-switch-applet/applet.c
27 delete mode 100644 gui/user-switch-applet/gdm-entry-menu-item.c
28 delete mode 100644 gui/user-switch-applet/gdm-entry-menu-item.h
29
30diff --git a/configure.ac b/configure.ac
31index 841efe0..a834110 100644
32--- a/configure.ac
33+++ b/configure.ac
34@@ -149,13 +149,6 @@ PKG_CHECK_MODULES(SIMPLE_CHOOSER,
35 AC_SUBST(SIMPLE_CHOOSER_CFLAGS)
36 AC_SUBST(SIMPLE_CHOOSER_LIBS)
37
38-PKG_CHECK_MODULES(APPLET,
39- dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
40- gtk+-2.0 >= $GTK_REQUIRED_VERSION
41- libpanelapplet-2.0 >= $GNOME_PANEL_REQUIRED_VERSION)
42-AC_SUBST(APPLET_CFLAGS)
43-AC_SUBST(APPLET_LIBS)
44-
45 PLUGIN_LIBTOOL_FLAGS="-export_dynamic -module -avoid-version"
46 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
47
48@@ -1340,7 +1333,6 @@ gui/Makefile
49 gui/simple-greeter/Makefile
50 gui/simple-greeter/libnotificationarea/Makefile
51 gui/simple-chooser/Makefile
52-gui/user-switch-applet/Makefile
53 utils/Makefile
54 data/gdm.conf
55 data/Makefile
56diff --git a/gui/Makefile.am b/gui/Makefile.am
57index 326239f..bda3f7a 100644
58--- a/gui/Makefile.am
59+++ b/gui/Makefile.am
60@@ -2,7 +2,6 @@ NULL =
61
62 SUBDIRS = \
63 simple-greeter \
64- user-switch-applet \
65 $(NULL)
66
67 if XDMCP_SUPPORT
68@@ -12,5 +11,4 @@ endif
69 DIST_SUBDIRS = \
70 simple-chooser \
71 simple-greeter \
72- user-switch-applet \
73 $(NULL)
74diff --git a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in b/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
75deleted file mode 100644
76index a9b775f..0000000
77--- a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
78+++ /dev/null
79@@ -1,38 +0,0 @@
80-<oaf_info>
81- <oaf_server iid="OAFIID:GNOME_FastUserSwitchApplet_Factory" type="exe"
82- location="@LIBEXECDIR@/gdm-user-switch-applet">
83-
84- <oaf_attribute name="repo_ids" type="stringv">
85- <item value="IDL:Bonobo/GenericFactory:1.0"/>
86- <item value="IDL:Bonobo/Unknown:1.0"/>
87- </oaf_attribute>
88- <oaf_attribute name="name" type="string" _value="User Switcher Applet Factory"/>
89- <oaf_attribute name="description" type="string" _value="User Switcher Applet Factory"/>
90- <oaf_attribute name="bonobo:environment" type="stringv">
91- <item value="DBUS_SESSION_BUS_ADDRESS"/>
92- <oaf_attribute name="bugzilla:bugzilla" type="string" value="GNOME"/>
93- <oaf_attribute name="bugzilla:product" type="string" value="gdm"/>
94- <oaf_attribute name="bugzilla:component" type="string" value="general"/>
95- <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/>
96- <oaf_attribute name="bugzilla:other_binaries" type="string" value="gdm-user-switch-applet"/>
97- </oaf_attribute>
98- </oaf_server>
99-
100- <oaf_server iid="OAFIID:GNOME_FastUserSwitchApplet" type="factory"
101- location="OAFIID:GNOME_FastUserSwitchApplet_Factory">
102-
103- <oaf_attribute name="repo_ids" type="stringv">
104- <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
105- <item value="IDL:Bonobo/Control:1.0"/>
106- <item value="IDL:Bonobo/Unknown:1.0"/>
107- </oaf_attribute>
108- <oaf_attribute name="name" type="string" _value="User Switcher"/>
109- <oaf_attribute name="description" type="string" _value="A menu to quickly switch between users"/>
110- <oaf_attribute name="panel:icon" type="string" value="stock_people"/>
111- <oaf_attribute name="bugzilla:bugzilla" type="string" value="GNOME"/>
112- <oaf_attribute name="bugzilla:product" type="string" value="gdm"/>
113- <oaf_attribute name="bugzilla:component" type="string" value="general"/>
114- <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/>
115- <oaf_attribute name="bugzilla:other_binaries" type="string" value="gdm-user-switch-applet"/>
116- </oaf_server>
117-</oaf_info>
118diff --git a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml b/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
119deleted file mode 100644
120index e1845c8..0000000
121--- a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
122+++ /dev/null
123@@ -1,20 +0,0 @@
124-<Root>
125- <popups>
126- <popup name="button3">
127- <menuitem
128- name="About Me Item"
129- verb="GdmAboutMe"
130- _label="Edit Personal _Information"/>
131- <menuitem
132- name="Users and Groups Admin Item"
133- verb="GdmUsersGroupsAdmin"
134- _label="_Edit Users and Groups"/>
135- <menuitem
136- name="About Item"
137- verb="GdmAbout"
138- _label="_About"
139- pixtype="stock"
140- pixname="gtk-about"/>
141- </popup>
142- </popups>
143-</Root>
144diff --git a/gui/user-switch-applet/Makefile.am b/gui/user-switch-applet/Makefile.am
145deleted file mode 100644
146index 2d2cdc0..0000000
147--- a/gui/user-switch-applet/Makefile.am
148+++ /dev/null
149@@ -1,67 +0,0 @@
150-NULL =
151-
152-AM_CPPFLAGS = \
153- -I$(top_srcdir)/gui/simple-greeter \
154- -I$(top_srcdir)/common \
155- -DPREFIX=\""$(prefix)"\" \
156- -DLIBDIR=\""$(libdir)"\" \
157- -DDATADIR=\""$(datadir)"\" \
158- -DSYSCONFDIR=\""$(sysconfdir)"\" \
159- -DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
160- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
161- -DGLADEDIR=\""$(pkgdatadir)"\" \
162- -DLIBEXECDIR=\""$(libexecdir)"\" \
163- -DSBINDIR=\""$(sbindir)"\" \
164- -DGDMCONFDIR=\"$(gdmconfdir)\" \
165- $(GTK_CFLAGS) \
166- $(APPLET_CFLAGS) \
167- $(NULL)
168-
169-libexec_PROGRAMS = \
170- gdm-user-switch-applet \
171- $(NULL)
172-
173-gdm_user_switch_applet_SOURCES = \
174- applet.c \
175- gdm-entry-menu-item.h \
176- gdm-entry-menu-item.c \
177- $(NULL)
178-
179-gdm_user_switch_applet_LDADD = \
180- $(top_builddir)/gui/simple-greeter/libgdmuser.la \
181- $(top_builddir)/common/libgdmcommon.la \
182- $(COMMON_LIBS) \
183- $(APPLET_LIBS) \
184- $(NULL)
185-
186-# Bonobo UI
187-uidir = $(datadir)/gnome-2.0/ui
188-ui_DATA = \
189- GNOME_FastUserSwitchApplet.xml \
190- $(NULL)
191-
192-# Bonobo .server
193-serverdir = $(libdir)/bonobo/servers
194-server_in_files = \
195- GNOME_FastUserSwitchApplet.server.in \
196- $(NULL)
197-server_DATA = $(server_in_files:.server.in=.server)
198-
199-$(server_in_files): $(server_in_files:.server.in=.server.in.in)
200- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@
201-
202-@INTLTOOL_SERVER_RULE@
203-
204-EXTRA_DIST = \
205- $(ui_DATA) \
206- GNOME_FastUserSwitchApplet.server.in.in \
207- $(NULL)
208-
209-DISTCLEANFILES = \
210- $(server_in_files) \
211- $(server_DATA) \
212- $(NULL)
213-
214-MAINTAINERCLEANFILES = \
215- *~ \
216- Makefile.in
217diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
218deleted file mode 100644
219index b4f944c..0000000
220--- a/gui/user-switch-applet/applet.c
221+++ /dev/null
222@@ -1,1662 +0,0 @@
223-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
224- *
225- * Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
226- * Copyright (C) 2008 Red Hat, Inc.
227- *
228- * This program is free software; you can redistribute it and/or modify
229- * it under the terms of the GNU General Public License as published by
230- * the Free Software Foundation; either version 2 of the License, or
231- * (at your option) any later version.
232- *
233- * This program is distributed in the hope that it will be useful,
234- * but WITHOUT ANY WARRANTY; without even the implied warranty of
235- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236- * GNU General Public License for more details.
237- *
238- * You should have received a copy of the GNU General Public License
239- * along with this program; if not, write to the Free Software
240- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
241- */
242-
243-#include "config.h"
244-
245-#include <string.h>
246-#include <unistd.h>
247-#include <stdlib.h>
248-#include <sys/types.h>
249-
250-#include <glib/gi18n.h>
251-#include <gdk/gdkkeysyms.h>
252-#include <gtk/gtk.h>
253-
254-#include <gconf/gconf.h>
255-#include <gconf/gconf-client.h>
256-
257-#include <dbus/dbus-glib.h>
258-
259-#include <bonobo/bonobo-main.h>
260-#include <bonobo/bonobo-ui-util.h>
261-
262-#include <panel-applet.h>
263-#include <panel-applet-gconf.h>
264-
265-#include "gdm-user-manager.h"
266-#include "gdm-entry-menu-item.h"
267-#include "gdm-settings-client.h"
268-
269-#define LOCKDOWN_DIR "/desktop/gnome/lockdown"
270-#define LOCKDOWN_USER_SWITCHING_KEY LOCKDOWN_DIR "/disable_user_switching"
271-#define LOCKDOWN_LOCK_SCREEN_KEY LOCKDOWN_DIR "/disable_lock_screen"
272-#define LOCKDOWN_COMMAND_LINE_KEY LOCKDOWN_DIR "/disable_command_line"
273-
274-typedef enum {
275- GSM_PRESENCE_STATUS_AVAILABLE = 0,
276- GSM_PRESENCE_STATUS_INVISIBLE,
277- GSM_PRESENCE_STATUS_BUSY,
278- GSM_PRESENCE_STATUS_IDLE,
279-} GsmPresenceStatus;
280-
281-typedef struct _GdmAppletData
282-{
283- PanelApplet *applet;
284-
285- GConfClient *client;
286- GdmUserManager *manager;
287- GdmUser *user;
288-
289- GtkWidget *menubar;
290- GtkWidget *menuitem;
291- GtkWidget *menu;
292-#ifdef BUILD_PRESENSE_STUFF
293- GtkWidget *user_item;
294-#endif
295- GtkWidget *control_panel_item;
296- GtkWidget *account_item;
297- GtkWidget *lock_screen_item;
298- GtkWidget *login_screen_item;
299- GtkWidget *quit_session_item;
300-
301- guint client_notify_lockdown_id;
302-
303- guint current_status;
304- guint user_loaded_notify_id;
305- guint user_changed_notify_id;
306- gint8 pixel_size;
307- gint panel_size;
308- GtkIconSize icon_size;
309-#ifdef BUILD_PRESENSE_STUFF
310- DBusGProxy *presence_proxy;
311-#endif
312-} GdmAppletData;
313-
314-typedef struct _SelectorResponseData
315-{
316- GdmAppletData *adata;
317- GtkRadioButton *radio;
318-} SelectorResponseData;
319-
320-static void reset_icon (GdmAppletData *adata);
321-static void update_label (GdmAppletData *adata);
322-
323-static gboolean applet_factory (PanelApplet *applet,
324- const char *iid,
325- gpointer data);
326-
327-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory",
328- PANEL_TYPE_APPLET,
329- "gdm-user-switch-applet", "0",
330- (PanelAppletFactoryCallback)applet_factory,
331- NULL)
332-
333-static void
334-about_me_cb (BonoboUIComponent *ui_container,
335- gpointer data,
336- const char *cname)
337-{
338- GError *err;
339-
340- err = NULL;
341- if (! g_spawn_command_line_async ("gnome-about-me", &err)) {
342- g_critical ("Could not run `gnome-about-me': %s",
343- err->message);
344- g_error_free (err);
345- bonobo_ui_component_set_prop (ui_container,
346- "/commands/GdmAboutMe",
347- "hidden", "1",
348- NULL);
349- }
350-}
351-
352-/*
353- * gnome-panel/applets/wncklet/window-menu.c:window_filter_button_press()
354- *
355- * Copyright (C) 2005 James M. Cape.
356- * Copyright (C) 2003 Sun Microsystems, Inc.
357- * Copyright (C) 2001 Free Software Foundation, Inc.
358- * Copyright (C) 2000 Helix Code, Inc.
359- */
360-static gboolean
361-menubar_button_press_event_cb (GtkWidget *menubar,
362- GdkEventButton *event,
363- GdmAppletData *adata)
364-{
365- if (event->button != 1) {
366- g_signal_stop_emission_by_name (menubar, "button-press-event");
367- /* Reset the login window item */
368- }
369-
370- return FALSE;
371-}
372-
373-static void
374-about_cb (BonoboUIComponent *ui_container,
375- gpointer data,
376- const char *cname)
377-{
378- static const char *authors[] = {
379- "James M. Cape <jcape@ignore-your.tv>",
380- "Thomas Thurman <thomas@thurman.org.uk>",
381- "William Jon McCann <jmccann@redhat.com>",
382- NULL
383- };
384- static char *license[] = {
385- N_("The User Switch Applet is free software; you can redistribute it and/or modify "
386- "it under the terms of the GNU General Public License as published by "
387- "the Free Software Foundation; either version 2 of the License, or "
388- "(at your option) any later version."),
389- N_("This program is distributed in the hope that it will be useful, "
390- "but WITHOUT ANY WARRANTY; without even the implied warranty of "
391- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
392- "GNU General Public License for more details."),
393- N_("You should have received a copy of the GNU General Public License "
394- "along with this program; if not, write to the Free Software "
395- "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA "),
396- NULL
397- };
398- char *license_i18n;
399-
400- license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
401-
402- gtk_show_about_dialog (NULL,
403- "version", VERSION,
404- "copyright", "Copyright \xc2\xa9 2004-2005 James M. Cape.\n"
405- "Copyright \xc2\xa9 2006 Thomas Thurman.\n"
406- "Copyright \xc2\xa9 2008 Red Hat, Inc.",
407- "comments", _("A menu to quickly switch between users."),
408- "authors", authors,
409- "license", license_i18n,
410- "wrap-license", TRUE,
411- "translator-credits", _("translator-credits"),
412- "logo-icon-name", "stock_people",
413- NULL);
414-
415- g_free (license_i18n);
416-}
417-
418-
419-static void
420-admin_cb (BonoboUIComponent *ui_container,
421- gpointer data,
422- const char *cname)
423-{
424-#ifdef USERS_ADMIN
425- char **args;
426- gboolean res;
427- GError *err;
428-
429- err = NULL;
430- if (!g_shell_parse_argv (USERS_ADMIN, NULL, &args, &err)) {
431- g_critical ("Could not parse users and groups management command line `%s': %s",
432- USERS_ADMIN, err->message);
433- return;
434- }
435-
436- res = g_spawn_async (g_get_home_dir (),
437- args,
438- NULL,
439- (G_SPAWN_STDOUT_TO_DEV_NULL |
440- G_SPAWN_STDERR_TO_DEV_NULL |
441- G_SPAWN_SEARCH_PATH),
442- NULL,
443- NULL,
444- NULL,
445- &err);
446- if (! res) {
447- g_critical ("Could not run `%s' to manage users and groups: %s",
448- USERS_ADMIN, err->message);
449- g_error_free (err);
450- }
451- g_strfreev (args);
452-#endif /* USERS_ADMIN */
453-}
454-
455-static void
456-set_menuitem_icon (BonoboUIComponent *component,
457- const char *item_path,
458- GtkIconTheme *theme,
459- const char *icon_name,
460- gint icon_size)
461-{
462- GdkPixbuf *pixbuf;
463- int width;
464- int height;
465-
466- pixbuf = gtk_icon_theme_load_icon (theme, icon_name, icon_size, 0, NULL);
467- if (pixbuf == NULL) {
468- return;
469- }
470-
471- width = gdk_pixbuf_get_width (pixbuf);
472- height = gdk_pixbuf_get_height (pixbuf);
473- if (width > icon_size + 4 || height > icon_size + 4) {
474- GdkPixbuf *tmp;
475- if (height > width) {
476- width *= (gdouble) icon_size / (gdouble) height;
477- height = icon_size;
478- } else {
479- height *= (gdouble) icon_size / (gdouble) width;
480- width = icon_size;
481- }
482- tmp = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
483- g_object_unref (pixbuf);
484- pixbuf = tmp;
485- }
486-
487- bonobo_ui_util_set_pixbuf (component, item_path, pixbuf, NULL);
488- g_object_unref (pixbuf);
489-}
490-
491-static void
492-applet_style_set_cb (GtkWidget *widget,
493- GtkStyle *old_style,
494- gpointer data)
495-{
496- BonoboUIComponent *component;
497- GdkScreen *screen;
498- GtkIconTheme *theme;
499- int width;
500- int height;
501- int icon_size;
502-
503- if (gtk_widget_has_screen (widget)) {
504- screen = gtk_widget_get_screen (widget);
505- } else {
506- screen = gdk_screen_get_default ();
507- }
508-
509- if (gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
510- GTK_ICON_SIZE_MENU, &width, &height)) {
511- icon_size = MAX (width, height);
512- } else {
513- icon_size = 16;
514- }
515-
516- theme = gtk_icon_theme_get_for_screen (screen);
517- component = panel_applet_get_popup_component (PANEL_APPLET (widget));
518-
519- set_menuitem_icon (component,
520- "/commands/GdmAboutMe",
521- theme,
522- "user-info",
523- icon_size);
524- set_menuitem_icon (component,
525- "/commands/GdmUsersGroupsAdmin",
526- theme,
527- "stock_people",
528- icon_size);
529-}
530-
531-static void
532-applet_change_background_cb (PanelApplet *applet,
533- PanelAppletBackgroundType type,
534- GdkColor *color,
535- GdkPixmap *pixmap,
536- GdmAppletData *adata)
537-{
538- GtkRcStyle *rc_style;
539- GtkStyle *style;
540-
541- gtk_widget_set_style (adata->menubar, NULL);
542- rc_style = gtk_rc_style_new ();
543- gtk_widget_modify_style (GTK_WIDGET (adata->menubar), rc_style);
544- g_object_unref (rc_style);
545-
546- switch (type) {
547- case PANEL_NO_BACKGROUND:
548- break;
549- case PANEL_COLOR_BACKGROUND:
550- gtk_widget_modify_bg (adata->menubar, GTK_STATE_NORMAL, color);
551- break;
552- case PANEL_PIXMAP_BACKGROUND:
553- style = gtk_style_copy (gtk_widget_get_style (adata->menubar));
554- if (style->bg_pixmap[GTK_STATE_NORMAL]) {
555- g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
556- }
557-
558- style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
559- gtk_widget_set_style (adata->menubar, style);
560- g_object_unref (style);
561- break;
562- }
563-}
564-
565-/*
566- * gnome-panel/applets/wncklet/window-menu.c:window_menu_key_press_event()
567- *
568- * Copyright (C) 2003 Sun Microsystems, Inc.
569- * Copyright (C) 2001 Free Software Foundation, Inc.
570- * Copyright (C) 2000 Helix Code, Inc.
571- */
572-static gboolean
573-applet_key_press_event_cb (GtkWidget *widget,
574- GdkEventKey *event,
575- GdmAppletData *adata)
576-{
577- GtkMenuShell *menu_shell;
578-
579- switch (event->keyval) {
580- case GDK_KP_Enter:
581- case GDK_ISO_Enter:
582- case GDK_3270_Enter:
583- case GDK_Return:
584- case GDK_space:
585- case GDK_KP_Space:
586- menu_shell = GTK_MENU_SHELL (adata->menubar);
587- /*
588- * We need to call _gtk_menu_shell_activate() here as is done in
589- * window_key_press_handler in gtkmenubar.c which pops up menu
590- * when F10 is pressed.
591- *
592- * As that function is private its code is replicated here.
593- */
594- if (!menu_shell->active) {
595- gtk_grab_add (GTK_WIDGET (menu_shell));
596- menu_shell->have_grab = TRUE;
597- menu_shell->active = TRUE;
598- }
599-
600- gtk_menu_shell_select_first (menu_shell, FALSE);
601- return TRUE;
602- default:
603- break;
604- }
605-
606- return FALSE;
607-}
608-
609-static void
610-set_item_text_angle_and_alignment (GtkWidget *item,
611- double text_angle,
612- float xalign,
613- float yalign)
614-{
615- GtkWidget *label;
616-
617- label = gtk_bin_get_child (GTK_BIN (item));
618-
619- gtk_label_set_angle (GTK_LABEL (label), text_angle);
620-
621- gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
622-}
623-
624-/*
625- * gnome-panel/applets/wncklet/window-menu.c:window_menu_size_allocate()
626- *
627- * Copyright (C) 2003 Sun Microsystems, Inc.
628- * Copyright (C) 2001 Free Software Foundation, Inc.
629- * Copyright (C) 2000 Helix Code, Inc.
630- */
631-static void
632-applet_size_allocate_cb (GtkWidget *widget,
633- GtkAllocation *allocation,
634- GdmAppletData *adata)
635-{
636- GList *children;
637- GtkWidget *top_item;
638- PanelAppletOrient orient;
639- gint pixel_size;
640- gdouble text_angle;
641- GtkPackDirection pack_direction;
642- float text_xalign;
643- float text_yalign;
644-
645- pack_direction = GTK_PACK_DIRECTION_LTR;
646- text_angle = 0.0;
647- text_xalign = 0.0;
648- text_yalign = 0.5;
649-
650- children = gtk_container_get_children (GTK_CONTAINER (adata->menubar));
651- top_item = GTK_WIDGET (children->data);
652- g_list_free (children);
653-
654- orient = panel_applet_get_orient (PANEL_APPLET (widget));
655-
656- switch (orient) {
657- case PANEL_APPLET_ORIENT_UP:
658- case PANEL_APPLET_ORIENT_DOWN:
659- gtk_widget_set_size_request (top_item, -1, allocation->height);
660- pixel_size = allocation->height - gtk_widget_get_style (top_item)->ythickness * 2;
661- break;
662- case PANEL_APPLET_ORIENT_LEFT:
663- gtk_widget_set_size_request (top_item, allocation->width, -1);
664- pixel_size = allocation->width - gtk_widget_get_style (top_item)->xthickness * 2;
665- pack_direction = GTK_PACK_DIRECTION_TTB;
666- text_angle = 270.0;
667- text_xalign = 0.5;
668- text_yalign = 0.0;
669- break;
670- case PANEL_APPLET_ORIENT_RIGHT:
671- gtk_widget_set_size_request (top_item, allocation->width, -1);
672- pixel_size = allocation->width - gtk_widget_get_style (top_item)->xthickness * 2;
673- pack_direction = GTK_PACK_DIRECTION_BTT;
674- text_angle = 90.0;
675- text_xalign = 0.5;
676- text_yalign = 0.0;
677- break;
678- default:
679- g_assert_not_reached ();
680- break;
681- }
682-
683- gtk_menu_bar_set_pack_direction (GTK_MENU_BAR (adata->menubar),
684- pack_direction);
685- gtk_menu_bar_set_child_pack_direction (GTK_MENU_BAR (adata->menubar),
686- pack_direction);
687-
688- set_item_text_angle_and_alignment (adata->menuitem,
689- text_angle,
690- text_xalign,
691- text_yalign);
692-
693- if (adata->panel_size != pixel_size) {
694- adata->panel_size = pixel_size;
695- reset_icon (adata);
696- }
697-}
698-
699-
700-static void
701-gdm_applet_data_free (GdmAppletData *adata)
702-{
703- gconf_client_notify_remove (adata->client, adata->client_notify_lockdown_id);
704-
705- if (adata->user_loaded_notify_id != 0) {
706- g_signal_handler_disconnect (adata->user, adata->user_loaded_notify_id);
707- }
708-
709- if (adata->user_changed_notify_id != 0) {
710- g_signal_handler_disconnect (adata->user, adata->user_changed_notify_id);
711- }
712-
713-#ifdef BUILD_PRESENSE_STUFF
714- if (adata->presence_proxy != NULL) {
715- g_object_unref (adata->presence_proxy);
716- }
717-#endif
718-
719- if (adata->user != NULL) {
720- g_object_unref (adata->user);
721- }
722- g_object_unref (adata->client);
723- g_object_unref (adata->manager);
724-
725- g_free (adata);
726-}
727-
728-
729-/*
730- * gnome-panel/applets/wncklet/window-menu.c:window_menu_on_expose()
731- *
732- * Copyright (C) 2003 Sun Microsystems, Inc.
733- * Copyright (C) 2001 Free Software Foundation, Inc.
734- * Copyright (C) 2000 Helix Code, Inc.
735- */
736-static gboolean
737-menubar_expose_event_cb (GtkWidget *widget,
738- GdkEventExpose *event,
739- GdmAppletData *adata)
740-{
741- if (gtk_widget_has_focus (GTK_WIDGET (adata->applet)))
742- gtk_paint_focus (gtk_widget_get_style (widget),
743- gtk_widget_get_window (widget),
744- gtk_widget_get_state (widget),
745- NULL, widget, "menu-applet", 0, 0, -1, -1);
746-
747- return FALSE;
748-}
749-
750-static void
751-menu_style_set_cb (GtkWidget *menu,
752- GtkStyle *old_style,
753- GdmAppletData *adata)
754-{
755- GtkSettings *settings;
756- int width;
757- int height;
758-
759- adata->icon_size = gtk_icon_size_from_name ("panel-menu");
760-
761- if (adata->icon_size == GTK_ICON_SIZE_INVALID) {
762- adata->icon_size = gtk_icon_size_register ("panel-menu", 24, 24);
763- }
764-
765- if (gtk_widget_has_screen (menu)) {
766- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (menu));
767- } else {
768- settings = gtk_settings_get_default ();
769- }
770-
771- if (!gtk_icon_size_lookup_for_settings (settings, adata->icon_size,
772- &width, &height)) {
773- adata->pixel_size = -1;
774- } else {
775- adata->pixel_size = MAX (width, height);
776- }
777-}
778-
779-static void
780-menuitem_style_set_cb (GtkWidget *menuitem,
781- GtkStyle *old_style,
782- GdmAppletData *adata)
783-{
784- GtkWidget *image;
785-
786- if (GDM_IS_ENTRY_MENU_ITEM (menuitem)) {
787- } else {
788- const char *icon_name;
789-
790- if (menuitem == adata->login_screen_item) {
791- icon_name = "system-users";
792- } else if (menuitem == adata->lock_screen_item) {
793- icon_name = "system-lock-screen";
794- } else if (menuitem == adata->quit_session_item) {
795- icon_name = "system-log-out";
796- } else if (menuitem == adata->account_item) {
797- icon_name = "user-info";
798- } else if (menuitem == adata->control_panel_item) {
799- icon_name = "preferences-desktop";
800- } else {
801- icon_name = GTK_STOCK_MISSING_IMAGE;
802- }
803-
804- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (menuitem));
805- gtk_image_set_pixel_size (GTK_IMAGE (image), adata->pixel_size);
806- gtk_image_set_from_icon_name (GTK_IMAGE (image), icon_name,
807- adata->icon_size);
808- }
809-}
810-
811-static void
812-on_user_changed (GdmUser *user,
813- GdmAppletData *adata)
814-{
815- g_debug ("user changed");
816- update_label (adata);
817- reset_icon (adata);
818-}
819-
820-/* Called every time the menu is displayed (and also for some reason
821- * immediately it's created, which does no harm). All we have to do
822- * here is kick off a request to GDM to let us know which users are
823- * logged in, so we can display check marks next to their names.
824- */
825-static gboolean
826-menu_expose_cb (GtkWidget *menu,
827- gpointer data)
828-{
829- char *program;
830- GdmAppletData *adata = data;
831-
832- program = g_find_program_in_path ("gnome-control-center");
833- if (program != NULL) {
834- gtk_widget_show (adata->control_panel_item);
835- } else {
836- gtk_widget_hide (adata->control_panel_item);
837- }
838- g_free (program);
839- return FALSE;
840-}
841-
842-static void
843-maybe_lock_screen (GdmAppletData *adata)
844-{
845- char *args[3];
846- GError *err;
847- GdkScreen *screen;
848- gboolean use_gscreensaver = TRUE;
849- gboolean res;
850-
851- g_debug ("Attempting to lock screen");
852-
853- args[0] = g_find_program_in_path ("gnome-screensaver-command");
854- if (args[0] == NULL) {
855- args[0] = g_find_program_in_path ("xscreensaver-command");
856- use_gscreensaver = FALSE;
857- }
858-
859- if (args[0] == NULL) {
860- return;
861- }
862-
863- if (use_gscreensaver) {
864- args[1] = "--lock";
865- } else {
866- args[1] = "-lock";
867- }
868- args[2] = NULL;
869-
870- if (gtk_widget_has_screen (GTK_WIDGET (adata->applet))) {
871- screen = gtk_widget_get_screen (GTK_WIDGET (adata->applet));
872- } else {
873- screen = gdk_screen_get_default ();
874- }
875-
876- err = NULL;
877- res = gdk_spawn_on_screen (screen,
878- g_get_home_dir (),
879- args,
880- NULL,
881- 0,
882- NULL,
883- NULL,
884- NULL,
885- &err);
886- if (! res) {
887- g_warning (_("Can't lock screen: %s"), err->message);
888- g_error_free (err);
889- }
890-
891- if (use_gscreensaver) {
892- args[1] = "--throttle";
893- } else {
894- args[1] = "-throttle";
895- }
896-
897- err = NULL;
898- res = gdk_spawn_on_screen (screen,
899- g_get_home_dir (),
900- args,
901- NULL,
902- (G_SPAWN_STDERR_TO_DEV_NULL
903- | G_SPAWN_STDOUT_TO_DEV_NULL),
904- NULL,
905- NULL,
906- NULL,
907- &err);
908- if (! res) {
909- g_warning (_("Can't temporarily set screensaver to blank screen: %s"),
910- err->message);
911- g_error_free (err);
912- }
913-
914- g_free (args[0]);
915-}
916-
917-static void
918-do_switch (GdmAppletData *adata,
919- GdmUser *user)
920-{
921- guint num_sessions;
922-
923- g_debug ("Do user switch");
924-
925- if (user == NULL) {
926- gdm_user_manager_goto_login_session (adata->manager);
927- goto out;
928- }
929-
930- num_sessions = gdm_user_get_num_sessions (user);
931- if (num_sessions > 0) {
932- gdm_user_manager_activate_user_session (adata->manager, user);
933- } else {
934- gdm_user_manager_goto_login_session (adata->manager);
935- }
936- out:
937- maybe_lock_screen (adata);
938-}
939-
940-static void
941-update_switch_user (GdmAppletData *adata)
942-{
943- gboolean can_switch;
944- gboolean has_other_users;
945-
946- can_switch = gdm_user_manager_can_switch (adata->manager);
947- g_object_get (adata->manager,
948- "has-multiple-users", &has_other_users,
949- NULL);
950-
951- if (can_switch && has_other_users) {
952- gtk_widget_show (adata->login_screen_item);
953- } else {
954-
955- gtk_widget_hide (adata->login_screen_item);
956- }
957-}
958-
959-static void
960-on_manager_is_loaded_changed (GdmUserManager *manager,
961- GParamSpec *pspec,
962- GdmAppletData *adata)
963-{
964- update_switch_user (adata);
965-}
966-
967-static void
968-on_manager_has_multiple_users_changed (GdmUserManager *manager,
969- GParamSpec *pspec,
970- GdmAppletData *adata)
971-{
972- update_switch_user (adata);
973-}
974-
975-#ifdef BUILD_PRESENSE_STUFF
976-static void
977-on_user_item_activate (GtkMenuItem *item,
978- GdmAppletData *adata)
979-{
980- g_signal_stop_emission_by_name (item, "activate");
981-}
982-#endif
983-
984-static void
985-on_control_panel_activate (GtkMenuItem *item,
986- GdmAppletData *adata)
987-{
988- char *args[2];
989- GError *error;
990- GdkScreen *screen;
991- gboolean res;
992-
993- args[0] = g_find_program_in_path ("gnome-control-center");
994- if (args[0] == NULL) {
995- return;
996- }
997- args[1] = NULL;
998-
999- if (gtk_widget_has_screen (GTK_WIDGET (adata->applet))) {
1000- screen = gtk_widget_get_screen (GTK_WIDGET (adata->applet));
1001- } else {
1002- screen = gdk_screen_get_default ();
1003- }
1004-
1005- error = NULL;
1006- res = gdk_spawn_on_screen (screen,
1007- g_get_home_dir (),
1008- args,
1009- NULL,
1010- 0,
1011- NULL,
1012- NULL,
1013- NULL,
1014- &error);
1015- if (! res) {
1016- g_warning (_("Can't lock screen: %s"), error->message);
1017- g_error_free (error);
1018- }
1019-
1020- g_free (args[0]);
1021-}
1022-
1023-static void
1024-on_account_activate (GtkMenuItem *item,
1025- GdmAppletData *adata)
1026-{
1027- char *args[2];
1028- GError *error;
1029- GdkScreen *screen;
1030- gboolean res;
1031-
1032- args[0] = g_find_program_in_path ("accounts-dialog");
1033- if (args[0] == NULL) {
1034- args[0] = g_find_program_in_path ("gnome-about-me");
1035- if (args[0] == NULL) {
1036- return;
1037- }
1038- }
1039- args[1] = NULL;
1040-
1041- if (gtk_widget_has_screen (GTK_WIDGET (adata->applet))) {
1042- screen = gtk_widget_get_screen (GTK_WIDGET (adata->applet));
1043- } else {
1044- screen = gdk_screen_get_default ();
1045- }
1046-
1047- error = NULL;
1048- res = gdk_spawn_on_screen (screen,
1049- g_get_home_dir (),
1050- args,
1051- NULL,
1052- 0,
1053- NULL,
1054- NULL,
1055- NULL,
1056- &error);
1057- if (! res) {
1058- g_warning (_("Can't lock screen: %s"), error->message);
1059- g_error_free (error);
1060- }
1061-
1062- g_free (args[0]);
1063-}
1064-
1065-static void
1066-on_lock_screen_activate (GtkMenuItem *item,
1067- GdmAppletData *adata)
1068-{
1069- maybe_lock_screen (adata);
1070-}
1071-
1072-static void
1073-on_login_screen_activate (GtkMenuItem *item,
1074- GdmAppletData *adata)
1075-{
1076- GdmUser *user;
1077-
1078- user = NULL;
1079-
1080- do_switch (adata, user);
1081-}
1082-
1083-static void
1084-on_quit_session_activate (GtkMenuItem *item,
1085- GdmAppletData *adata)
1086-{
1087- char *args[3];
1088- GError *error;
1089- GdkScreen *screen;
1090- gboolean res;
1091-
1092- args[0] = g_find_program_in_path ("gnome-session-save");
1093- if (args[0] == NULL) {
1094- return;
1095- }
1096-
1097- args[1] = "--logout-dialog";
1098- args[2] = NULL;
1099-
1100- if (gtk_widget_has_screen (GTK_WIDGET (adata->applet))) {
1101- screen = gtk_widget_get_screen (GTK_WIDGET (adata->applet));
1102- } else {
1103- screen = gdk_screen_get_default ();
1104- }
1105-
1106- error = NULL;
1107- res = gdk_spawn_on_screen (screen,
1108- g_get_home_dir (),
1109- args,
1110- NULL,
1111- 0,
1112- NULL,
1113- NULL,
1114- NULL,
1115- &error);
1116- if (! res) {
1117- g_warning (_("Can't log out: %s"), error->message);
1118- g_error_free (error);
1119- }
1120-
1121- g_free (args[0]);
1122-}
1123-
1124-#ifdef BUILD_PRESENSE_STUFF
1125-static gboolean
1126-on_menu_key_press_event (GtkWidget *widget,
1127- GdkEventKey *event,
1128- GdmAppletData *adata)
1129-{
1130- GtkWidget *entry;
1131-
1132- entry = gdm_entry_menu_item_get_entry (GDM_ENTRY_MENU_ITEM (adata->user_item));
1133-
1134- if (GTK_WIDGET_HAS_FOCUS (entry)) {
1135- gtk_widget_event (entry, (GdkEvent *)event);
1136- return TRUE;
1137- } else {
1138- return FALSE;
1139- }
1140-}
1141-
1142-static void
1143-save_status (GdmAppletData *adata,
1144- guint status)
1145-{
1146- if (adata->current_status != status) {
1147- GError *error;
1148-
1149- adata->current_status = status;
1150-
1151- g_debug ("Saving status: %u", status);
1152- error = NULL;
1153- dbus_g_proxy_call (adata->presence_proxy,
1154- "SetStatus",
1155- &error,
1156- G_TYPE_UINT, status,
1157- G_TYPE_INVALID,
1158- G_TYPE_INVALID);
1159-
1160- if (error != NULL) {
1161- g_warning ("Couldn't save presence status: %s", error->message);
1162- g_error_free (error);
1163- }
1164- }
1165-}
1166-
1167-static void
1168-on_status_available_activate (GtkWidget *widget,
1169- GdmAppletData *adata)
1170-{
1171-
1172- if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
1173- save_status (adata, GSM_PRESENCE_STATUS_AVAILABLE);
1174- }
1175-}
1176-
1177-static void
1178-on_status_busy_activate (GtkWidget *widget,
1179- GdmAppletData *adata)
1180-{
1181- if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
1182- save_status (adata, GSM_PRESENCE_STATUS_BUSY);
1183- }
1184-}
1185-
1186-static void
1187-on_status_invisible_activate (GtkWidget *widget,
1188- GdmAppletData *adata)
1189-{
1190- if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
1191- save_status (adata, GSM_PRESENCE_STATUS_INVISIBLE);
1192- }
1193-}
1194-
1195-static struct {
1196- char *icon_name;
1197- char *display_name;
1198- void *menu_callback;
1199- GtkWidget *widget;
1200-} statuses[] = {
1201- { "user-online", N_("Available"), on_status_available_activate, NULL },
1202- { "user-invisible", N_("Invisible"), on_status_invisible_activate, NULL },
1203- { "user-busy", N_("Busy"), on_status_busy_activate, NULL },
1204- { "user-away", N_("Away"), NULL, NULL },
1205-};
1206-#endif
1207-
1208-static void
1209-update_label (GdmAppletData *adata)
1210-{
1211- GtkWidget *label;
1212- char *markup;
1213-
1214- label = gtk_bin_get_child (GTK_BIN (adata->menuitem));
1215-
1216-#ifdef BUILD_PRESENSE_STUFF
1217- markup = g_strdup_printf ("<b>%s</b> <small>(%s)</small>",
1218- gdm_user_get_real_name (GDM_USER (adata->user)),
1219- _(statuses[adata->current_status].display_name));
1220-#else
1221- markup = g_strdup_printf ("<b>%s</b>",
1222- gdm_user_get_real_name (GDM_USER (adata->user)));
1223-#endif
1224- gtk_label_set_markup (GTK_LABEL (label), markup);
1225- g_free (markup);
1226-}
1227-
1228-#ifdef BUILD_PRESENSE_STUFF
1229-static void
1230-save_status_text (GdmAppletData *adata)
1231-{
1232- GtkWidget *entry;
1233- GtkTextBuffer *buffer;
1234- char *escaped_text;
1235- char *text;
1236- GtkTextIter start, end;
1237-
1238- entry = gdm_entry_menu_item_get_entry (GDM_ENTRY_MENU_ITEM (adata->user_item));
1239- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
1240- gtk_text_buffer_get_bounds (buffer, &start, &end);
1241- text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
1242- escaped_text = g_markup_escape_text (text, -1);
1243-
1244- if (escaped_text != NULL) {
1245- GError *error;
1246-
1247- error = NULL;
1248- dbus_g_proxy_call (adata->presence_proxy,
1249- "SetStatusText",
1250- &error,
1251- G_TYPE_STRING, escaped_text,
1252- G_TYPE_INVALID,
1253- G_TYPE_INVALID);
1254-
1255- if (error != NULL) {
1256- g_warning ("Couldn't set presence status text: %s", error->message);
1257- g_error_free (error);
1258- }
1259- }
1260-
1261- g_free (text);
1262- g_free (escaped_text);
1263-}
1264-
1265-static void
1266-on_user_item_deselect (GtkWidget *item,
1267- GdmAppletData *adata)
1268-{
1269- save_status_text (adata);
1270-}
1271-#endif
1272-
1273-static void
1274-create_sub_menu (GdmAppletData *adata)
1275-{
1276- GtkWidget *item;
1277-#ifdef BUILD_PRESENSE_STUFF
1278- int i;
1279- GSList *radio_group;
1280-#endif
1281-
1282- adata->menu = gtk_menu_new ();
1283-#ifdef BUILD_PRESENSE_STUFF
1284- g_signal_connect (adata->menu,
1285- "key-press-event",
1286- G_CALLBACK (on_menu_key_press_event),
1287- adata);
1288-#endif
1289- gtk_menu_item_set_submenu (GTK_MENU_ITEM (adata->menuitem), adata->menu);
1290- g_signal_connect (adata->menu, "style-set",
1291- G_CALLBACK (menu_style_set_cb), adata);
1292- g_signal_connect (adata->menu, "show",
1293- G_CALLBACK (menu_expose_cb), adata);
1294-
1295-#ifdef BUILD_PRESENSE_STUFF
1296- adata->user_item = gdm_entry_menu_item_new ();
1297- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1298- adata->user_item);
1299- gtk_widget_show (adata->user_item);
1300- g_signal_connect (adata->user_item, "activate",
1301- G_CALLBACK (on_user_item_activate), adata);
1302- g_signal_connect (adata->user_item,
1303- "deselect",
1304- G_CALLBACK (on_user_item_deselect),
1305- adata);
1306-
1307- item = gtk_separator_menu_item_new ();
1308- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu), item);
1309- gtk_widget_show (item);
1310-
1311- radio_group = NULL;
1312- for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
1313- GtkWidget *hbox;
1314- GtkWidget *label;
1315- GtkWidget *image;
1316- GtkWidget *item;
1317-
1318- if (statuses[i].menu_callback == NULL) {
1319- continue;
1320- }
1321-
1322- item = gtk_radio_menu_item_new (radio_group);
1323- radio_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
1324- hbox = gtk_hbox_new (FALSE, 3);
1325- label = gtk_label_new (_(statuses[i].display_name));
1326- gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT);
1327- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
1328- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
1329- gtk_widget_show (label);
1330- image = gtk_image_new_from_icon_name (statuses[i].icon_name, GTK_ICON_SIZE_MENU);
1331- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
1332- gtk_widget_show (image);
1333- gtk_widget_show (hbox);
1334- gtk_container_add (GTK_CONTAINER (item), hbox);
1335-
1336- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1337- item);
1338- g_signal_connect (item, "activate",
1339- G_CALLBACK (statuses[i].menu_callback), adata);
1340- gtk_widget_show (item);
1341-
1342- statuses[i].widget = item;
1343- }
1344-
1345- item = gtk_separator_menu_item_new ();
1346- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu), item);
1347- gtk_widget_show (item);
1348-#endif
1349-
1350- adata->account_item = gtk_image_menu_item_new_with_label (_("Account Information"));
1351- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->account_item),
1352- gtk_image_new ());
1353- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1354- adata->account_item);
1355- g_signal_connect (adata->account_item, "style-set",
1356- G_CALLBACK (menuitem_style_set_cb), adata);
1357- g_signal_connect (adata->account_item, "activate",
1358- G_CALLBACK (on_account_activate), adata);
1359- gtk_widget_show (adata->account_item);
1360-
1361-
1362- adata->control_panel_item = gtk_image_menu_item_new_with_label (_("System Preferences"));
1363- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->control_panel_item),
1364- gtk_image_new ());
1365- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1366- adata->control_panel_item);
1367- g_signal_connect (adata->control_panel_item, "style-set",
1368- G_CALLBACK (menuitem_style_set_cb), adata);
1369- g_signal_connect (adata->control_panel_item, "activate",
1370- G_CALLBACK (on_control_panel_activate), adata);
1371-
1372- item = gtk_separator_menu_item_new ();
1373- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu), item);
1374- gtk_widget_show (item);
1375-
1376- adata->lock_screen_item = gtk_image_menu_item_new_with_label (_("Lock Screen"));
1377- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->lock_screen_item),
1378- gtk_image_new ());
1379- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1380- adata->lock_screen_item);
1381- g_signal_connect (adata->lock_screen_item, "style-set",
1382- G_CALLBACK (menuitem_style_set_cb), adata);
1383- g_signal_connect (adata->lock_screen_item, "activate",
1384- G_CALLBACK (on_lock_screen_activate), adata);
1385- /* Only show if not locked down */
1386-
1387- adata->login_screen_item = gtk_image_menu_item_new_with_label (_("Switch User"));
1388- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->login_screen_item),
1389- gtk_image_new ());
1390- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1391- adata->login_screen_item);
1392- g_signal_connect (adata->login_screen_item, "style-set",
1393- G_CALLBACK (menuitem_style_set_cb), adata);
1394- g_signal_connect (adata->login_screen_item, "activate",
1395- G_CALLBACK (on_login_screen_activate), adata);
1396- /* Only show switch user if there are other users */
1397-
1398- adata->quit_session_item = gtk_image_menu_item_new_with_label (_("Quit…"));
1399- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->quit_session_item),
1400- gtk_image_new ());
1401- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menu),
1402- adata->quit_session_item);
1403- g_signal_connect (adata->quit_session_item, "style-set",
1404- G_CALLBACK (menuitem_style_set_cb), adata);
1405- g_signal_connect (adata->quit_session_item, "activate",
1406- G_CALLBACK (on_quit_session_activate), adata);
1407- gtk_widget_show (adata->quit_session_item);
1408- gtk_widget_show (adata->menu);
1409-}
1410-
1411-static void
1412-destroy_sub_menu (GdmAppletData *adata)
1413-{
1414- gtk_menu_item_set_submenu (GTK_MENU_ITEM (adata->menuitem), NULL);
1415-}
1416-
1417-static void
1418-set_menu_visibility (GdmAppletData *adata,
1419- gboolean visible)
1420-{
1421-
1422- if (visible) {
1423- create_sub_menu (adata);
1424- } else {
1425- destroy_sub_menu (adata);
1426- }
1427-}
1428-
1429-static void
1430-client_notify_lockdown_func (GConfClient *client,
1431- guint cnxn_id,
1432- GConfEntry *entry,
1433- GdmAppletData *adata)
1434-{
1435- GConfValue *value;
1436- const char *key;
1437-
1438- value = gconf_entry_get_value (entry);
1439- key = gconf_entry_get_key (entry);
1440-
1441- if (value == NULL || key == NULL) {
1442- return;
1443- }
1444-
1445- if (strcmp (key, LOCKDOWN_USER_SWITCHING_KEY) == 0) {
1446- if (gconf_value_get_bool (value)) {
1447- set_menu_visibility (adata, FALSE);
1448- } else {
1449- set_menu_visibility (adata, TRUE);
1450- }
1451- } else if (strcmp (key, LOCKDOWN_LOCK_SCREEN_KEY) == 0) {
1452- if (gconf_value_get_bool (value)) {
1453- gtk_widget_hide (adata->lock_screen_item);
1454- } else {
1455- gtk_widget_show (adata->lock_screen_item);
1456- }
1457- }
1458-}
1459-
1460-static void
1461-reset_icon (GdmAppletData *adata)
1462-{
1463- GdkPixbuf *pixbuf;
1464- GtkWidget *image;
1465-
1466- if (adata->user == NULL || !gtk_widget_has_screen (GTK_WIDGET (adata->menuitem))) {
1467- return;
1468- }
1469-
1470-#ifdef BUILD_PRESENSE_STUFF
1471- if (adata->user_item != NULL) {
1472- image = gdm_entry_menu_item_get_image (GDM_ENTRY_MENU_ITEM (adata->user_item));
1473- pixbuf = gdm_user_render_icon (adata->user, adata->panel_size * 3);
1474- if (pixbuf == NULL) {
1475- return;
1476- }
1477-
1478- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
1479- g_object_unref (pixbuf);
1480- }
1481-#else
1482- pixbuf = gdm_user_render_icon (adata->user, adata->panel_size);
1483-
1484- if (pixbuf == NULL) {
1485- return;
1486- }
1487-
1488- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (adata->menuitem));
1489- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
1490- g_object_unref (pixbuf);
1491-#endif
1492-}
1493-
1494-static void
1495-setup_current_user_now (GdmAppletData *adata)
1496-{
1497- g_assert (adata->user != NULL);
1498-
1499- if (adata->user_loaded_notify_id != 0) {
1500- g_signal_handler_disconnect (adata->user, adata->user_loaded_notify_id);
1501- }
1502- adata->user_loaded_notify_id = 0;
1503-
1504- update_label (adata);
1505- reset_icon (adata);
1506- adata->user_changed_notify_id =
1507- g_signal_connect (adata->user,
1508- "changed",
1509- G_CALLBACK (on_user_changed),
1510- adata);
1511-}
1512-
1513-static void
1514-on_current_user_loaded (GdmUser *user,
1515- GParamSpec *pspec,
1516- GdmAppletData *adata)
1517-{
1518- if (!gdm_user_is_loaded (user)) {
1519- return;
1520- }
1521-
1522- setup_current_user_now (adata);
1523-}
1524-
1525-static void
1526-setup_current_user (GdmAppletData *adata)
1527-{
1528- adata->user = gdm_user_manager_get_user_by_uid (adata->manager, getuid ());
1529-
1530- if (adata->user == NULL) {
1531- g_warning ("Could not setup current user");
1532- return;
1533- }
1534-
1535- g_object_ref (adata->user);
1536-
1537- adata->menuitem = gtk_image_menu_item_new_with_label ("");
1538-#ifndef BUILD_PRESENSE_STUFF
1539- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->menuitem),
1540- gtk_image_new ());
1541-#endif
1542- gtk_menu_shell_append (GTK_MENU_SHELL (adata->menubar), adata->menuitem);
1543- gtk_widget_show (adata->menuitem);
1544-
1545- if (gdm_user_is_loaded (adata->user)) {
1546- setup_current_user_now (adata);
1547- return;
1548- }
1549-
1550- adata->user_loaded_notify_id = g_signal_connect (adata->user,
1551- "notify::is-loaded",
1552- G_CALLBACK (on_current_user_loaded),
1553- adata);
1554-}
1555-
1556-#ifdef BUILD_PRESENSE_STUFF
1557-static void
1558-set_status (GdmAppletData *adata,
1559- guint status)
1560-{
1561- int i;
1562-
1563- g_debug ("Setting current status: %u", status);
1564- adata->current_status = status;
1565- for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
1566- if (statuses[i].widget == NULL) {
1567- continue;
1568- }
1569- if (i == status) {
1570- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (statuses[i].widget),
1571- TRUE);
1572- }
1573- }
1574-
1575- update_label (adata);
1576-}
1577-
1578-static void
1579-on_presence_status_changed (DBusGProxy *presence_proxy,
1580- guint status,
1581- GdmAppletData *adata)
1582-{
1583- g_debug ("Status changed: %u", status);
1584-
1585- set_status (adata, status);
1586-}
1587-
1588-static void
1589-set_status_text (GdmAppletData *adata,
1590- const char *status_text)
1591-{
1592- GtkWidget *entry;
1593- GtkTextBuffer *buffer;
1594-
1595- g_debug ("Status text changed: %s", status_text);
1596-
1597- entry = gdm_entry_menu_item_get_entry (GDM_ENTRY_MENU_ITEM (adata->user_item));
1598- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
1599- gtk_text_buffer_set_text (buffer, status_text, -1);
1600-}
1601-
1602-static void
1603-on_presence_status_text_changed (DBusGProxy *presence_proxy,
1604- const char *status_text,
1605- GdmAppletData *adata)
1606-{
1607- set_status_text (adata, status_text);
1608-}
1609-#endif
1610-
1611-static gboolean
1612-fill_applet (PanelApplet *applet)
1613-{
1614- static const BonoboUIVerb menu_verbs[] = {
1615- BONOBO_UI_VERB ("GdmAboutMe", about_me_cb),
1616- BONOBO_UI_VERB ("GdmUsersGroupsAdmin", admin_cb),
1617- BONOBO_UI_VERB ("GdmAbout", about_cb),
1618- BONOBO_UI_VERB_END
1619- };
1620- static gboolean first_time = FALSE;
1621- char *tmp;
1622- BonoboUIComponent *popup_component;
1623- GdmAppletData *adata;
1624- GError *error;
1625- DBusGConnection *bus;
1626-
1627- if (!first_time) {
1628- first_time = TRUE;
1629-
1630- /* Do this here so it's only done once. */
1631- gtk_rc_parse_string ("style \"gdm-user-switch-menubar-style\"\n"
1632- "{\n"
1633- "GtkMenuBar::shadow-type = none\n"
1634- "GtkMenuBar::internal-padding = 0\n"
1635- "}\n"
1636- "style \"gdm-user-switch-applet-style\"\n"
1637- "{\n"
1638- "GtkWidget::focus-line-width = 0\n"
1639- "GtkWidget::focus-padding = 0\n"
1640- "}\n"
1641- "widget \"*.gdm-user-switch-menubar\" style \"gdm-user-switch-menubar-style\"\n"
1642- "widget \"*.gdm-user-switch-applet\" style \"gdm-user-switch-applet-style\"\n");
1643- gtk_window_set_default_icon_name ("stock_people");
1644- g_set_application_name (_("User Switch Applet"));
1645-
1646- if (! gdm_settings_client_init (DATADIR "/gdm/gdm.schemas", "/")) {
1647- g_critical ("Unable to initialize settings client");
1648- exit (1);
1649- }
1650-
1651- }
1652-
1653- adata = g_new0 (GdmAppletData, 1);
1654- adata->applet = applet;
1655- adata->panel_size = 24;
1656-
1657- adata->client = gconf_client_get_default ();
1658-
1659- gtk_widget_set_tooltip_text (GTK_WIDGET (applet), _("Change account settings and status"));
1660- gtk_container_set_border_width (GTK_CONTAINER (applet), 0);
1661- gtk_widget_set_name (GTK_WIDGET (applet), "gdm-user-switch-applet");
1662- panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
1663- panel_applet_setup_menu_from_file (applet, NULL,
1664- DATADIR "/gnome-2.0/ui/GNOME_FastUserSwitchApplet.xml",
1665- NULL, menu_verbs, adata);
1666-
1667- popup_component = panel_applet_get_popup_component (applet);
1668-
1669- /* Hide the admin context menu items if locked down or no cmd-line */
1670- if (gconf_client_get_bool (adata->client,
1671- LOCKDOWN_COMMAND_LINE_KEY,
1672- NULL) ||
1673- panel_applet_get_locked_down (applet)) {
1674- bonobo_ui_component_set_prop (popup_component,
1675- "/popups/button3/GdmSeparator",
1676- "hidden", "1", NULL);
1677- bonobo_ui_component_set_prop (popup_component,
1678- "/commands/GdmUsersGroupsAdmin",
1679- "hidden", "1", NULL);
1680- } else {
1681-#ifndef USERS_ADMIN
1682-# ifdef GDM_SETUP
1683- bonobo_ui_component_set_prop (popup_component,
1684- "/popups/button3/GdmSeparator",
1685- "hidden", "1",
1686- NULL);
1687-# endif /* !GDM_SETUP */
1688- bonobo_ui_component_set_prop (popup_component,
1689- "/commands/GdmUsersGroupsAdmin",
1690- "hidden", "1",
1691- NULL);
1692-#endif /* !USERS_ADMIN */
1693- }
1694-
1695- /* Hide the gdmphotosetup item if it can't be found in the path. */
1696- tmp = g_find_program_in_path ("gnome-about-me");
1697- if (!tmp) {
1698- bonobo_ui_component_set_prop (popup_component,
1699- "/commands/GdmAboutMe",
1700- "hidden", "1",
1701- NULL);
1702- } else {
1703- g_free (tmp);
1704- }
1705-
1706- g_signal_connect (adata->applet,
1707- "style-set",
1708- G_CALLBACK (applet_style_set_cb), adata);
1709- g_signal_connect (applet,
1710- "change-background",
1711- G_CALLBACK (applet_change_background_cb), adata);
1712- g_signal_connect (applet,
1713- "size-allocate",
1714- G_CALLBACK (applet_size_allocate_cb), adata);
1715- g_signal_connect (applet,
1716- "key-press-event",
1717- G_CALLBACK (applet_key_press_event_cb), adata);
1718- g_signal_connect_after (applet,
1719- "focus-in-event",
1720- G_CALLBACK (gtk_widget_queue_draw), NULL);
1721- g_signal_connect_after (applet,
1722- "focus-out-event",
1723- G_CALLBACK (gtk_widget_queue_draw), NULL);
1724- g_object_set_data_full (G_OBJECT (applet),
1725- "gdm-applet-data",
1726- adata,
1727- (GDestroyNotify) gdm_applet_data_free);
1728-
1729- adata->menubar = gtk_menu_bar_new ();
1730- gtk_widget_set_name (adata->menubar, "gdm-user-switch-menubar");
1731- gtk_widget_set_can_focus (adata->menubar, TRUE);
1732- g_signal_connect (adata->menubar, "button-press-event",
1733- G_CALLBACK (menubar_button_press_event_cb), adata);
1734- g_signal_connect_after (adata->menubar, "expose-event",
1735- G_CALLBACK (menubar_expose_event_cb), adata);
1736- gtk_container_add (GTK_CONTAINER (applet), adata->menubar);
1737- gtk_widget_show (adata->menubar);
1738-
1739- adata->manager = gdm_user_manager_ref_default ();
1740- g_object_set (adata->manager, "include-all", TRUE, NULL);
1741- g_signal_connect (adata->manager,
1742- "notify::is-loaded",
1743- G_CALLBACK (on_manager_is_loaded_changed),
1744- adata);
1745- g_signal_connect (adata->manager,
1746- "notify::has-multiple-users",
1747- G_CALLBACK (on_manager_has_multiple_users_changed),
1748- adata);
1749-
1750- gdm_user_manager_queue_load (adata->manager);
1751- setup_current_user (adata);
1752-
1753- gconf_client_add_dir (adata->client,
1754- LOCKDOWN_DIR,
1755- GCONF_CLIENT_PRELOAD_ONELEVEL,
1756- NULL);
1757-
1758- adata->client_notify_lockdown_id = gconf_client_notify_add (adata->client,
1759- LOCKDOWN_DIR,
1760- (GConfClientNotifyFunc)client_notify_lockdown_func,
1761- adata,
1762- NULL,
1763- NULL);
1764-
1765- if (gconf_client_get_bool (adata->client, LOCKDOWN_USER_SWITCHING_KEY, NULL)) {
1766- set_menu_visibility (adata, FALSE);
1767- } else {
1768- set_menu_visibility (adata, TRUE);
1769- }
1770- if (gconf_client_get_bool (adata->client, LOCKDOWN_LOCK_SCREEN_KEY, NULL)) {
1771- gtk_widget_hide (adata->lock_screen_item);
1772- } else {
1773- gtk_widget_show (adata->lock_screen_item);
1774- }
1775-
1776- error = NULL;
1777- bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
1778- if (bus == NULL) {
1779- g_warning ("Unable to get session bus: %s", error->message);
1780- g_error_free (error);
1781- goto done;
1782- }
1783-
1784-#ifdef BUILD_PRESENSE_STUFF
1785- adata->presence_proxy = dbus_g_proxy_new_for_name (bus,
1786- "org.gnome.SessionManager",
1787- "/org/gnome/SessionManager/Presence",
1788- "org.gnome.SessionManager.Presence");
1789- if (adata->presence_proxy != NULL) {
1790- DBusGProxy *proxy;
1791-
1792- dbus_g_proxy_add_signal (adata->presence_proxy,
1793- "StatusChanged",
1794- G_TYPE_UINT,
1795- G_TYPE_INVALID);
1796- dbus_g_proxy_connect_signal (adata->presence_proxy,
1797- "StatusChanged",
1798- G_CALLBACK (on_presence_status_changed),
1799- adata,
1800- NULL);
1801- dbus_g_proxy_add_signal (adata->presence_proxy,
1802- "StatusTextChanged",
1803- G_TYPE_STRING,
1804- G_TYPE_INVALID);
1805- dbus_g_proxy_connect_signal (adata->presence_proxy,
1806- "StatusTextChanged",
1807- G_CALLBACK (on_presence_status_text_changed),
1808- adata,
1809- NULL);
1810-
1811-
1812- proxy = dbus_g_proxy_new_from_proxy (adata->presence_proxy,
1813- "org.freedesktop.DBus.Properties",
1814- "/org/gnome/SessionManager/Presence");
1815- if (proxy != NULL) {
1816- guint status;
1817- const char *status_text;
1818- GValue value = { 0, };
1819-
1820- status = 0;
1821- status_text = NULL;
1822-
1823- error = NULL;
1824- dbus_g_proxy_call (proxy,
1825- "Get",
1826- &error,
1827- G_TYPE_STRING, "org.gnome.SessionManager.Presence",
1828- G_TYPE_STRING, "status",
1829- G_TYPE_INVALID,
1830- G_TYPE_VALUE, &value,
1831- G_TYPE_INVALID);
1832-
1833- if (error != NULL) {
1834- g_warning ("Couldn't get presence status: %s", error->message);
1835- g_error_free (error);
1836- } else {
1837- status = g_value_get_uint (&value);
1838- }
1839-
1840- g_value_unset (&value);
1841-
1842- error = NULL;
1843- dbus_g_proxy_call (proxy,
1844- "Get",
1845- &error,
1846- G_TYPE_STRING, "org.gnome.SessionManager.Presence",
1847- G_TYPE_STRING, "status-text",
1848- G_TYPE_INVALID,
1849- G_TYPE_VALUE, &value,
1850- G_TYPE_INVALID);
1851-
1852- if (error != NULL) {
1853- g_warning ("Couldn't get presence status text: %s", error->message);
1854- g_error_free (error);
1855- } else {
1856- status_text = g_value_get_string (&value);
1857- }
1858-
1859- set_status (adata, status);
1860- set_status_text (adata, status_text);
1861- }
1862- } else {
1863- g_warning ("Failed to get session presence proxy");
1864- }
1865-#endif
1866-
1867- done:
1868- gtk_widget_show (GTK_WIDGET (adata->applet));
1869-
1870- return TRUE;
1871-}
1872-
1873-static gboolean
1874-applet_factory (PanelApplet *applet,
1875- const char *iid,
1876- gpointer data)
1877-{
1878- gboolean ret;
1879- ret = FALSE;
1880- if (strcmp (iid, "OAFIID:GNOME_FastUserSwitchApplet") == 0) {
1881- ret = fill_applet (applet);
1882- }
1883- return ret;
1884-}
1885diff --git a/gui/user-switch-applet/gdm-entry-menu-item.c b/gui/user-switch-applet/gdm-entry-menu-item.c
1886deleted file mode 100644
1887index d657e7a..0000000
1888--- a/gui/user-switch-applet/gdm-entry-menu-item.c
1889+++ /dev/null
1890@@ -1,304 +0,0 @@
1891-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
1892- *
1893- * Copyright (C) 2008 Red Hat, Inc.
1894- *
1895- * This program is free software; you can redistribute it and/or modify
1896- * it under the terms of the GNU General Public License as published by
1897- * the Free Software Foundation; either version 2 of the License, or
1898- * (at your option) any later version.
1899- *
1900- * This program is distributed in the hope that it will be useful,
1901- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1902- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1903- * GNU General Public License for more details.
1904- *
1905- * You should have received a copy of the GNU General Public License
1906- * along with this program; if not, write to the Free Software
1907- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1908- */
1909-
1910-#include "config.h"
1911-
1912-#include <unistd.h>
1913-#include <sys/types.h>
1914-
1915-#include <string.h>
1916-
1917-#include <glib/gi18n.h>
1918-#include <gtk/gtk.h>
1919-
1920-#include "gdm-entry-menu-item.h"
1921-
1922-/* same as twitter */
1923-#define TEXT_BUFFER_MAX_CHARS 64
1924-
1925-enum
1926-{
1927- PROP_0,
1928-};
1929-
1930-struct _GdmEntryMenuItem
1931-{
1932- GtkMenuItem parent;
1933-
1934- GtkWidget *hbox;
1935- GtkWidget *image;
1936- GtkWidget *entry;
1937-};
1938-
1939-struct _GdmEntryMenuItemClass
1940-{
1941- GtkMenuItemClass parent_class;
1942-};
1943-
1944-G_DEFINE_TYPE (GdmEntryMenuItem, gdm_entry_menu_item, GTK_TYPE_MENU_ITEM)
1945-
1946-static void
1947-gdm_entry_menu_item_set_property (GObject *object,
1948- guint param_id,
1949- const GValue *value,
1950- GParamSpec *pspec)
1951-{
1952- GdmEntryMenuItem *item;
1953-
1954- item = GDM_ENTRY_MENU_ITEM (object);
1955-
1956- switch (param_id) {
1957- default:
1958- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
1959- break;
1960- }
1961-}
1962-
1963-static void
1964-gdm_entry_menu_item_get_property (GObject *object,
1965- guint param_id,
1966- GValue *value,
1967- GParamSpec *pspec)
1968-{
1969- GdmEntryMenuItem *item;
1970-
1971- item = GDM_ENTRY_MENU_ITEM (object);
1972-
1973- switch (param_id) {
1974- default:
1975- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
1976- break;
1977- }
1978-}
1979-
1980-static void
1981-gdm_entry_menu_item_dispose (GObject *object)
1982-{
1983-
1984- (*G_OBJECT_CLASS (gdm_entry_menu_item_parent_class)->dispose) (object);
1985-}
1986-
1987-static gboolean
1988-gdm_entry_menu_item_button_release (GtkWidget *widget,
1989- GdkEventButton *event)
1990-{
1991- return TRUE;
1992-}
1993-
1994-/* Cut and paste from gtkwindow.c */
1995-static void
1996-send_focus_change (GtkWidget *widget,
1997- gboolean in)
1998-{
1999- GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
2000-
2001- g_object_ref (widget);
2002-
2003- gtk_widget_set_can_focus (widget, in);
2004-
2005- fevent->focus_change.type = GDK_FOCUS_CHANGE;
2006- fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
2007- fevent->focus_change.in = in;
2008-
2009- gtk_widget_event (widget, fevent);
2010-
2011- g_object_notify (G_OBJECT (widget), "has-focus");
2012-
2013- g_object_unref (widget);
2014- gdk_event_free (fevent);
2015-}
2016-
2017-static gboolean
2018-gdm_entry_menu_item_button_press (GtkWidget *widget,
2019- GdkEventButton *event)
2020-{
2021- GtkWidget *entry;
2022-
2023- entry = GDM_ENTRY_MENU_ITEM (widget)->entry;
2024-
2025- if (gtk_widget_get_window (entry) != NULL) {
2026- gdk_window_raise (gtk_widget_get_window (entry));
2027- }
2028-
2029- if (!gtk_widget_has_focus (entry)) {
2030- gtk_widget_grab_focus (entry);
2031- }
2032-
2033- return FALSE;
2034-}
2035-
2036-static void
2037-gdm_entry_menu_item_realize (GtkWidget *widget)
2038-{
2039- if (GTK_WIDGET_CLASS (gdm_entry_menu_item_parent_class)->realize) {
2040- GTK_WIDGET_CLASS (gdm_entry_menu_item_parent_class)->realize (widget);
2041- }
2042-}
2043-
2044-static void
2045-gdm_entry_menu_item_select (GtkItem *item)
2046-{
2047- g_return_if_fail (GDM_IS_ENTRY_MENU_ITEM (item));
2048- send_focus_change (GTK_WIDGET (GDM_ENTRY_MENU_ITEM (item)->entry), TRUE);
2049-}
2050-
2051-static void
2052-gdm_entry_menu_item_deselect (GtkItem *item)
2053-{
2054- g_return_if_fail (GDM_IS_ENTRY_MENU_ITEM (item));
2055-
2056- send_focus_change (GTK_WIDGET (GDM_ENTRY_MENU_ITEM (item)->entry), FALSE);
2057-}
2058-
2059-static void
2060-gdm_entry_menu_item_class_init (GdmEntryMenuItemClass *klass)
2061-{
2062- GObjectClass *gobject_class;
2063- GtkWidgetClass *widget_class;
2064- GtkMenuItemClass *menu_item_class;
2065- GtkItemClass *item_class;
2066-
2067- gobject_class = G_OBJECT_CLASS (klass);
2068- widget_class = GTK_WIDGET_CLASS (klass);
2069- menu_item_class = GTK_MENU_ITEM_CLASS (klass);
2070- item_class = GTK_ITEM_CLASS (klass);
2071-
2072- gobject_class->set_property = gdm_entry_menu_item_set_property;
2073- gobject_class->get_property = gdm_entry_menu_item_get_property;
2074- gobject_class->dispose = gdm_entry_menu_item_dispose;
2075-
2076- widget_class->button_release_event = gdm_entry_menu_item_button_release;
2077- widget_class->button_press_event = gdm_entry_menu_item_button_press;
2078- widget_class->realize = gdm_entry_menu_item_realize;
2079-
2080- item_class->select = gdm_entry_menu_item_select;
2081- item_class->deselect = gdm_entry_menu_item_deselect;
2082-
2083- menu_item_class->hide_on_activate = FALSE;
2084-}
2085-
2086-static void
2087-on_entry_show (GtkWidget *widget,
2088- GdmEntryMenuItem *item)
2089-{
2090- if (gtk_widget_get_window (widget) != NULL) {
2091- gdk_window_raise (gtk_widget_get_window (widget));
2092- }
2093- send_focus_change (widget, TRUE);
2094-}
2095-
2096-static void
2097-on_text_buffer_changed (GtkTextBuffer *buffer,
2098- GdmEntryMenuItem *item)
2099-{
2100- int len;
2101-
2102- len = gtk_text_buffer_get_char_count (buffer);
2103- if (len > TEXT_BUFFER_MAX_CHARS) {
2104- gdk_window_beep (gtk_widget_get_window (GTK_WIDGET (item)));
2105- }
2106-}
2107-
2108-static void
2109-on_entry_move_focus (GtkWidget *widget,
2110- GtkDirectionType direction,
2111- GdmEntryMenuItem *item)
2112-{
2113- g_debug ("focus move");
2114- send_focus_change (GTK_WIDGET (GDM_ENTRY_MENU_ITEM (item)->entry), FALSE);
2115- g_signal_emit_by_name (item,
2116- "move-focus",
2117- GTK_DIR_TAB_FORWARD);
2118-}
2119-
2120-static void
2121-gdm_entry_menu_item_init (GdmEntryMenuItem *item)
2122-{
2123- PangoFontDescription *fontdesc;
2124- PangoFontMetrics *metrics;
2125- PangoContext *context;
2126- PangoLanguage *lang;
2127- int ascent;
2128- GtkTextBuffer *buffer;
2129-
2130- item->hbox = gtk_hbox_new (FALSE, 6);
2131- gtk_container_add (GTK_CONTAINER (item), item->hbox);
2132-
2133- item->image = gtk_image_new ();
2134- gtk_box_pack_start (GTK_BOX (item->hbox), item->image, FALSE, FALSE, 0);
2135-
2136- item->entry = gtk_text_view_new ();
2137- gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (item->entry), FALSE);
2138- gtk_text_view_set_editable (GTK_TEXT_VIEW (item->entry), TRUE);
2139- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (item->entry),
2140- GTK_WRAP_WORD);
2141- g_signal_connect (item->entry,
2142- "show",
2143- G_CALLBACK (on_entry_show),
2144- item);
2145- g_signal_connect (item->entry,
2146- "move-focus",
2147- G_CALLBACK (on_entry_move_focus),
2148- item);
2149-
2150- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (item->entry));
2151- g_signal_connect (buffer,
2152- "changed",
2153- G_CALLBACK (on_text_buffer_changed),
2154- item);
2155-
2156- /* get the font ascent for the current font and language */
2157- context = gtk_widget_get_pango_context (item->entry);
2158- fontdesc = pango_context_get_font_description (context);
2159- lang = pango_context_get_language (context);
2160- metrics = pango_context_get_metrics (context, fontdesc, lang);
2161- ascent = pango_font_metrics_get_ascent (metrics) * 1.5 / PANGO_SCALE;
2162- pango_font_metrics_unref (metrics);
2163-
2164- /* size our progress bar to be five ascents long */
2165- gtk_widget_set_size_request (item->entry, ascent * 5, -1);
2166-
2167- gtk_box_pack_start (GTK_BOX (item->hbox), item->entry, TRUE, TRUE, 0);
2168-
2169- gtk_widget_show (item->hbox);
2170- gtk_widget_show (item->image);
2171- gtk_widget_show (item->entry);
2172-}
2173-
2174-GtkWidget *
2175-gdm_entry_menu_item_new (void)
2176-{
2177- return g_object_new (GDM_TYPE_ENTRY_MENU_ITEM, NULL);
2178-}
2179-
2180-GtkWidget *
2181-gdm_entry_menu_item_get_entry (GdmEntryMenuItem *item)
2182-{
2183- g_return_val_if_fail (GDM_IS_ENTRY_MENU_ITEM (item), NULL);
2184-
2185- return item->entry;
2186-}
2187-
2188-GtkWidget *
2189-gdm_entry_menu_item_get_image (GdmEntryMenuItem *item)
2190-{
2191- g_return_val_if_fail (GDM_IS_ENTRY_MENU_ITEM (item), NULL);
2192-
2193- return item->image;
2194-}
2195diff --git a/gui/user-switch-applet/gdm-entry-menu-item.h b/gui/user-switch-applet/gdm-entry-menu-item.h
2196deleted file mode 100644
2197index 3031609..0000000
2198--- a/gui/user-switch-applet/gdm-entry-menu-item.h
2199+++ /dev/null
2200@@ -1,51 +0,0 @@
2201-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2202- *
2203- * Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
2204- *
2205- * This program is free software; you can redistribute it and/or modify
2206- * it under the terms of the GNU General Public License as published by
2207- * the Free Software Foundation; either version 2 of the License, or
2208- * (at your option) any later version.
2209- *
2210- * This program is distributed in the hope that it will be useful,
2211- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2213- * GNU General Public License for more details.
2214- *
2215- * You should have received a copy of the GNU General Public License
2216- * along with this program; if not, write to the Free Software
2217- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2218- */
2219-
2220-#ifndef __GDM_ENTRY_MENU_ITEM__
2221-#define __GDM_ENTRY_MENU_ITEM__
2222-
2223-#include <gtk/gtk.h>
2224-
2225-G_BEGIN_DECLS
2226-
2227-#define GDM_TYPE_ENTRY_MENU_ITEM \
2228- (gdm_entry_menu_item_get_type ())
2229-#define GDM_ENTRY_MENU_ITEM(object) \
2230- (G_TYPE_CHECK_INSTANCE_CAST ((object), GDM_TYPE_ENTRY_MENU_ITEM, GdmEntryMenuItem))
2231-#define GDM_ENTRY_MENU_ITEM_CLASS(klass) \
2232- (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_ENTRY_MENU_ITEM, GdmEntryMenuItemClass))
2233-#define GDM_IS_ENTRY_MENU_ITEM(object) \
2234- (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDM_TYPE_ENTRY_MENU_ITEM))
2235-#define GDM_IS_ENTRY_MENU_ITEM_CLASS(klass) \
2236- (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_ENTRY_MENU_ITEM))
2237-#define GDM_ENTRY_MENU_ITEM_GET_CLASS(object) \
2238- (G_TYPE_INSTANCE_GET_CLASS ((object), GDM_TYPE_ENTRY_MENU_ITEM, GdmEntryMenuItemClass))
2239-
2240-typedef struct _GdmEntryMenuItem GdmEntryMenuItem;
2241-typedef struct _GdmEntryMenuItemClass GdmEntryMenuItemClass;
2242-
2243-GType gdm_entry_menu_item_get_type (void) G_GNUC_CONST;
2244-
2245-GtkWidget *gdm_entry_menu_item_new (void);
2246-GtkWidget *gdm_entry_menu_item_get_entry (GdmEntryMenuItem *item);
2247-GtkWidget *gdm_entry_menu_item_get_image (GdmEntryMenuItem *item);
2248-
2249-G_END_DECLS
2250-
2251-#endif /* __GDM_ENTRY_MENU_ITEM__ */
2252diff --git a/po/POTFILES.in b/po/POTFILES.in
2253index 1fccb90..cc1a3fd 100644
2254--- a/po/POTFILES.in
2255+++ b/po/POTFILES.in
2256@@ -84,10 +84,6 @@ gui/simple-greeter/gdm-timer.c
2257 gui/simple-greeter/gdm-user.c
2258 gui/simple-greeter/gdm-user-chooser-widget.c
2259 gui/simple-greeter/greeter-main.c
2260-gui/user-switch-applet/applet.c
2261-gui/user-switch-applet/gdm-entry-menu-item.c
2262-gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
2263-gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
2264 utils/gdmflexiserver.c
2265 utils/gdm-screenshot.c
2266
2267diff --git a/po/POTFILES.skip b/po/POTFILES.skip
2268index 0269a0f..ee3d753 100644
2269--- a/po/POTFILES.skip
2270+++ b/po/POTFILES.skip
2271@@ -7,7 +7,6 @@
2272 # remove these unless you fix "make distcheck" a different way.
2273 #
2274 data/gdm.schemas.in
2275-gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in
2276 data/greeter-autostart/at-spi-registryd-wrapper.desktop.in
2277 data/greeter-autostart/gdm-simple-greeter.desktop.in
2278 data/greeter-autostart/gnome-power-manager.desktop.in
2279--
22801.6.6.1
2281
diff --git a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
index 9edc8082d..c5ced73b9 100644
--- a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
+++ b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
@@ -4,12 +4,13 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
4 4
5DEPENDS = "xinput gnome-panel tcp-wrappers libcanberra libxklavier grep consolekit libpam gnome-doc-utils gtk+ xrdb" 5DEPENDS = "xinput gnome-panel tcp-wrappers libcanberra libxklavier grep consolekit libpam gnome-doc-utils gtk+ xrdb"
6 6
7PR = "r2" 7PR = "r3"
8 8
9inherit gnome update-rc.d 9inherit gnome update-rc.d
10 10
11SRC_URI += " \ 11SRC_URI += " \
12 file://cross-xdetection.diff \ 12 file://cross-xdetection.diff \
13 file://0001-Remove-user-switch-applet.patch \
13 file://%gconf-tree.xml \ 14 file://%gconf-tree.xml \
14 file://gdm \ 15 file://gdm \
15 file://gdm.conf \ 16 file://gdm.conf \