summaryrefslogtreecommitdiff
path: root/gui/simple-greeter
diff options
context:
space:
mode:
Diffstat (limited to 'gui/simple-greeter')
-rw-r--r--gui/simple-greeter/Makefile.am143
-rw-r--r--gui/simple-greeter/gdm-greeter-background.c899
-rw-r--r--gui/simple-greeter/gdm-greeter-background.h55
-rw-r--r--gui/simple-greeter/gdm-greeter-panel.c436
-rw-r--r--gui/simple-greeter/gdm-greeter-panel.h55
-rw-r--r--gui/simple-greeter/gdm-language-chooser-dialog.c197
-rw-r--r--gui/simple-greeter/gdm-language-chooser-dialog.h57
-rw-r--r--gui/simple-greeter/gdm-language-chooser-widget.c1173
-rw-r--r--gui/simple-greeter/gdm-language-chooser-widget.h61
-rw-r--r--gui/simple-greeter/gdm-session-chooser-dialog.c196
-rw-r--r--gui/simple-greeter/gdm-session-chooser-dialog.h57
-rw-r--r--gui/simple-greeter/gdm-session-chooser-widget.c703
-rw-r--r--gui/simple-greeter/gdm-session-chooser-widget.h61
-rw-r--r--gui/simple-greeter/gdm-simple-greeter.c668
-rw-r--r--gui/simple-greeter/gdm-simple-greeter.glade348
-rw-r--r--gui/simple-greeter/gdm-simple-greeter.h58
-rw-r--r--gui/simple-greeter/gdm-user-chooser-dialog.c196
-rw-r--r--gui/simple-greeter/gdm-user-chooser-dialog.h57
-rw-r--r--gui/simple-greeter/gdm-user-chooser-widget.c602
-rw-r--r--gui/simple-greeter/gdm-user-chooser-widget.h61
-rw-r--r--gui/simple-greeter/gdm-user-manager.c488
-rw-r--r--gui/simple-greeter/gdm-user-manager.h73
-rw-r--r--gui/simple-greeter/gdm-user-private.h43
-rw-r--r--gui/simple-greeter/gdm-user.c587
-rw-r--r--gui/simple-greeter/gdm-user.h59
-rw-r--r--gui/simple-greeter/greeter-main.c533
-rw-r--r--gui/simple-greeter/libnotificationarea/Makefile.am66
-rw-r--r--gui/simple-greeter/libnotificationarea/fixedtip.c261
-rw-r--r--gui/simple-greeter/libnotificationarea/fixedtip.h68
-rw-r--r--gui/simple-greeter/libnotificationarea/na-marshal.list3
-rw-r--r--gui/simple-greeter/libnotificationarea/na-tray-manager.c907
-rw-r--r--gui/simple-greeter/libnotificationarea/na-tray-manager.h98
-rw-r--r--gui/simple-greeter/libnotificationarea/na-tray.c679
-rw-r--r--gui/simple-greeter/libnotificationarea/na-tray.h68
-rw-r--r--gui/simple-greeter/libnotificationarea/obox.c130
-rw-r--r--gui/simple-greeter/libnotificationarea/obox.h73
-rw-r--r--gui/simple-greeter/libnotificationarea/testtray.c220
-rw-r--r--gui/simple-greeter/locarchive.h97
-rw-r--r--gui/simple-greeter/test-greeter-background.c54
-rw-r--r--gui/simple-greeter/test-greeter-panel.c54
-rw-r--r--gui/simple-greeter/test-language-chooser.c61
-rw-r--r--gui/simple-greeter/test-session-chooser.c61
-rw-r--r--gui/simple-greeter/test-user-chooser.c63
-rw-r--r--gui/simple-greeter/test-user-manager.c82
44 files changed, 0 insertions, 10911 deletions
diff --git a/gui/simple-greeter/Makefile.am b/gui/simple-greeter/Makefile.am
deleted file mode 100644
index 4f83e98d..00000000
--- a/gui/simple-greeter/Makefile.am
+++ /dev/null
@@ -1,143 +0,0 @@
-NULL =
-
-SUBDIRS = \
- libnotificationarea \
- $(NULL)
-
-INCLUDES = \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/libgreeter \
- -I$(top_srcdir)/gui/simple-greeter/libnotificationarea \
- -DDMCONFDIR=\""$(dmconfdir)"\" \
- -DGDMCONFDIR=\"$(gdmconfdir)\" \
- -DDATADIR=\""$(datadir)"\" \
- -DLIBLOCALEDIR=\""$(libdir)/locale"\" \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGLADEDIR=\""$(pkgdatadir)"\" \
- -DLIBEXECDIR=\""$(libexecdir)"\" \
- -DSBINDIR=\""$(sbindir)"\" \
- $(GREETER_CFLAGS) \
- $(SIMPLE_GREETER_CFLAGS) \
- $(NULL)
-
-noinst_PROGRAMS = \
- test-greeter-background \
- test-greeter-panel \
- test-language-chooser \
- test-session-chooser \
- test-user-chooser \
- test-user-manager \
- $(NULL)
-
-test_greeter_background_SOURCES = \
- test-greeter-background.c \
- gdm-greeter-background.h \
- gdm-greeter-background.c \
- $(NULL)
-
-test_greeter_background_LDADD = \
- $(SIMPLE_GREETER_LIBS) \
- $(NULL)
-
-test_greeter_panel_SOURCES = \
- test-greeter-panel.c \
- gdm-greeter-panel.h \
- gdm-greeter-panel.c \
- $(NULL)
-
-test_greeter_panel_LDADD = \
- $(GREETER_LIBS) \
- $(top_builddir)/gui/simple-greeter/libnotificationarea/libnotificationarea.la \
- $(NULL)
-
-test_language_chooser_SOURCES = \
- test-language-chooser.c \
- gdm-language-chooser-widget.h \
- gdm-language-chooser-widget.c \
- locarchive.h \
- gdm-language-chooser-dialog.h \
- gdm-language-chooser-dialog.c \
- $(NULL)
-
-test_language_chooser_LDADD = \
- $(GREETER_LIBS) \
- $(NULL)
-
-test_session_chooser_SOURCES = \
- test-session-chooser.c \
- gdm-session-chooser-widget.h \
- gdm-session-chooser-widget.c \
- gdm-session-chooser-dialog.h \
- gdm-session-chooser-dialog.c \
- $(NULL)
-
-test_session_chooser_LDADD = \
- $(GREETER_LIBS) \
- $(NULL)
-
-test_user_chooser_SOURCES = \
- test-user-chooser.c \
- gdm-user-chooser-widget.h \
- gdm-user-chooser-widget.c \
- gdm-user-chooser-dialog.h \
- gdm-user-chooser-dialog.c \
- gdm-user-manager.h \
- gdm-user-manager.c \
- gdm-user-private.h \
- gdm-user.h \
- gdm-user.c \
- $(NULL)
-
-test_user_chooser_LDADD = \
- $(SIMPLE_GREETER_LIBS) \
- $(NULL)
-
-test_user_manager_SOURCES = \
- test-user-manager.c \
- gdm-user-manager.h \
- gdm-user-manager.c \
- gdm-user-private.h \
- gdm-user.h \
- gdm-user.c \
- $(NULL)
-
-test_user_manager_LDADD = \
- $(SIMPLE_GREETER_LIBS) \
- $(NULL)
-
-libexec_PROGRAMS = \
- gdm-simple-greeter
-
-gdm_simple_greeter_SOURCES = \
- greeter-main.c \
- gdm-simple-greeter.c \
- gdm-simple-greeter.h \
- gdm-greeter-panel.h \
- gdm-greeter-panel.c \
- gdm-greeter-background.h \
- gdm-greeter-background.c \
- gdm-user-chooser-widget.h \
- gdm-user-chooser-widget.c \
- gdm-user-manager.h \
- gdm-user-manager.c \
- gdm-user-private.h \
- gdm-user.h \
- gdm-user.c \
- $(NULL)
-
-gdm_simple_greeter_LDADD = \
- $(EXTRA_GREETER_LIBS) \
- -L$(top_builddir)/libgreeter \
- -lgreeter \
- $(top_builddir)/gui/simple-greeter/libnotificationarea/libnotificationarea.la \
- $(SIMPLE_GREETER_LIBS) \
- $(NULL)
-
-gladedir = $(pkgdatadir)
-glade_DATA = \
- gdm-simple-greeter.glade \
- $(NULL)
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(NULL)
diff --git a/gui/simple-greeter/gdm-greeter-background.c b/gui/simple-greeter/gdm-greeter-background.c
deleted file mode 100644
index 358d4621..00000000
--- a/gui/simple-greeter/gdm-greeter-background.c
+++ /dev/null
@@ -1,899 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include <cairo.h>
-#if CAIRO_HAS_XLIB_SURFACE
-#include <cairo-xlib.h>
-#endif
-
-#include <gconf/gconf-client.h>
-
-#include "gdm-greeter-background.h"
-
-#define GDM_GREETER_BACKGROUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_BACKGROUND, GdmGreeterBackgroundPrivate))
-
-typedef enum {
- COLOR_SHADING_SOLID = 0,
- COLOR_SHADING_HORIZONTAL,
- COLOR_SHADING_VERTICAL
-} ColorShading;
-
-typedef enum {
- BACKGROUND_NONE = 0, /* zero makes this the default placement */
- BACKGROUND_TILED,
- BACKGROUND_CENTERED,
- BACKGROUND_SCALED,
- BACKGROUND_SCALED_ASPECT,
- BACKGROUND_ZOOM
-} BackgroundImagePlacement;
-
-struct GdmGreeterBackgroundPrivate
-{
- int monitor;
- GdkRectangle geometry;
-
- gboolean background_enabled;
- char *image_filename;
- BackgroundImagePlacement image_placement;
- double image_alpha;
- GdkColor color1;
- GdkColor color2;
- ColorShading color_shading;
-
- cairo_surface_t *surf;
- cairo_pattern_t *pat;
- int pat_width;
- int pat_height;
-};
-
-enum {
- PROP_0,
-};
-
-#define KEY_DIR "/desktop/gnome/background"
-#define KEY_DRAW_BACKGROUND KEY_DIR "/draw_background"
-#define KEY_PRIMARY_COLOR KEY_DIR "/primary_color"
-#define KEY_SECONDARY_COLOR KEY_DIR "/secondary_color"
-#define KEY_COLOR_SHADING_TYPE KEY_DIR "/color_shading_type"
-#define KEY_PICTURE_OPTIONS KEY_DIR "/picture_options"
-#define KEY_PICTURE_OPACITY KEY_DIR "/picture_opacity"
-#define KEY_PICTURE_FILENAME KEY_DIR "/picture_filename"
-
-static void gdm_greeter_background_class_init (GdmGreeterBackgroundClass *klass);
-static void gdm_greeter_background_init (GdmGreeterBackground *greeter_background);
-static void gdm_greeter_background_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmGreeterBackground, gdm_greeter_background, GTK_TYPE_WINDOW)
-
-static void
-gdm_greeter_background_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmGreeterBackground *self;
-
- self = GDM_GREETER_BACKGROUND (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_greeter_background_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmGreeterBackground *self;
-
- self = GDM_GREETER_BACKGROUND (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static BackgroundImagePlacement
-read_background_image_placement_from_string (const char *string)
-{
- BackgroundImagePlacement placement = BACKGROUND_NONE;
-
- if (string != NULL) {
- if (! strncmp (string, "wallpaper", sizeof ("wallpaper"))) {
- placement = BACKGROUND_TILED;
- } else if (! strncmp (string, "centered", sizeof ("centered"))) {
- placement = BACKGROUND_CENTERED;
- } else if (! strncmp (string, "scaled", sizeof ("scaled"))) {
- placement = BACKGROUND_SCALED_ASPECT;
- } else if (! strncmp (string, "stretched", sizeof ("stretched"))) {
- placement = BACKGROUND_SCALED;
- } else if (! strncmp (string, "zoom", sizeof ("zoom"))) {
- placement = BACKGROUND_ZOOM;
- }
- }
-
- return placement;
-}
-
-static ColorShading
-read_color_shading_from_string (const char *string)
-{
- ColorShading shading = COLOR_SHADING_SOLID;
-
- if (string != NULL) {
- if (! strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) {
- shading = COLOR_SHADING_VERTICAL;
- } else if (! strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) {
- shading = COLOR_SHADING_HORIZONTAL;
- }
- }
-
- return shading;
-}
-
-static void
-on_key_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- const char *key;
- GConfValue *value;
-
- key = gconf_entry_get_key (entry);
-
- if (! g_str_has_prefix (key, KEY_DIR)) {
- return;
- }
-
- value = gconf_entry_get_value (entry);
-
- /* FIXME: */
- if (strcmp (key, KEY_PICTURE_FILENAME) == 0) {
- }
-}
-
-static void
-settings_init (GdmGreeterBackground *background)
-{
- GConfClient *client;
- GError *error;
- char *tmp;
- int opacity;
-
- client = gconf_client_get_default ();
-
- gconf_client_add_dir (client,
- KEY_DIR,
- GCONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- gconf_client_notify_add (client,
- KEY_DIR,
- on_key_changed,
- NULL,
- NULL,
- NULL);
-
- error = NULL;
- background->priv->background_enabled = gconf_client_get_bool (client, KEY_DRAW_BACKGROUND, &error);
- if (error != NULL) {
- g_warning ("Error reading key: %s", error->message);
- g_error_free (error);
- }
-
- tmp = gconf_client_get_string (client, KEY_PICTURE_FILENAME, &error);
- if (error != NULL) {
- g_warning ("Error reading key: %s", error->message);
- g_error_free (error);
- }
- if (tmp != NULL) {
- if (g_utf8_validate (tmp, -1, NULL)) {
- background->priv->image_filename = g_strdup (tmp);
- } else {
- background->priv->image_filename = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL);
- }
- }
- g_free (tmp);
-
- tmp = gconf_client_get_string (client, KEY_PRIMARY_COLOR, &error);
- if (error != NULL) {
- g_warning ("Error reading key: %s", error->message);
- g_error_free (error);
- }
- if (! gdk_color_parse (tmp, &background->priv->color1)) {
- g_warning ("Unable to parse color: %s", tmp);
- }
- g_free (tmp);
-
- tmp = gconf_client_get_string (client, KEY_SECONDARY_COLOR, &error);
- if (error != NULL) {
- g_warning ("Error reading key: %s", error->message);
- g_error_free (error);
- }
- if (! gdk_color_parse (tmp, &background->priv->color2)) {
- g_warning ("Unable to parse color: %s", tmp);
- }
- g_free (tmp);
-
- opacity = gconf_client_get_int (client, KEY_PICTURE_OPACITY, &error);
- if (error != NULL) {
- g_warning ("Error reading key: %s", error->message);
- g_error_free (error);
- }
- if (opacity >= 100 || opacity < 0) {
- opacity = 100;
- }
- background->priv->image_alpha = opacity / 100.0;
-
- tmp = gconf_client_get_string (client, KEY_COLOR_SHADING_TYPE, &error);
- background->priv->color_shading = read_color_shading_from_string (tmp);
- g_free (tmp);
-
- tmp = gconf_client_get_string (client, KEY_PICTURE_OPTIONS, &error);
- background->priv->image_placement = read_background_image_placement_from_string (tmp);
- g_free (tmp);
-
- g_object_unref (client);
-}
-
-static GdkPixbuf *
-scale_pixbuf (GdkPixbuf *pixbuf,
- int max_width,
- int max_height,
- gboolean no_stretch_hint)
-{
- int pw;
- int ph;
- float scale_factor_x = 1.0;
- float scale_factor_y = 1.0;
- float scale_factor = 1.0;
-
- g_assert (pixbuf != NULL);
- g_assert (max_width > 0);
- g_assert (max_height > 0);
-
- pw = gdk_pixbuf_get_width (pixbuf);
- ph = gdk_pixbuf_get_height (pixbuf);
-
- /* Determine which dimension requires the smallest scale. */
- scale_factor_x = (float) max_width / (float) pw;
- scale_factor_y = (float) max_height / (float) ph;
-
- if (scale_factor_x > scale_factor_y) {
- scale_factor = scale_factor_y;
- } else {
- scale_factor = scale_factor_x;
- }
-
- /* always scale down, allow to disable scaling up */
- if (scale_factor < 1.0 || !no_stretch_hint) {
- int scale_x = (int) (pw * scale_factor);
- int scale_y = (int) (ph * scale_factor);
-
- return gdk_pixbuf_scale_simple (pixbuf,
- scale_x,
- scale_y,
- GDK_INTERP_BILINEAR);
- } else {
- return g_object_ref (pixbuf);
- }
-}
-
-static int
-cairo_surface_get_width (cairo_surface_t *surface)
-{
- cairo_surface_type_t surf_type;
- int w;
-
- surf_type = cairo_surface_get_type (surface);
-
- w = 0;
-
- switch (surf_type) {
-#if CAIRO_HAS_XLIB_SURFACE
- case CAIRO_SURFACE_TYPE_XLIB:
- w = cairo_xlib_surface_get_width (surface);
- break;
-#endif
- case CAIRO_SURFACE_TYPE_IMAGE:
- w = cairo_image_surface_get_width (surface);
- break;
- default:
- g_warning ("Unknown surface type: %d", surf_type);
- break;
- }
-
- return w;
-}
-
-static int
-cairo_surface_get_height (cairo_surface_t *surface)
-{
- cairo_surface_type_t surf_type;
- int w;
-
- surf_type = cairo_surface_get_type (surface);
-
- w = 0;
-
- g_debug ("Surface type %d", surf_type);
- switch (surf_type) {
-#if CAIRO_HAS_XLIB_SURFACE
- case CAIRO_SURFACE_TYPE_XLIB:
- w = cairo_xlib_surface_get_height (surface);
- break;
-#endif
- case CAIRO_SURFACE_TYPE_IMAGE:
- w = cairo_image_surface_get_height (surface);
- break;
- default:
- g_warning ("Unknown surface type: %d", surf_type);
- break;
- }
-
- return w;
-}
-
-static void
-update_surface (GdmGreeterBackground *background)
-{
-
- g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (background)));
-
- if (background->priv->surf == NULL
- || cairo_surface_get_width (background->priv->surf) != background->priv->geometry.width
- || cairo_surface_get_height (background->priv->surf) != background->priv->geometry.height) {
- cairo_t *cr;
-
- if (background->priv->surf != NULL) {
- g_debug ("Destroying existing surface w:%d h:%d",
- cairo_image_surface_get_width (background->priv->surf),
- cairo_image_surface_get_height (background->priv->surf));
- cairo_surface_destroy (background->priv->surf);
- }
-
- g_debug ("Creating a new surface for the background w:%d h:%d",
- background->priv->geometry.width,
- background->priv->geometry.height);
-
- cr = gdk_cairo_create (GTK_WIDGET (background)->window);
- background->priv->surf = cairo_surface_create_similar (cairo_get_target (cr),
- CAIRO_CONTENT_COLOR,
- background->priv->geometry.width,
- background->priv->geometry.height);
- g_debug ("Created surface w:%d h:%d",
- cairo_surface_get_width (background->priv->surf),
- cairo_surface_get_height (background->priv->surf));
- cairo_destroy (cr);
- }
-
-}
-
-static void
-load_image (GdmGreeterBackground *background)
-{
- GdkPixbuf *pixbuf;
- GdkPixbuf *scaled;
- cairo_t *cr;
- int pw, ph;
- GError *error;
-
- g_debug ("Loading background from %s", background->priv->image_filename);
- error = NULL;
- pixbuf = gdk_pixbuf_new_from_file (background->priv->image_filename, &error);
- if (pixbuf == NULL) {
- g_warning ("Unable to load image: %s", error->message);
- g_error_free (error);
- return;
- }
-
- scaled = scale_pixbuf (pixbuf,
- background->priv->geometry.width,
- background->priv->geometry.height,
- TRUE);
- if (scaled != NULL) {
- g_object_unref (pixbuf);
- pixbuf = scaled;
- }
-
- pw = gdk_pixbuf_get_width (pixbuf);
- ph = gdk_pixbuf_get_height (pixbuf);
-
- if (background->priv->pat != NULL) {
- cairo_pattern_destroy (background->priv->pat);
- }
-
- update_surface (background);
-
- g_assert (background->priv->surf != NULL);
-
- cr = cairo_create (background->priv->surf);
-
- /* XXX Handle out of memory? */
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
-
- background->priv->pat = cairo_pattern_reference (cairo_get_source (cr));
- background->priv->pat_width = pw;
- background->priv->pat_height = ph;
-
- cairo_destroy (cr);
- g_object_unref (pixbuf);
-}
-
-static void
-update_background (GdmGreeterBackground *background)
-{
- cairo_t *cr;
-
- if (background->priv->geometry.width <= 0
- || background->priv->geometry.height <= 0) {
- /* we haven't gotten a configure yet - so don't bother */
- return;
- }
-
- cr = gdk_cairo_create (GTK_WIDGET (background)->window);
-
- g_debug ("Clearing background");
-
- /* always clear to black */
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0, 0, background->priv->geometry.width, background->priv->geometry.height);
- cairo_fill (cr);
-
- if (background->priv->image_filename != NULL
- && background->priv->image_filename[0] != '\0'
- && background->priv->image_placement != BACKGROUND_NONE) {
-
- if (background->priv->pat == NULL) {
- load_image (background);
-
- if (background->priv->pat == NULL) {
- goto out;
- }
- }
-
- if (background->priv->image_placement == BACKGROUND_SCALED) {
- double sx, sy;
-
- sx = (double)background->priv->geometry.width / background->priv->pat_width;
- sy = (double)background->priv->geometry.height / background->priv->pat_height;
- cairo_scale (cr, sx, sy);
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- g_warning ("couldn't scale background: %s", cairo_status_to_string (cairo_status (cr)));
- }
-
- g_debug ("scaling w:%d sx:%f sy:%f", background->priv->geometry.width, sx, sy);
-
- cairo_pattern_set_extend (background->priv->pat, CAIRO_EXTEND_NONE);
-
- } else if (background->priv->image_placement == BACKGROUND_SCALED_ASPECT) {
- double sx, sy, s;
- double dx, dy;
-
- sx = (double)background->priv->geometry.width / background->priv->pat_width;
- sy = (double)background->priv->geometry.height / background->priv->pat_height;
-
- /* scale up long dimension */
- s = MIN (sx, sy);
- cairo_scale (cr, s, s);
-
- dx = dy = 0;
- /* now center short dimension */
- if (sy > sx) {
- dy = (double)background->priv->geometry.height - background->priv->pat_height * s;
- } else {
- dx = (double)background->priv->geometry.width - background->priv->pat_width * s;
- }
- cairo_translate (cr, dx / 2, dy / 2);
- g_debug ("aspect scaling w:%d scale:%f dx:%f dy:%f", background->priv->geometry.width, s, dx, dy);
- cairo_pattern_set_extend (background->priv->pat, CAIRO_EXTEND_NONE);
-
- } else if (background->priv->image_placement == BACKGROUND_TILED) {
- cairo_pattern_set_extend (background->priv->pat, CAIRO_EXTEND_REPEAT);
- } else {
- /* centered */
- double dx, dy;
-
- dx = (double)background->priv->geometry.width - background->priv->pat_width;
- dy = (double)background->priv->geometry.height - background->priv->pat_height;
- cairo_translate (cr, dx / 2, dy / 2);
- g_debug ("centering dx:%f dy:%f", dx, dy);
-
- cairo_pattern_set_extend (background->priv->pat, CAIRO_EXTEND_NONE);
- }
-
- g_debug ("Painting background with alpha %f", background->priv->image_alpha);
- cairo_set_source (cr, background->priv->pat);
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- g_warning ("couldn't set pattern source: %s", cairo_status_to_string (cairo_status (cr)));
- }
- cairo_paint_with_alpha (cr, background->priv->image_alpha);
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- g_warning ("couldn't paint background: %s", cairo_status_to_string (cairo_status (cr)));
- }
-
- } else if (background->priv->color_shading != COLOR_SHADING_SOLID) {
- cairo_pattern_t *pat;
- g_debug ("color gradient");
-
- if (background->priv->color_shading == COLOR_SHADING_VERTICAL) {
- pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, background->priv->geometry.height);
- } else {
- pat = cairo_pattern_create_linear (0.0, 0.0, background->priv->geometry.width, 0.0);
- }
-
- cairo_pattern_add_color_stop_rgba (pat,
- 0,
- background->priv->color1.red / 65535.0,
- background->priv->color1.green / 65535.0,
- background->priv->color1.blue / 65535.0,
- 1.0);
- cairo_pattern_add_color_stop_rgba (pat,
- 1,
- background->priv->color2.red / 65535.0,
- background->priv->color2.green / 65535.0,
- background->priv->color2.blue / 65535.0,
- 1.0);
-
- cairo_set_source (cr, pat);
-
- cairo_rectangle (cr, 0, 0, background->priv->geometry.width, background->priv->geometry.height);
- cairo_fill (cr);
- cairo_pattern_destroy (pat);
- } else {
- g_debug ("solid color");
- cairo_set_source_rgba (cr,
- background->priv->color1.red / 65535.0,
- background->priv->color1.green / 65535.0,
- background->priv->color1.blue / 65535.0,
- 1.0);
- cairo_rectangle (cr, 0, 0, background->priv->geometry.width, background->priv->geometry.height);
- cairo_fill (cr);
- }
-
-out:
- cairo_destroy (cr);
-}
-
-static GObject *
-gdm_greeter_background_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmGreeterBackground *background;
- GdmGreeterBackgroundClass *klass;
-
- klass = GDM_GREETER_BACKGROUND_CLASS (g_type_class_peek (GDM_TYPE_GREETER_BACKGROUND));
-
- background = GDM_GREETER_BACKGROUND (G_OBJECT_CLASS (gdm_greeter_background_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- settings_init (background);
-
- return G_OBJECT (background);
-}
-
-static void
-gdm_greeter_background_dispose (GObject *object)
-{
- GdmGreeterBackground *greeter_background;
-
- greeter_background = GDM_GREETER_BACKGROUND (object);
-
- G_OBJECT_CLASS (gdm_greeter_background_parent_class)->dispose (object);
-}
-
-static void
-gdm_greeter_background_real_map (GtkWidget *widget)
-{
- if (GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->map) {
- GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->map (widget);
- }
-
- /*gdk_window_lower (widget->window);*/
-}
-
-static void
-on_screen_size_changed (GdkScreen *screen,
- GdmGreeterBackground *background)
-{
- gtk_widget_queue_resize (GTK_WIDGET (background));
-}
-
-static void
-gdm_greeter_background_real_realize (GtkWidget *widget)
-{
- if (GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->realize) {
- GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->realize (widget);
- }
- gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
- g_signal_connect (gtk_window_get_screen (GTK_WINDOW (widget)),
- "size_changed",
- G_CALLBACK (on_screen_size_changed),
- widget);
-}
-
-static void
-gdm_greeter_background_real_unrealize (GtkWidget *widget)
-{
- g_signal_handlers_disconnect_by_func (gtk_window_get_screen (GTK_WINDOW (widget)),
- on_screen_size_changed,
- widget);
-
- if (GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->unrealize) {
- GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->unrealize (widget);
- }
-}
-
-/* copied from panel-toplevel.c */
-static void
-gdm_greeter_background_move_resize_window (GdmGreeterBackground *background,
- gboolean move,
- gboolean resize)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (background);
-
- g_assert (GTK_WIDGET_REALIZED (widget));
-
- if (move && resize) {
- gdk_window_move_resize (widget->window,
- background->priv->geometry.x,
- background->priv->geometry.y,
- background->priv->geometry.width,
- background->priv->geometry.height);
- } else if (move) {
- gdk_window_move (widget->window,
- background->priv->geometry.x,
- background->priv->geometry.y);
- } else if (resize) {
- gdk_window_resize (widget->window,
- background->priv->geometry.width,
- background->priv->geometry.height);
- }
-}
-
-static GdkRegion *
-get_outside_region (GdmGreeterBackground *background)
-{
- int i;
- GdkRegion *region;
-
- region = gdk_region_new ();
- for (i = 0; i < background->priv->monitor; i++) {
- GdkRectangle geometry;
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (background)->screen,
- i,
- &geometry);
- gdk_region_union_with_rect (region, &geometry);
- }
-
- return region;
-}
-
-static void
-get_monitor_geometry (GdmGreeterBackground *background,
- GdkRectangle *geometry)
-{
- GdkRegion *outside_region;
- GdkRegion *monitor_region;
- GdkRectangle geom;
-
- outside_region = get_outside_region (background);
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (background)->screen,
- background->priv->monitor,
- &geom);
- monitor_region = gdk_region_rectangle (&geom);
- gdk_region_subtract (monitor_region, outside_region);
- gdk_region_destroy (outside_region);
-
- gdk_region_get_clipbox (monitor_region, geometry);
- gdk_region_destroy (monitor_region);
-}
-
-static void
-update_geometry (GdmGreeterBackground *background,
- GtkRequisition *requisition)
-{
- GdkRectangle geometry;
- int height;
-
- get_monitor_geometry (background, &geometry);
-
- height = requisition->height;
- background->priv->geometry.width = geometry.width;
- background->priv->geometry.height = geometry.height;
-
- background->priv->geometry.x = geometry.x;
- background->priv->geometry.y = geometry.y;
-
- g_debug ("Setting background geometry x:%d y:%d w:%d h:%d",
- background->priv->geometry.x,
- background->priv->geometry.y,
- background->priv->geometry.width,
- background->priv->geometry.height);
-}
-
-static void
-gdm_greeter_background_real_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GdmGreeterBackground *background;
- GtkBin *bin;
- GdkRectangle old_geometry;
- int position_changed = FALSE;
- int size_changed = FALSE;
-
- background = GDM_GREETER_BACKGROUND (widget);
- bin = GTK_BIN (widget);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- gtk_widget_size_request (bin->child, requisition);
- }
-
- old_geometry = background->priv->geometry;
-
- update_geometry (background, requisition);
-
- requisition->width = background->priv->geometry.width;
- requisition->height = background->priv->geometry.height;
-
- if (! GTK_WIDGET_REALIZED (widget)) {
- return;
- }
-
- if (old_geometry.width != background->priv->geometry.width ||
- old_geometry.height != background->priv->geometry.height) {
- size_changed = TRUE;
- }
-
- if (old_geometry.x != background->priv->geometry.x ||
- old_geometry.y != background->priv->geometry.y) {
- position_changed = TRUE;
- }
-
- gdm_greeter_background_move_resize_window (background, position_changed, size_changed);
-}
-
-static gboolean
-gdm_greeter_background_real_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- gboolean handled = FALSE;
-
- g_debug ("Exposing the background");
-
- if (GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->expose_event) {
- handled = GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->expose_event (widget, event);
- }
-
- update_background (GDM_GREETER_BACKGROUND (widget));
-
- return handled;
-}
-
-static gboolean
-gdm_greeter_background_real_configure (GtkWidget *widget,
- GdkEventConfigure *event)
-{
- gboolean handled;
-
- handled = FALSE;
-
- g_debug ("Background configure w: %d h: %d", event->width, event->height);
- if (GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->configure_event) {
- handled = GTK_WIDGET_CLASS (gdm_greeter_background_parent_class)->configure_event (widget, event);
- }
-
- return handled;
-}
-
-static void
-gdm_greeter_background_class_init (GdmGreeterBackgroundClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->get_property = gdm_greeter_background_get_property;
- object_class->set_property = gdm_greeter_background_set_property;
- object_class->constructor = gdm_greeter_background_constructor;
- object_class->dispose = gdm_greeter_background_dispose;
- object_class->finalize = gdm_greeter_background_finalize;
-
- widget_class->map = gdm_greeter_background_real_map;
- widget_class->realize = gdm_greeter_background_real_realize;
- widget_class->unrealize = gdm_greeter_background_real_unrealize;
- widget_class->expose_event = gdm_greeter_background_real_expose;
- widget_class->configure_event = gdm_greeter_background_real_configure;
- widget_class->size_request = gdm_greeter_background_real_size_request;
-
- g_type_class_add_private (klass, sizeof (GdmGreeterBackgroundPrivate));
-}
-
-static gint
-on_delete_event (GdmGreeterBackground *background)
-{
- /* Returning true tells GTK+ not to delete the window. */
- return TRUE;
-}
-
-static void
-gdm_greeter_background_init (GdmGreeterBackground *background)
-{
- background->priv = GDM_GREETER_BACKGROUND_GET_PRIVATE (background);
-
- gtk_window_set_decorated (GTK_WINDOW (background), FALSE);
- gtk_widget_set_app_paintable (GTK_WIDGET (background), TRUE);
-
- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (background), TRUE);
- gtk_window_set_skip_pager_hint (GTK_WINDOW (background), TRUE);
- gtk_window_set_type_hint (GTK_WINDOW (background), GDK_WINDOW_TYPE_HINT_DESKTOP);
- gtk_window_fullscreen (GTK_WINDOW (background));
-
- g_signal_connect (background, "delete_event", G_CALLBACK (on_delete_event), NULL);
-}
-
-static void
-gdm_greeter_background_finalize (GObject *object)
-{
- GdmGreeterBackground *greeter_background;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_GREETER_BACKGROUND (object));
-
- greeter_background = GDM_GREETER_BACKGROUND (object);
-
- g_return_if_fail (greeter_background->priv != NULL);
-
- G_OBJECT_CLASS (gdm_greeter_background_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_greeter_background_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_GREETER_BACKGROUND,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-greeter-background.h b/gui/simple-greeter/gdm-greeter-background.h
deleted file mode 100644
index d38b3cb4..00000000
--- a/gui/simple-greeter/gdm-greeter-background.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_GREETER_BACKGROUND_H
-#define __GDM_GREETER_BACKGROUND_H
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_GREETER_BACKGROUND (gdm_greeter_background_get_type ())
-#define GDM_GREETER_BACKGROUND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_GREETER_BACKGROUND, GdmGreeterBackground))
-#define GDM_GREETER_BACKGROUND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_GREETER_BACKGROUND, GdmGreeterBackgroundClass))
-#define GDM_IS_GREETER_BACKGROUND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_GREETER_BACKGROUND))
-#define GDM_IS_GREETER_BACKGROUND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_GREETER_BACKGROUND))
-#define GDM_GREETER_BACKGROUND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_GREETER_BACKGROUND, GdmGreeterBackgroundClass))
-
-typedef struct GdmGreeterBackgroundPrivate GdmGreeterBackgroundPrivate;
-
-typedef struct
-{
- GtkWindow parent;
- GdmGreeterBackgroundPrivate *priv;
-} GdmGreeterBackground;
-
-typedef struct
-{
- GtkWindowClass parent_class;
-} GdmGreeterBackgroundClass;
-
-GType gdm_greeter_background_get_type (void);
-
-GtkWidget * gdm_greeter_background_new (void);
-
-G_END_DECLS
-
-#endif /* __GDM_GREETER_BACKGROUND_H */
diff --git a/gui/simple-greeter/gdm-greeter-panel.c b/gui/simple-greeter/gdm-greeter-panel.c
deleted file mode 100644
index a41ec172..00000000
--- a/gui/simple-greeter/gdm-greeter-panel.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include "gdm-greeter-panel.h"
-
-#include "na-tray.h"
-
-#define GDM_GREETER_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_PANEL, GdmGreeterPanelPrivate))
-
-struct GdmGreeterPanelPrivate
-{
- int monitor;
- GdkRectangle geometry;
- GtkWidget *hbox;
-};
-
-enum {
- PROP_0,
-};
-
-static void gdm_greeter_panel_class_init (GdmGreeterPanelClass *klass);
-static void gdm_greeter_panel_init (GdmGreeterPanel *greeter_panel);
-static void gdm_greeter_panel_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmGreeterPanel, gdm_greeter_panel, GTK_TYPE_WINDOW)
-
-static void
-gdm_greeter_panel_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmGreeterPanel *self;
-
- self = GDM_GREETER_PANEL (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_greeter_panel_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmGreeterPanel *self;
-
- self = GDM_GREETER_PANEL (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_greeter_panel_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmGreeterPanel *greeter_panel;
- GdmGreeterPanelClass *klass;
-
- klass = GDM_GREETER_PANEL_CLASS (g_type_class_peek (GDM_TYPE_GREETER_PANEL));
-
- greeter_panel = GDM_GREETER_PANEL (G_OBJECT_CLASS (gdm_greeter_panel_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (greeter_panel);
-}
-
-static void
-gdm_greeter_panel_dispose (GObject *object)
-{
- GdmGreeterPanel *greeter_panel;
-
- greeter_panel = GDM_GREETER_PANEL (object);
-
- g_debug ("Disposing greeter_panel");
-
- G_OBJECT_CLASS (gdm_greeter_panel_parent_class)->dispose (object);
-}
-
-/* copied from panel-toplevel.c */
-static void
-gdm_greeter_panel_move_resize_window (GdmGreeterPanel *panel,
- gboolean move,
- gboolean resize)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (panel);
-
- g_assert (GTK_WIDGET_REALIZED (widget));
-
- if (move && resize) {
- gdk_window_move_resize (widget->window,
- panel->priv->geometry.x,
- panel->priv->geometry.y,
- panel->priv->geometry.width,
- panel->priv->geometry.height);
- } else if (move) {
- gdk_window_move (widget->window,
- panel->priv->geometry.x,
- panel->priv->geometry.y);
- } else if (resize) {
- gdk_window_resize (widget->window,
- panel->priv->geometry.width,
- panel->priv->geometry.height);
- }
-}
-
-static void
-on_screen_size_changed (GdkScreen *screen,
- GdmGreeterPanel *panel)
-{
- gtk_widget_queue_resize (GTK_WIDGET (panel));
-}
-
-static void
-gdm_greeter_panel_real_realize (GtkWidget *widget)
-{
- if (GTK_WIDGET_CLASS (gdm_greeter_panel_parent_class)->realize) {
- GTK_WIDGET_CLASS (gdm_greeter_panel_parent_class)->realize (widget);
- }
-
- gdm_greeter_panel_move_resize_window (GDM_GREETER_PANEL (widget), TRUE, TRUE);
-
- g_signal_connect (gtk_window_get_screen (GTK_WINDOW (widget)),
- "size_changed",
- G_CALLBACK (on_screen_size_changed),
- widget);
-}
-
-static void
-gdm_greeter_panel_real_unrealize (GtkWidget *widget)
-{
- g_signal_handlers_disconnect_by_func (gtk_window_get_screen (GTK_WINDOW (widget)),
- on_screen_size_changed,
- widget);
-
- if (GTK_WIDGET_CLASS (gdm_greeter_panel_parent_class)->unrealize) {
- GTK_WIDGET_CLASS (gdm_greeter_panel_parent_class)->unrealize (widget);
- }
-}
-
-static GdkRegion *
-get_outside_region (GdmGreeterPanel *panel)
-{
- int i;
- GdkRegion *region;
-
- region = gdk_region_new ();
- for (i = 0; i < panel->priv->monitor; i++) {
- GdkRectangle geometry;
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
- i,
- &geometry);
- gdk_region_union_with_rect (region, &geometry);
- }
-
- return region;
-}
-
-static void
-get_monitor_geometry (GdmGreeterPanel *panel,
- GdkRectangle *geometry)
-{
- GdkRegion *outside_region;
- GdkRegion *monitor_region;
- GdkRectangle geom;
-
- outside_region = get_outside_region (panel);
-
- gdk_screen_get_monitor_geometry (GTK_WINDOW (panel)->screen,
- panel->priv->monitor,
- &geom);
- monitor_region = gdk_region_rectangle (&geom);
- gdk_region_subtract (monitor_region, outside_region);
- gdk_region_destroy (outside_region);
-
- gdk_region_get_clipbox (monitor_region, geometry);
- gdk_region_destroy (monitor_region);
-}
-
-static void
-set_struts (GdmGreeterPanel *panel,
- int x,
- int y,
- int width,
- int height)
-{
- gulong data[12] = { 0, };
- int screen_height;
-
- /* _NET_WM_STRUT_PARTIAL: CARDINAL[12]/32
- *
- * 0: left 1: right 2: top 3: bottom
- * 4: left_start_y 5: left_end_y 6: right_start_y 7: right_end_y
- * 8: top_start_x 9: top_end_x 10: bottom_start_x 11: bottom_end_x
- *
- * Note: In xinerama use struts relative to combined screen dimensions,
- * not just the current monitor.
- */
-
- /* for bottom panel */
- screen_height = gdk_screen_get_height (gtk_window_get_screen (GTK_WINDOW (panel)));
-
- /* bottom */
- data[3] = screen_height - panel->priv->geometry.y - panel->priv->geometry.height + height;
- /* bottom_start_x */
- data[10] = x;
- /* bottom_end_x */
- data[11] = x + width;
-
- g_debug ("Setting strut: bottom=%lu bottom_start_x=%lu bottom_end_x=%lu", data[3], data[10], data[11]);
-
- gdk_error_trap_push ();
-
- gdk_property_change (GTK_WIDGET (panel)->window,
- gdk_atom_intern ("_NET_WM_STRUT_PARTIAL", FALSE),
- gdk_atom_intern ("CARDINAL", FALSE),
- 32,
- GDK_PROP_MODE_REPLACE,
- (guchar *) &data,
- 12);
-
- gdk_property_change (GTK_WIDGET (panel)->window,
- gdk_atom_intern ("_NET_WM_STRUT", FALSE),
- gdk_atom_intern ("CARDINAL", FALSE),
- 32,
- GDK_PROP_MODE_REPLACE,
- (guchar *) &data,
- 4);
-
- gdk_error_trap_pop ();
-}
-
-static void
-update_struts (GdmGreeterPanel *panel)
-{
- GdkRectangle geometry;
-
- get_monitor_geometry (panel, &geometry);
-
- /* FIXME: assumes only one panel */
- set_struts (panel,
- panel->priv->geometry.x,
- panel->priv->geometry.y,
- panel->priv->geometry.width,
- panel->priv->geometry.height);
-}
-
-static void
-update_geometry (GdmGreeterPanel *panel,
- GtkRequisition *requisition)
-{
- GdkRectangle geometry;
- int height;
-
- get_monitor_geometry (panel, &geometry);
-
- height = requisition->height;
- panel->priv->geometry.width = geometry.width;
- panel->priv->geometry.height = height * 2;
-
- panel->priv->geometry.x = geometry.x;
- panel->priv->geometry.y = geometry.y + geometry.height - panel->priv->geometry.height;
-
- g_debug ("Setting geometry x:%d y:%d w:%d h:%d",
- panel->priv->geometry.x,
- panel->priv->geometry.y,
- panel->priv->geometry.width,
- panel->priv->geometry.height);
-
- update_struts (panel);
-}
-
-static void
-gdm_greeter_panel_real_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GdmGreeterPanel *panel;
- GtkBin *bin;
- GdkRectangle old_geometry;
- int position_changed = FALSE;
- int size_changed = FALSE;
-
- panel = GDM_GREETER_PANEL (widget);
- bin = GTK_BIN (widget);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- gtk_widget_size_request (bin->child, requisition);
- }
-
- old_geometry = panel->priv->geometry;
-
- update_geometry (panel, requisition);
-
- requisition->width = panel->priv->geometry.width;
- requisition->height = panel->priv->geometry.height;
-
- if (! GTK_WIDGET_REALIZED (widget)) {
- return;
- }
-
- if (old_geometry.width != panel->priv->geometry.width ||
- old_geometry.height != panel->priv->geometry.height) {
- size_changed = TRUE;
- }
-
- if (old_geometry.x != panel->priv->geometry.x ||
- old_geometry.y != panel->priv->geometry.y) {
- position_changed = TRUE;
- }
-
- gdm_greeter_panel_move_resize_window (panel, position_changed, size_changed);
-}
-
-static void
-gdm_greeter_panel_class_init (GdmGreeterPanelClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->get_property = gdm_greeter_panel_get_property;
- object_class->set_property = gdm_greeter_panel_set_property;
- object_class->constructor = gdm_greeter_panel_constructor;
- object_class->dispose = gdm_greeter_panel_dispose;
- object_class->finalize = gdm_greeter_panel_finalize;
-
- widget_class->realize = gdm_greeter_panel_real_realize;
- widget_class->unrealize = gdm_greeter_panel_real_unrealize;
- widget_class->size_request = gdm_greeter_panel_real_size_request;
-
- g_type_class_add_private (klass, sizeof (GdmGreeterPanelPrivate));
-}
-
-static void
-gdm_greeter_panel_init (GdmGreeterPanel *panel)
-{
- GtkWidget *label;
- NaTray *tray;
-
- panel->priv = GDM_GREETER_PANEL_GET_PRIVATE (panel);
-
- panel->priv->geometry.x = -1;
- panel->priv->geometry.y = -1;
- panel->priv->geometry.width = -1;
- panel->priv->geometry.height = -1;
-
- gtk_window_set_decorated (GTK_WINDOW (panel), FALSE);
-
- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (panel), TRUE);
- gtk_window_set_skip_pager_hint (GTK_WINDOW (panel), TRUE);
-
- gtk_window_set_keep_above (GTK_WINDOW (panel), TRUE);
- gtk_window_set_type_hint (GTK_WINDOW (panel), GDK_WINDOW_TYPE_HINT_DOCK);
- gtk_window_set_opacity (GTK_WINDOW (panel), 0.75);
-
- panel->priv->hbox = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (panel->priv->hbox);
- gtk_container_add (GTK_CONTAINER (panel), panel->priv->hbox);
-
- label = gtk_label_new (g_get_host_name ());
- gtk_box_pack_start (GTK_BOX (panel->priv->hbox), label, FALSE, FALSE, 6);
- gtk_widget_show (label);
-
- tray = na_tray_new_for_screen (gtk_window_get_screen (GTK_WINDOW (panel)),
- GTK_ORIENTATION_HORIZONTAL);
- gtk_box_pack_end (GTK_BOX (panel->priv->hbox), GTK_WIDGET (tray), FALSE, FALSE, 6);
- gtk_widget_show (GTK_WIDGET (tray));
-
-}
-
-static void
-gdm_greeter_panel_finalize (GObject *object)
-{
- GdmGreeterPanel *greeter_panel;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_GREETER_PANEL (object));
-
- greeter_panel = GDM_GREETER_PANEL (object);
-
- g_return_if_fail (greeter_panel->priv != NULL);
-
- G_OBJECT_CLASS (gdm_greeter_panel_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_greeter_panel_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_GREETER_PANEL,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-greeter-panel.h b/gui/simple-greeter/gdm-greeter-panel.h
deleted file mode 100644
index 21e2848e..00000000
--- a/gui/simple-greeter/gdm-greeter-panel.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_GREETER_PANEL_H
-#define __GDM_GREETER_PANEL_H
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_GREETER_PANEL (gdm_greeter_panel_get_type ())
-#define GDM_GREETER_PANEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_GREETER_PANEL, GdmGreeterPanel))
-#define GDM_GREETER_PANEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_GREETER_PANEL, GdmGreeterPanelClass))
-#define GDM_IS_GREETER_PANEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_GREETER_PANEL))
-#define GDM_IS_GREETER_PANEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_GREETER_PANEL))
-#define GDM_GREETER_PANEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_GREETER_PANEL, GdmGreeterPanelClass))
-
-typedef struct GdmGreeterPanelPrivate GdmGreeterPanelPrivate;
-
-typedef struct
-{
- GtkWindow parent;
- GdmGreeterPanelPrivate *priv;
-} GdmGreeterPanel;
-
-typedef struct
-{
- GtkWindowClass parent_class;
-} GdmGreeterPanelClass;
-
-GType gdm_greeter_panel_get_type (void);
-
-GtkWidget * gdm_greeter_panel_new (void);
-
-G_END_DECLS
-
-#endif /* __GDM_GREETER_PANEL_H */
diff --git a/gui/simple-greeter/gdm-language-chooser-dialog.c b/gui/simple-greeter/gdm-language-chooser-dialog.c
deleted file mode 100644
index 20ff64f6..00000000
--- a/gui/simple-greeter/gdm-language-chooser-dialog.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include "gdm-language-chooser-widget.h"
-#include "gdm-language-chooser-dialog.h"
-
-#define GDM_LANGUAGE_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG, GdmLanguageChooserDialogPrivate))
-
-struct GdmLanguageChooserDialogPrivate
-{
- GtkWidget *chooser_widget;
-};
-
-enum {
- PROP_0,
-};
-
-static void gdm_language_chooser_dialog_class_init (GdmLanguageChooserDialogClass *klass);
-static void gdm_language_chooser_dialog_init (GdmLanguageChooserDialog *language_chooser_dialog);
-static void gdm_language_chooser_dialog_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmLanguageChooserDialog, gdm_language_chooser_dialog, GTK_TYPE_DIALOG)
-
-char *
-gdm_language_chooser_dialog_get_current_language_name (GdmLanguageChooserDialog *dialog)
-{
- char *language_name;
-
- g_return_val_if_fail (GDM_IS_LANGUAGE_CHOOSER_DIALOG (dialog), NULL);
-
- language_name = gdm_language_chooser_widget_get_current_language_name (GDM_LANGUAGE_CHOOSER_WIDGET (dialog->priv->chooser_widget));
-
- return language_name;
-}
-
-static void
-gdm_language_chooser_dialog_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmLanguageChooserDialog *self;
-
- self = GDM_LANGUAGE_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_language_chooser_dialog_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmLanguageChooserDialog *self;
-
- self = GDM_LANGUAGE_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_language_chooser_dialog_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmLanguageChooserDialog *language_chooser_dialog;
- GdmLanguageChooserDialogClass *klass;
-
- klass = GDM_LANGUAGE_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_LANGUAGE_CHOOSER_DIALOG));
-
- language_chooser_dialog = GDM_LANGUAGE_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_language_chooser_dialog_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (language_chooser_dialog);
-}
-
-static void
-gdm_language_chooser_dialog_dispose (GObject *object)
-{
- GdmLanguageChooserDialog *language_chooser_dialog;
-
- language_chooser_dialog = GDM_LANGUAGE_CHOOSER_DIALOG (object);
-
- G_OBJECT_CLASS (gdm_language_chooser_dialog_parent_class)->dispose (object);
-}
-
-static void
-gdm_language_chooser_dialog_class_init (GdmLanguageChooserDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_language_chooser_dialog_get_property;
- object_class->set_property = gdm_language_chooser_dialog_set_property;
- object_class->constructor = gdm_language_chooser_dialog_constructor;
- object_class->dispose = gdm_language_chooser_dialog_dispose;
- object_class->finalize = gdm_language_chooser_dialog_finalize;
-
- g_type_class_add_private (klass, sizeof (GdmLanguageChooserDialogPrivate));
-}
-
-static void
-on_response (GdmLanguageChooserDialog *dialog,
- gint response_id)
-{
- switch (response_id) {
- default:
- break;
- }
-}
-
-static void
-gdm_language_chooser_dialog_init (GdmLanguageChooserDialog *dialog)
-{
-
- dialog->priv = GDM_LANGUAGE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
-
- dialog->priv->chooser_widget = gdm_language_chooser_widget_new ();
- gdm_language_chooser_widget_set_current_language_name (GDM_LANGUAGE_CHOOSER_WIDGET (dialog->priv->chooser_widget), g_getenv ("LANG"));
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (on_response),
- dialog);
-
- gtk_widget_show_all (GTK_WIDGET (dialog));
-}
-
-static void
-gdm_language_chooser_dialog_finalize (GObject *object)
-{
- GdmLanguageChooserDialog *language_chooser_dialog;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_LANGUAGE_CHOOSER_DIALOG (object));
-
- language_chooser_dialog = GDM_LANGUAGE_CHOOSER_DIALOG (object);
-
- g_return_if_fail (language_chooser_dialog->priv != NULL);
-
- G_OBJECT_CLASS (gdm_language_chooser_dialog_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_language_chooser_dialog_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_LANGUAGE_CHOOSER_DIALOG,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-language-chooser-dialog.h b/gui/simple-greeter/gdm-language-chooser-dialog.h
deleted file mode 100644
index c0221eb0..00000000
--- a/gui/simple-greeter/gdm-language-chooser-dialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_LANGUAGE_CHOOSER_DIALOG_H
-#define __GDM_LANGUAGE_CHOOSER_DIALOG_H
-
-#include <glib-object.h>
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_LANGUAGE_CHOOSER_DIALOG (gdm_language_chooser_dialog_get_type ())
-#define GDM_LANGUAGE_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG, GdmLanguageChooserDialog))
-#define GDM_LANGUAGE_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG, GdmLanguageChooserDialogClass))
-#define GDM_IS_LANGUAGE_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG))
-#define GDM_IS_LANGUAGE_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG))
-#define GDM_LANGUAGE_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_LANGUAGE_CHOOSER_DIALOG, GdmLanguageChooserDialogClass))
-
-typedef struct GdmLanguageChooserDialogPrivate GdmLanguageChooserDialogPrivate;
-
-typedef struct
-{
- GtkDialog parent;
- GdmLanguageChooserDialogPrivate *priv;
-} GdmLanguageChooserDialog;
-
-typedef struct
-{
- GtkDialogClass parent_class;
-} GdmLanguageChooserDialogClass;
-
-GType gdm_language_chooser_dialog_get_type (void);
-
-GtkWidget * gdm_language_chooser_dialog_new (void);
-
-char * gdm_language_chooser_dialog_get_current_language_name (GdmLanguageChooserDialog *dialog);
-
-G_END_DECLS
-
-#endif /* __GDM_LANGUAGE_CHOOSER_DIALOG_H */
diff --git a/gui/simple-greeter/gdm-language-chooser-widget.c b/gui/simple-greeter/gdm-language-chooser-widget.c
deleted file mode 100644
index 5921ec0d..00000000
--- a/gui/simple-greeter/gdm-language-chooser-widget.c
+++ /dev/null
@@ -1,1173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-#include <locale.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
-
-#include "gdm-language-chooser-widget.h"
-
-#include <langinfo.h>
-#ifndef __LC_LAST
-#define __LC_LAST 13
-#endif
-#include "locarchive.h"
-
-#define ALIASES_FILE LIBLOCALEDIR "/locale.alias"
-#define ARCHIVE_FILE LIBLOCALEDIR "/locale-archive"
-#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
-#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
-
-#define GDM_LANGUAGE_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET, GdmLanguageChooserWidgetPrivate))
-
-typedef struct _GdmChooserLocale {
- char *name;
- char *language_code;
- char *territory_code;
- char *codeset;
- char *modifier;
- char *title;
- char *language;
- char *territory;
-} GdmChooserLocale;
-
-struct GdmLanguageChooserWidgetPrivate
-{
- GtkWidget *treeview;
-
- GHashTable *languages;
- GHashTable *territories;
- GHashTable *available_locales;
-
- GdmChooserLocale *current_locale;
-};
-
-enum {
- PROP_0,
-};
-
-enum {
- LANGUAGE_ACTIVATED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
-static void gdm_language_chooser_widget_class_init (GdmLanguageChooserWidgetClass *klass);
-static void gdm_language_chooser_widget_init (GdmLanguageChooserWidget *language_chooser_widget);
-static void gdm_language_chooser_widget_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmLanguageChooserWidget, gdm_language_chooser_widget, GTK_TYPE_VBOX)
-
-enum {
- CHOOSER_LIST_TITLE_COLUMN = 0,
- CHOOSER_LIST_TRANSLATED_COLUMN,
- CHOOSER_LIST_LOCALE_COLUMN
-};
-
-static void
-chooser_locale_free (GdmChooserLocale *locale)
-{
- if (locale == NULL) {
- return;
- }
-
- g_free (locale->name);
- g_free (locale->title);
- g_free (locale->language);
- g_free (locale->territory);
- g_free (locale);
-}
-
-/*
- * According to http://en.wikipedia.org/wiki/Locale
- * locale names are of the form:
- * [language[_territory][.codeset][@modifier]]
- */
-static void
-parse_locale (const char *name,
- char **language_codep,
- char **territory_codep,
- char **codesetp,
- char **modifierp)
-{
- GRegex *re;
- GMatchInfo *match_info;
- gboolean res;
- GError *error;
-
- error = NULL;
- re = g_regex_new ("(?P<language>[a-zA-Z]+)(_(?P<territory>[a-zA-Z]+))?(.(?P<codeset>[0-9a-zA-Z]+))?(@(?P<modifier>[0-9a-zA-Z]+))?", 0, 0, &error);
- if (re == NULL) {
- g_critical (error->message);
- }
-
- g_regex_match (re, name, 0, &match_info);
-
- res = g_match_info_matches (match_info);
- if (! res) {
- g_warning ("Unable to parse locale: %s", name);
- return;
- }
-
- if (language_codep != NULL) {
- *language_codep = g_match_info_fetch_named (match_info, "language");
- }
-
- if (territory_codep != NULL) {
- *territory_codep = g_match_info_fetch_named (match_info, "territory");
- }
-
- if (codesetp != NULL) {
- *codesetp = g_match_info_fetch_named (match_info, "codeset");
- }
-
- if (modifierp != NULL) {
- *modifierp = g_match_info_fetch_named (match_info, "modifier");
- }
-
- g_match_info_free (match_info);
- g_regex_unref (re);
-}
-
-static char *
-construct_language_name (const char *language,
- const char *territory,
- const char *codeset,
- const char *modifier)
-{
- char *name;
-
- /* Ignore codeset and modifier for this */
- if (territory == NULL) {
- name = g_strdup (language);
- } else {
- name = g_strdup_printf ("%s_%s",
- language,
- territory);
- }
-
- return name;
-}
-
-char *
-gdm_language_chooser_widget_get_current_language_name (GdmLanguageChooserWidget *widget)
-{
- char *language_name;
-
- g_return_val_if_fail (GDM_IS_LANGUAGE_CHOOSER_WIDGET (widget), NULL);
-
- language_name = NULL;
- if (widget->priv->current_locale != NULL) {
- language_name = g_strdup (widget->priv->current_locale->name);
- }
-
- return language_name;
-}
-
-static void
-select_name (GdmLanguageChooserWidget *widget,
- const char *name)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = NULL;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (name != NULL && gtk_tree_model_get_iter_first (model, &iter)) {
-
- do {
- GdmChooserLocale *locale;
- gboolean found;
-
- gtk_tree_model_get (model,
- &iter,
- CHOOSER_LIST_LOCALE_COLUMN, &locale,
- -1);
- found = (locale != NULL
- && locale->name != NULL
- && strcmp (locale->name, name) == 0);
-
- if (found) {
- path = gtk_tree_model_get_path (model, &iter);
- break;
- }
-
- } while (gtk_tree_model_iter_next (model, &iter));
- }
-
- if (path != NULL) {
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- gtk_tree_view_get_column (GTK_TREE_VIEW (widget->priv->treeview), 0),
- TRUE, 0.5, 0.0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL,
- FALSE);
-
- gtk_tree_path_free (path);
- }
-}
-
-void
-gdm_language_chooser_widget_set_current_language_name (GdmLanguageChooserWidget *widget,
- const char *lang_name)
-{
- GtkTreeSelection *selection;
-
- g_return_if_fail (GDM_IS_LANGUAGE_CHOOSER_WIDGET (widget));
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (lang_name == NULL) {
- gtk_tree_selection_unselect_all (selection);
- } else {
- char *name;
- char *language_code;
- char *territory_code;
-
- language_code = NULL;
- territory_code = NULL;
-
- /* in case this is a locale name and not a short name */
- parse_locale (lang_name,
- &language_code,
- &territory_code,
- NULL,
- NULL);
-
- name = construct_language_name (language_code, territory_code, NULL, NULL);
- select_name (widget, name);
-
- g_free (name);
- g_free (language_code);
- g_free (territory_code);
- }
-}
-
-static void
-gdm_language_chooser_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmLanguageChooserWidget *self;
-
- self = GDM_LANGUAGE_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_language_chooser_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmLanguageChooserWidget *self;
-
- self = GDM_LANGUAGE_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_language_chooser_widget_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmLanguageChooserWidget *language_chooser_widget;
- GdmLanguageChooserWidgetClass *klass;
-
- klass = GDM_LANGUAGE_CHOOSER_WIDGET_CLASS (g_type_class_peek (GDM_TYPE_LANGUAGE_CHOOSER_WIDGET));
-
- language_chooser_widget = GDM_LANGUAGE_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_language_chooser_widget_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (language_chooser_widget);
-}
-
-static void
-gdm_language_chooser_widget_dispose (GObject *object)
-{
- GdmLanguageChooserWidget *widget;
-
- widget = GDM_LANGUAGE_CHOOSER_WIDGET (object);
-
- if (widget->priv->languages != NULL) {
- g_hash_table_destroy (widget->priv->languages);
- widget->priv->languages = NULL;
- }
-
- if (widget->priv->territories != NULL) {
- g_hash_table_destroy (widget->priv->territories);
- widget->priv->territories = NULL;
- }
-
- if (widget->priv->available_locales != NULL) {
- g_hash_table_destroy (widget->priv->available_locales);
- widget->priv->available_locales = NULL;
- }
-
- widget->priv->current_locale = NULL;
-
- G_OBJECT_CLASS (gdm_language_chooser_widget_parent_class)->dispose (object);
-}
-
-static void
-gdm_language_chooser_widget_class_init (GdmLanguageChooserWidgetClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_language_chooser_widget_get_property;
- object_class->set_property = gdm_language_chooser_widget_set_property;
- object_class->constructor = gdm_language_chooser_widget_constructor;
- object_class->dispose = gdm_language_chooser_widget_dispose;
- object_class->finalize = gdm_language_chooser_widget_finalize;
-
- signals [LANGUAGE_ACTIVATED] = g_signal_new ("language-activated",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmLanguageChooserWidgetClass, language_activated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_type_class_add_private (klass, sizeof (GdmLanguageChooserWidgetPrivate));
-}
-
-static void
-on_language_selected (GtkTreeSelection *selection,
- GdmLanguageChooserWidget *widget)
-{
- GtkTreeModel *model = NULL;
- GtkTreeIter iter = {0};
- GdmChooserLocale *locale;
-
- locale = NULL;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, CHOOSER_LIST_LOCALE_COLUMN, &locale, -1);
- }
-
- widget->priv->current_locale = locale;
-}
-
-static gboolean
-locale_exists (const char *loc)
-{
- gboolean ret;
- char *old;
-
- old = g_strdup (setlocale (LC_MESSAGES, NULL));
- if (setlocale (LC_MESSAGES, loc) != NULL) {
- ret = TRUE;
- } else {
- ret = FALSE;
- }
-
- setlocale (LC_MESSAGES, old);
- g_free (old);
-
- return ret;
-}
-
-static char *
-utf8_convert (const char *str,
- int len)
-{
- char *utf8;
-
- utf8 = g_locale_to_utf8 (str, len, NULL, NULL, NULL);
-
- /* if we couldn't convert text from locale then
- * assume utf-8 and hope for the best */
- if (utf8 == NULL) {
- char *p;
- char *q;
-
- if (len < 0) {
- utf8 = g_strdup (str);
- } else {
- utf8 = g_strndup (str, len);
- }
-
- p = utf8;
- while (*p != '\0' && !g_utf8_validate ((const char *)p, -1, (const char **)&q)) {
- *q = '?';
- p = q + 1;
- }
- }
-
- return utf8;
-}
-
-/* Magic number at the beginning of a locale data file for CATEGORY. */
-#define LIMAGIC(category) \
- (category == LC_COLLATE \
- ? ((unsigned int) (0x20051014 ^ (category))) \
- : ((unsigned int) (0x20031115 ^ (category))))
-
-
-/* This seems to be specified by ISO/IEC 14652 */
-static void
-get_lc_identification (GdmChooserLocale *locale,
- void *data,
- gsize size)
-{
- struct {
- unsigned int magic;
- unsigned int nstrings;
- unsigned int strindex[];
- } *filedata = data;
-
-#ifdef LC_IDENTIFICATION
- if (filedata->magic == LIMAGIC (LC_IDENTIFICATION)
- && (sizeof *filedata + (filedata->nstrings * sizeof (unsigned int)) <= size)) {
-
-#define GET_HANDLE(idx) ((char *) data + filedata->strindex[_NL_ITEM_INDEX (_NL_IDENTIFICATION_##idx)])
-
- locale->title = utf8_convert (GET_HANDLE (TITLE), -1);
- locale->language = utf8_convert (GET_HANDLE (LANGUAGE), -1);
- locale->territory = utf8_convert (GET_HANDLE (TERRITORY), -1);
- }
-#endif
-}
-
-struct nameent
-{
- char *name;
- uint32_t locrec_offset;
-};
-
-static int
-nameentcmp (const void *a, const void *b)
-{
- return strcoll (((const struct nameent *) a)->name,
- ((const struct nameent *) b)->name);
-}
-
-static void
-collect_locales_from_archive (GdmLanguageChooserWidget *widget)
-{
- GMappedFile *mapped;
- GError *error;
- char *addr;
- struct locarhead *head;
- struct namehashent *namehashtab;
- struct nameent *names;
- uint32_t used;
- uint32_t cnt;
- gsize len;
-
- error = NULL;
- mapped = g_mapped_file_new (ARCHIVE_FILE, FALSE, &error);
- if (mapped == NULL) {
- g_warning ("Mapping failed for %s: %s", ARCHIVE_FILE, error->message);
- g_error_free (error);
- return;
- }
-
- addr = g_mapped_file_get_contents (mapped);
- len = g_mapped_file_get_length (mapped);
-
- head = (struct locarhead *) addr;
- if (head->namehash_offset + head->namehash_size > len
- || head->string_offset + head->string_size > len
- || head->locrectab_offset + head->locrectab_size > len
- || head->sumhash_offset + head->sumhash_size > len) {
- goto out;
- }
-
- namehashtab = (struct namehashent *) (addr + head->namehash_offset);
-
- names = (struct nameent *) g_new0 (struct nameent, head->namehash_used);
- for (cnt = used = 0; cnt < head->namehash_size; ++cnt) {
- if (namehashtab[cnt].locrec_offset != 0) {
- names[used].name = addr + namehashtab[cnt].name_offset;
- names[used++].locrec_offset = namehashtab[cnt].locrec_offset;
- }
- }
-
- /* Sort the names. */
- qsort (names, used, sizeof (struct nameent), nameentcmp);
-
- for (cnt = 0; cnt < used; ++cnt) {
- struct locrecent *locrec;
- GdmChooserLocale *locale;
-
- locale = g_new0 (GdmChooserLocale, 1);
-
- parse_locale (names[cnt].name,
- &locale->language_code,
- &locale->territory_code,
- NULL,
- NULL);
-
- locale->name = construct_language_name (locale->language_code, locale->territory_code, NULL, NULL);
-
- if (g_hash_table_lookup (widget->priv->available_locales, locale->name) != NULL) {
- chooser_locale_free (locale);
- continue;
- }
-
- locrec = (struct locrecent *) (addr + names[cnt].locrec_offset);
-
-#ifdef LC_IDENTIFICATION
- get_lc_identification (locale,
- addr + locrec->record[LC_IDENTIFICATION].offset,
- locrec->record[LC_IDENTIFICATION].len);
-#endif
-
- g_hash_table_insert (widget->priv->available_locales, g_strdup (locale->name), locale);
- }
-
- g_free (names);
-
- out:
-
- g_mapped_file_free (mapped);
-}
-
-static int
-select_dirs (const struct dirent *dirent)
-{
- int result = 0;
-
- if (strcmp (dirent->d_name, ".") != 0 && strcmp (dirent->d_name, "..") != 0) {
- mode_t mode = 0;
-
-#ifdef _DIRENT_HAVE_D_TYPE
- if (dirent->d_type != DT_UNKNOWN && dirent->d_type != DT_LNK) {
- mode = DTTOIF (dirent->d_type);
- } else
-#endif
- {
- struct stat st;
- char *path;
-
- path = g_build_filename (LIBLOCALEDIR, dirent->d_name, NULL);
- if (g_stat (path, &st) == 0) {
- mode = st.st_mode;
- }
- g_free (path);
- }
-
- result = S_ISDIR (mode);
- }
-
- return result;
-}
-
-static void
-collect_locales_from_directory (GdmLanguageChooserWidget *widget)
-{
- struct dirent **dirents;
- int ndirents;
- int cnt;
-
- ndirents = scandir (LIBLOCALEDIR, &dirents, select_dirs, alphasort);
-
- for (cnt = 0; cnt < ndirents; ++cnt) {
- char *path;
- GdmChooserLocale *locale;
- gboolean res;
-
- locale = g_new0 (GdmChooserLocale, 1);
- parse_locale (dirents[cnt]->d_name,
- &locale->language_code,
- &locale->territory_code,
- NULL,
- NULL);
-
- /* Ignore codeset and modifier for this */
- locale->name = construct_language_name (locale->language_code, locale->territory_code, NULL, NULL);
-
- if (g_hash_table_lookup (widget->priv->available_locales, locale->name) != NULL) {
- chooser_locale_free (locale);
- continue;
- }
-
- /* try to get additional information from LC_IDENTIFICATION */
- path = g_build_filename (LIBLOCALEDIR, dirents[cnt]->d_name, "LC_IDENTIFICATION", NULL);
- res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
- if (res) {
- GMappedFile *mapped;
- GError *error;
-
- error = NULL;
- mapped = g_mapped_file_new (path, FALSE, &error);
- if (mapped == NULL) {
- g_warning ("Mapping failed for %s: %s", path, error->message);
- g_error_free (error);
- } else {
- get_lc_identification (locale,
- g_mapped_file_get_contents (mapped),
- g_mapped_file_get_length (mapped));
- g_mapped_file_free (mapped);
- }
- }
- g_free (path);
-
- g_hash_table_insert (widget->priv->available_locales, g_strdup (locale->name), locale);
- }
-
- if (ndirents > 0) {
- free (dirents);
- }
-}
-
-static void
-collect_locales_from_aliases (GdmLanguageChooserWidget *widget)
-{
- /* FIXME: */
-}
-
-static void
-collect_locales (GdmLanguageChooserWidget *widget)
-{
- collect_locales_from_archive (widget);
- collect_locales_from_directory (widget);
- collect_locales_from_aliases (widget);
-}
-
-
-static void
-on_row_activated (GtkTreeView *tree_view,
- GtkTreePath *tree_path,
- GtkTreeViewColumn *tree_column,
- GdmLanguageChooserWidget *widget)
-{
- g_signal_emit (widget, signals[LANGUAGE_ACTIVATED], 0);
-}
-
-static const char *
-get_translated_language (GdmLanguageChooserWidget *widget,
- const char *code)
-{
- const char *name;
- int len;
-
- g_assert (code != NULL);
-
- len = strlen (code);
- if (len != 2 && len != 3) {
- return NULL;
- }
-
- name = (const char *) g_hash_table_lookup (widget->priv->languages, code);
-
- if (name != NULL) {
- return dgettext ("iso_639", name);
- }
-
- return NULL;
-}
-
-static const char *
-get_language (GdmLanguageChooserWidget *widget,
- const char *code)
-{
- const char *name;
- int len;
-
- g_assert (code != NULL);
-
- len = strlen (code);
- if (len != 2 && len != 3) {
- return NULL;
- }
-
- name = (const char *) g_hash_table_lookup (widget->priv->languages, code);
-
- return name;
-}
-
-static const char *
-get_territory (GdmLanguageChooserWidget *widget,
- const char *code)
-{
- const char *name;
- int len;
-
- g_assert (code != NULL);
-
- len = strlen (code);
- if (len != 2 && len != 3) {
- return NULL;
- }
-
- name = (const char *) g_hash_table_lookup (widget->priv->territories, code);
-
- return name;
-}
-
-static const char *
-get_translated_territory (GdmLanguageChooserWidget *widget,
- const char *code)
-{
- const char *name;
- int len;
-
- g_assert (code != NULL);
-
- len = strlen (code);
- if (len != 2 && len != 3) {
- return NULL;
- }
-
- name = (const char *) g_hash_table_lookup (widget->priv->territories, code);
-
- if (name != NULL) {
- return dgettext ("iso_3166", name);
- }
-
- return NULL;
-}
-
-static void
-languages_parse_start_tag (GMarkupParseContext *ctx,
- const char *element_name,
- const char **attr_names,
- const char **attr_values,
- GdmLanguageChooserWidget *widget,
- GError **error)
-{
- const char *ccode_longB;
- const char *ccode_longT;
- const char *ccode;
- const char *lang_name;
-
- if (! g_str_equal (element_name, "iso_639_entry") || attr_names == NULL || attr_values == NULL) {
- return;
- }
-
- ccode = NULL;
- ccode_longB = NULL;
- ccode_longT = NULL;
- lang_name = NULL;
-
- while (*attr_names && *attr_values) {
- if (g_str_equal (*attr_names, "iso_639_1_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 2) {
- return;
- }
- ccode = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "iso_639_2B_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 3) {
- return;
- }
- ccode_longB = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "iso_639_2T_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 3) {
- return;
- }
- ccode_longT = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "name")) {
- lang_name = *attr_values;
- }
-
- ++attr_names;
- ++attr_values;
- }
-
- if (lang_name == NULL) {
- return;
- }
-
- if (ccode != NULL) {
- g_hash_table_insert (widget->priv->languages,
- g_strdup (ccode),
- g_strdup (lang_name));
- }
- if (ccode_longB != NULL) {
- g_hash_table_insert (widget->priv->languages,
- g_strdup (ccode_longB),
- g_strdup (lang_name));
- }
- if (ccode_longT != NULL) {
- g_hash_table_insert (widget->priv->languages,
- g_strdup (ccode_longT),
- g_strdup (lang_name));
- }
-}
-
-static void
-territories_parse_start_tag (GMarkupParseContext *ctx,
- const char *element_name,
- const char **attr_names,
- const char **attr_values,
- GdmLanguageChooserWidget *widget,
- GError **error)
-{
- const char *acode_2;
- const char *acode_3;
- const char *ncode;
- const char *territory_name;
-
- if (! g_str_equal (element_name, "iso_3166_entry") || attr_names == NULL || attr_values == NULL) {
- return;
- }
-
- acode_2 = NULL;
- acode_3 = NULL;
- ncode = NULL;
- territory_name = NULL;
-
- while (*attr_names && *attr_values) {
- if (g_str_equal (*attr_names, "alpha_2_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 2) {
- return;
- }
- acode_2 = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "alpha_3_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 3) {
- return;
- }
- acode_3 = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "numeric_code")) {
- /* skip if empty */
- if (**attr_values) {
- if (strlen (*attr_values) != 3) {
- return;
- }
- ncode = *attr_values;
- }
- } else if (g_str_equal (*attr_names, "name")) {
- territory_name = *attr_values;
- }
-
- ++attr_names;
- ++attr_values;
- }
-
- if (territory_name == NULL) {
- return;
- }
-
- if (acode_2 != NULL) {
- g_hash_table_insert (widget->priv->territories,
- g_strdup (acode_2),
- g_strdup (territory_name));
- }
- if (acode_3 != NULL) {
- g_hash_table_insert (widget->priv->territories,
- g_strdup (acode_3),
- g_strdup (territory_name));
- }
- if (ncode != NULL) {
- g_hash_table_insert (widget->priv->territories,
- g_strdup (ncode),
- g_strdup (territory_name));
- }
-}
-
-static void
-languages_init (GdmLanguageChooserWidget *widget)
-{
- GError *error;
- gboolean res;
- char *buf;
- gsize buf_len;
-
- bindtextdomain ("iso_639", ISO_CODES_LOCALESDIR);
- bind_textdomain_codeset ("iso_639", "UTF-8");
-
- widget->priv->languages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- error = NULL;
- res = g_file_get_contents (ISO_CODES_DATADIR "/iso_639.xml",
- &buf,
- &buf_len,
- &error);
- if (res) {
- GMarkupParseContext *ctx;
- GMarkupParser parser = { languages_parse_start_tag, NULL, NULL, NULL, NULL };
-
- ctx = g_markup_parse_context_new (&parser, 0, widget, NULL);
-
- error = NULL;
- res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
-
- if (! res) {
- g_warning ("Failed to parse '%s': %s\n",
- ISO_CODES_DATADIR "/iso_639.xml",
- error->message);
- g_error_free (error);
- }
-
- g_markup_parse_context_free (ctx);
- g_free (buf);
- } else {
- g_warning ("Failed to load '%s': %s\n",
- ISO_CODES_DATADIR "/iso_639.xml",
- error->message);
- g_error_free (error);
- }
-}
-
-static void
-territories_init (GdmLanguageChooserWidget *widget)
-{
- GError *error;
- gboolean res;
- char *buf;
- gsize buf_len;
-
- bindtextdomain ("iso_3166", ISO_CODES_LOCALESDIR);
- bind_textdomain_codeset ("iso_3166", "UTF-8");
-
- widget->priv->territories = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- error = NULL;
- res = g_file_get_contents (ISO_CODES_DATADIR "/iso_3166.xml",
- &buf,
- &buf_len,
- &error);
- if (res) {
- GMarkupParseContext *ctx;
- GMarkupParser parser = { territories_parse_start_tag, NULL, NULL, NULL, NULL };
-
- ctx = g_markup_parse_context_new (&parser, 0, widget, NULL);
-
- error = NULL;
- res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
-
- if (! res) {
- g_warning ("Failed to parse '%s': %s\n",
- ISO_CODES_DATADIR "/iso_3166.xml",
- error->message);
- g_error_free (error);
- }
-
- g_markup_parse_context_free (ctx);
- g_free (buf);
- } else {
- g_warning ("Failed to load '%s': %s\n",
- ISO_CODES_DATADIR "/iso_3166.xml",
- error->message);
- g_error_free (error);
- }
-}
-
-static void
-add_locale_to_model (const char *name,
- GdmChooserLocale *locale,
- GdmLanguageChooserWidget *widget)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- char *title;
- char *translated;
- const char *lang;
- const char *translated_lang;
- const char *title_lang;
- const char *title_trans_lang;
-
- lang = get_language (widget, locale->language_code);
- translated_lang = get_translated_language (widget, locale->language_code);
-
-#if 0
- g_debug ("adding to model: %s title='%s' language='%s' territory='%s' language_code='%s' territory_code='%s'",
- locale->name ? locale->name : "(null)",
- locale->title ? locale->title : "(null)",
- locale->language ? locale->language : "(null)",
- locale->territory ? locale->territory : "(null)",
- locale->language_code ? locale->language_code : "(null)",
- locale->territory_code ? locale->territory_code : "(null)",
- locale->modifier ? locale->modifier : "(null)");
-#endif
-
- title_lang = lang != NULL ? lang : locale->language;
- title_trans_lang = translated_lang != NULL ? translated_lang : locale->language;
-
- if (title_lang == NULL || title_trans_lang == NULL) {
- g_debug ("Problem with language code %s", locale->language_code);
- }
-
- if (locale->territory_code == NULL || locale->territory_code[0] == '\0') {
- title = g_strdup_printf ("%s", title_lang ? title_lang : "");
- translated = g_strdup_printf ("%s", title_trans_lang ? title_trans_lang : "");
- } else {
- const char *terr;
- const char *translated_terr;
-
- terr = get_territory (widget, locale->territory_code);
- translated_terr = get_translated_territory (widget, locale->territory_code);
-
- title = g_strdup_printf ("%s (%s)",
- title_lang ? title_lang : "(null)",
- terr ? terr : "(null)");
- translated = g_strdup_printf ("%s (%s)",
- title_trans_lang ? title_trans_lang : "",
- translated_terr ? translated_terr : "");
-
- }
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- CHOOSER_LIST_TITLE_COLUMN, title,
- CHOOSER_LIST_TRANSLATED_COLUMN, translated,
- CHOOSER_LIST_LOCALE_COLUMN, locale,
- -1);
- g_free (title);
- g_free (translated);
-}
-
-static void
-populate_model (GdmLanguageChooserWidget *widget)
-{
- g_hash_table_foreach (widget->priv->available_locales,
- (GHFunc)add_locale_to_model,
- widget);
-}
-
-static void
-gdm_language_chooser_widget_init (GdmLanguageChooserWidget *widget)
-{
- GtkWidget *scrolled;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkTreeModel *model;
-
- widget->priv = GDM_LANGUAGE_CHOOSER_WIDGET_GET_PRIVATE (widget);
-
- widget->priv->available_locales = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)chooser_locale_free);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
-
- widget->priv->treeview = gtk_tree_view_new ();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget->priv->treeview), FALSE);
- g_signal_connect (widget->priv->treeview,
- "row-activated",
- G_CALLBACK (on_row_activated),
- widget);
- gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->treeview);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_language_selected),
- widget);
-
- model = (GtkTreeModel *)gtk_list_store_new (3,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_POINTER);
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget->priv->treeview), model);
-
- column = gtk_tree_view_column_new_with_attributes ("Language",
- gtk_cell_renderer_text_new (),
- "markup", CHOOSER_LIST_TITLE_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- column = gtk_tree_view_column_new_with_attributes ("Translated Language",
- gtk_cell_renderer_text_new (),
- "markup", CHOOSER_LIST_TRANSLATED_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_TITLE_COLUMN,
- GTK_SORT_ASCENDING);
-
- collect_locales (widget);
- languages_init (widget);
- territories_init (widget);
-
- populate_model (widget);
-}
-
-static void
-gdm_language_chooser_widget_finalize (GObject *object)
-{
- GdmLanguageChooserWidget *language_chooser_widget;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_LANGUAGE_CHOOSER_WIDGET (object));
-
- language_chooser_widget = GDM_LANGUAGE_CHOOSER_WIDGET (object);
-
- g_return_if_fail (language_chooser_widget->priv != NULL);
-
- G_OBJECT_CLASS (gdm_language_chooser_widget_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_language_chooser_widget_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_LANGUAGE_CHOOSER_WIDGET,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-language-chooser-widget.h b/gui/simple-greeter/gdm-language-chooser-widget.h
deleted file mode 100644
index 1d61d549..00000000
--- a/gui/simple-greeter/gdm-language-chooser-widget.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_LANGUAGE_CHOOSER_WIDGET_H
-#define __GDM_LANGUAGE_CHOOSER_WIDGET_H
-
-#include <glib-object.h>
-#include <gtk/gtkvbox.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_LANGUAGE_CHOOSER_WIDGET (gdm_language_chooser_widget_get_type ())
-#define GDM_LANGUAGE_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET, GdmLanguageChooserWidget))
-#define GDM_LANGUAGE_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET, GdmLanguageChooserWidgetClass))
-#define GDM_IS_LANGUAGE_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET))
-#define GDM_IS_LANGUAGE_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET))
-#define GDM_LANGUAGE_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_LANGUAGE_CHOOSER_WIDGET, GdmLanguageChooserWidgetClass))
-
-typedef struct GdmLanguageChooserWidgetPrivate GdmLanguageChooserWidgetPrivate;
-
-typedef struct
-{
- GtkVBox parent;
- GdmLanguageChooserWidgetPrivate *priv;
-} GdmLanguageChooserWidget;
-
-typedef struct
-{
- GtkVBoxClass parent_class;
-
- /* signals */
- void (* language_activated) (GdmLanguageChooserWidget *widget);
-} GdmLanguageChooserWidgetClass;
-
-GType gdm_language_chooser_widget_get_type (void);
-GtkWidget * gdm_language_chooser_widget_new (void);
-
-char * gdm_language_chooser_widget_get_current_language_name (GdmLanguageChooserWidget *widget);
-void gdm_language_chooser_widget_set_current_language_name (GdmLanguageChooserWidget *widget,
- const char *lang_name);
-
-G_END_DECLS
-
-#endif /* __GDM_LANGUAGE_CHOOSER_WIDGET_H */
diff --git a/gui/simple-greeter/gdm-session-chooser-dialog.c b/gui/simple-greeter/gdm-session-chooser-dialog.c
deleted file mode 100644
index 1435e9fb..00000000
--- a/gui/simple-greeter/gdm-session-chooser-dialog.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include "gdm-session-chooser-widget.h"
-#include "gdm-session-chooser-dialog.h"
-
-#define GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogPrivate))
-
-struct GdmSessionChooserDialogPrivate
-{
- GtkWidget *chooser_widget;
-};
-
-enum {
- PROP_0,
-};
-
-static void gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass);
-static void gdm_session_chooser_dialog_init (GdmSessionChooserDialog *session_chooser_dialog);
-static void gdm_session_chooser_dialog_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmSessionChooserDialog, gdm_session_chooser_dialog, GTK_TYPE_DIALOG)
-
-char *
-gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog)
-{
- char *session_name;
-
- g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (dialog), NULL);
-
- session_name = gdm_session_chooser_widget_get_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget));
-
- return session_name;
-}
-
-static void
-gdm_session_chooser_dialog_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmSessionChooserDialog *self;
-
- self = GDM_SESSION_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_session_chooser_dialog_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmSessionChooserDialog *self;
-
- self = GDM_SESSION_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_session_chooser_dialog_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmSessionChooserDialog *session_chooser_dialog;
- GdmSessionChooserDialogClass *klass;
-
- klass = GDM_SESSION_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_SESSION_CHOOSER_DIALOG));
-
- session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (session_chooser_dialog);
-}
-
-static void
-gdm_session_chooser_dialog_dispose (GObject *object)
-{
- GdmSessionChooserDialog *session_chooser_dialog;
-
- session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (object);
-
- G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->dispose (object);
-}
-
-static void
-gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_session_chooser_dialog_get_property;
- object_class->set_property = gdm_session_chooser_dialog_set_property;
- object_class->constructor = gdm_session_chooser_dialog_constructor;
- object_class->dispose = gdm_session_chooser_dialog_dispose;
- object_class->finalize = gdm_session_chooser_dialog_finalize;
-
- g_type_class_add_private (klass, sizeof (GdmSessionChooserDialogPrivate));
-}
-
-static void
-on_response (GdmSessionChooserDialog *dialog,
- gint response_id)
-{
- switch (response_id) {
- default:
- break;
- }
-}
-
-static void
-gdm_session_chooser_dialog_init (GdmSessionChooserDialog *dialog)
-{
-
- dialog->priv = GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE (dialog);
-
- dialog->priv->chooser_widget = gdm_session_chooser_widget_new ();
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (on_response),
- dialog);
-
- gtk_widget_show_all (GTK_WIDGET (dialog));
-}
-
-static void
-gdm_session_chooser_dialog_finalize (GObject *object)
-{
- GdmSessionChooserDialog *session_chooser_dialog;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (object));
-
- session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (object);
-
- g_return_if_fail (session_chooser_dialog->priv != NULL);
-
- G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_session_chooser_dialog_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_SESSION_CHOOSER_DIALOG,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-session-chooser-dialog.h b/gui/simple-greeter/gdm-session-chooser-dialog.h
deleted file mode 100644
index 5a81e7c3..00000000
--- a/gui/simple-greeter/gdm-session-chooser-dialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_SESSION_CHOOSER_DIALOG_H
-#define __GDM_SESSION_CHOOSER_DIALOG_H
-
-#include <glib-object.h>
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_SESSION_CHOOSER_DIALOG (gdm_session_chooser_dialog_get_type ())
-#define GDM_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialog))
-#define GDM_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
-#define GDM_IS_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG))
-#define GDM_IS_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_DIALOG))
-#define GDM_SESSION_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
-
-typedef struct GdmSessionChooserDialogPrivate GdmSessionChooserDialogPrivate;
-
-typedef struct
-{
- GtkDialog parent;
- GdmSessionChooserDialogPrivate *priv;
-} GdmSessionChooserDialog;
-
-typedef struct
-{
- GtkDialogClass parent_class;
-} GdmSessionChooserDialogClass;
-
-GType gdm_session_chooser_dialog_get_type (void);
-
-GtkWidget * gdm_session_chooser_dialog_new (void);
-
-char * gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog);
-
-G_END_DECLS
-
-#endif /* __GDM_SESSION_CHOOSER_DIALOG_H */
diff --git a/gui/simple-greeter/gdm-session-chooser-widget.c b/gui/simple-greeter/gdm-session-chooser-widget.c
deleted file mode 100644
index 7763da79..00000000
--- a/gui/simple-greeter/gdm-session-chooser-widget.c
+++ /dev/null
@@ -1,703 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
-
-#include "gdm-session-chooser-widget.h"
-
-enum {
- DESKTOP_ENTRY_NO_DISPLAY = 1 << 0,
- DESKTOP_ENTRY_HIDDEN = 1 << 1,
- DESKTOP_ENTRY_SHOW_IN_GNOME = 1 << 2,
- DESKTOP_ENTRY_TRYEXEC_FAILED = 1 << 3
-};
-
-#define GDM_SESSION_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetPrivate))
-
-typedef struct _GdmChooserSession {
- char *filename;
- char *path;
- char *translated_name;
- char *translated_comment;
- guint flags;
-} GdmChooserSession;
-
-struct GdmSessionChooserWidgetPrivate
-{
- GtkWidget *treeview;
-
- GHashTable *available_sessions;
- char *current_session;
-};
-
-enum {
- PROP_0,
-};
-
-enum {
- SESSION_ACTIVATED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
-static void gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass);
-static void gdm_session_chooser_widget_init (GdmSessionChooserWidget *session_chooser_widget);
-static void gdm_session_chooser_widget_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmSessionChooserWidget, gdm_session_chooser_widget, GTK_TYPE_VBOX)
-
-enum {
- CHOOSER_LIST_NAME_COLUMN = 0,
- CHOOSER_LIST_COMMENT_COLUMN,
- CHOOSER_LIST_ID_COLUMN
-};
-
-static void
-chooser_session_free (GdmChooserSession *session)
-{
- if (session == NULL) {
- return;
- }
-
- g_free (session->filename);
- g_free (session->path);
- g_free (session->translated_name);
- g_free (session->translated_comment);
-
- g_free (session);
-}
-
-char *
-gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget)
-{
- char *session_name;
-
- g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget), NULL);
-
- session_name = NULL;
- if (widget->priv->current_session != NULL) {
- session_name = g_strdup (widget->priv->current_session);
- }
-
- return session_name;
-}
-
-static void
-select_name (GdmSessionChooserWidget *widget,
- const char *name)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = NULL;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (name != NULL && gtk_tree_model_get_iter_first (model, &iter)) {
-
- do {
- GdmChooserSession *session;
- char *id;
- gboolean found;
-
- session = NULL;
- id = NULL;
- gtk_tree_model_get (model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id != NULL) {
- session = g_hash_table_lookup (widget->priv->available_sessions, id);
- g_free (id);
- }
-
- found = (session != NULL
- && session->filename != NULL
- && strcmp (session->filename, name) == 0);
-
- if (found) {
- path = gtk_tree_model_get_path (model, &iter);
- break;
- }
-
- } while (gtk_tree_model_iter_next (model, &iter));
- }
-
- if (path != NULL) {
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- gtk_tree_view_get_column (GTK_TREE_VIEW (widget->priv->treeview), 0),
- TRUE, 0.5, 0.0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget->priv->treeview),
- path,
- NULL,
- FALSE);
-
- gtk_tree_path_free (path);
- }
-}
-
-void
-gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
- const char *name)
-{
- GtkTreeSelection *selection;
-
- g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (widget));
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
-
- if (name == NULL) {
- gtk_tree_selection_unselect_all (selection);
- } else {
- select_name (widget, name);
- }
-}
-
-static void
-gdm_session_chooser_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmSessionChooserWidget *self;
-
- self = GDM_SESSION_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_session_chooser_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmSessionChooserWidget *self;
-
- self = GDM_SESSION_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_session_chooser_widget_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmSessionChooserWidget *session_chooser_widget;
- GdmSessionChooserWidgetClass *klass;
-
- klass = GDM_SESSION_CHOOSER_WIDGET_CLASS (g_type_class_peek (GDM_TYPE_SESSION_CHOOSER_WIDGET));
-
- session_chooser_widget = GDM_SESSION_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (session_chooser_widget);
-}
-
-static void
-gdm_session_chooser_widget_dispose (GObject *object)
-{
- GdmSessionChooserWidget *widget;
-
- widget = GDM_SESSION_CHOOSER_WIDGET (object);
-
- if (widget->priv->available_sessions != NULL) {
- g_hash_table_destroy (widget->priv->available_sessions);
- widget->priv->available_sessions = NULL;
- }
-
- g_free (widget->priv->current_session);
- widget->priv->current_session = NULL;
-
- G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->dispose (object);
-}
-
-static void
-gdm_session_chooser_widget_class_init (GdmSessionChooserWidgetClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_session_chooser_widget_get_property;
- object_class->set_property = gdm_session_chooser_widget_set_property;
- object_class->constructor = gdm_session_chooser_widget_constructor;
- object_class->dispose = gdm_session_chooser_widget_dispose;
- object_class->finalize = gdm_session_chooser_widget_finalize;
-
- signals [SESSION_ACTIVATED] = g_signal_new ("session-activated",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmSessionChooserWidgetClass, session_activated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_type_class_add_private (klass, sizeof (GdmSessionChooserWidgetPrivate));
-}
-
-static void
-on_session_selected (GtkTreeSelection *selection,
- GdmSessionChooserWidget *widget)
-{
- GtkTreeModel *model = NULL;
- GtkTreeIter iter = {0};
- char *id;
-
- id = NULL;
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, CHOOSER_LIST_ID_COLUMN, &id, -1);
- }
-
- g_free (widget->priv->current_session);
- widget->priv->current_session = g_strdup (id);
-
- g_free (id);
-}
-
-/* adapted from gnome-menus desktop-entries.c */
-static guint
-get_flags_from_key_file (GKeyFile *key_file,
- const char *desktop_entry_group)
-{
- GError *error;
- gboolean no_display;
- gboolean hidden;
- gboolean tryexec_failed;
- char *tryexec;
- guint flags;
-
- error = NULL;
- no_display = g_key_file_get_boolean (key_file,
- desktop_entry_group,
- "NoDisplay",
- &error);
- if (error) {
- no_display = FALSE;
- g_error_free (error);
- }
-
- error = NULL;
- hidden = g_key_file_get_boolean (key_file,
- desktop_entry_group,
- "Hidden",
- &error);
- if (error) {
- hidden = FALSE;
- g_error_free (error);
- }
-
- tryexec_failed = FALSE;
- tryexec = g_key_file_get_string (key_file,
- desktop_entry_group,
- "TryExec",
- NULL);
- if (tryexec) {
- char *path;
-
- path = g_find_program_in_path (g_strstrip (tryexec));
-
- tryexec_failed = (path == NULL);
-
- g_free (path);
- g_free (tryexec);
- }
-
- flags = 0;
- if (no_display)
- flags |= DESKTOP_ENTRY_NO_DISPLAY;
- if (hidden)
- flags |= DESKTOP_ENTRY_HIDDEN;
- if (tryexec_failed)
- flags |= DESKTOP_ENTRY_TRYEXEC_FAILED;
-
- return flags;
-}
-
-static void
-load_session_file (GdmSessionChooserWidget *widget,
- const char *name,
- const char *path)
-{
- GKeyFile *key_file;
- GError *error;
- gboolean res;
- GdmChooserSession *session;
-
- key_file = g_key_file_new ();
-
- error = NULL;
- res = g_key_file_load_from_file (key_file, path, 0, &error);
-
- if (!res) {
- g_debug ("Failed to load \"%s\": %s\n", path, error->message);
- g_error_free (error);
- goto out;
- }
-
- if (! g_key_file_has_group (key_file, G_KEY_FILE_DESKTOP_GROUP)) {
- goto out;
- }
-
- res = g_key_file_has_key (key_file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
- if (! res) {
- g_debug ("\"%s\" contains no \"Name\" key\n", path);
- goto out;
- }
-
- session = g_new0 (GdmChooserSession, 1);
-
- session->filename = g_strdup (name);
- session->path = g_strdup (path);
- session->flags = get_flags_from_key_file (key_file, G_KEY_FILE_DESKTOP_GROUP);
-
- session->translated_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL, NULL);
- session->translated_comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "Comment", NULL, NULL);
-
- g_hash_table_insert (widget->priv->available_sessions,
- g_strdup (name),
- session);
- out:
- g_key_file_free (key_file);
-}
-
-static void
-collect_sessions_from_directory (GdmSessionChooserWidget *widget,
- const char *dirname)
-{
- GDir *dir;
- const char *filename;
-
- /* FIXME: add file monitor to directory */
-
- dir = g_dir_open (dirname, 0, NULL);
- if (dir == NULL) {
- return;
- }
-
- while ((filename = g_dir_read_name (dir))) {
- char *full_path;
-
- if (! g_str_has_suffix (filename, ".desktop")) {
- continue;
- }
-
- full_path = g_build_filename (dirname, filename, NULL);
-
- load_session_file (widget, filename, full_path);
-
- g_free (full_path);
- }
-
- g_dir_close (dir);
-}
-
-static void
-collect_sessions_from_directories (GdmSessionChooserWidget *widget)
-{
- int i;
- const char *search_dirs[] = {
- "/etc/X11/sessions/",
- DMCONFDIR "/Sessions/",
- DATADIR "/gdm/BuiltInSessions/",
- DATADIR "/xsessions/",
- NULL
- };
-
- for (i = 0; search_dirs [i] != NULL; i++) {
- collect_sessions_from_directory (widget, search_dirs [i]);
- }
-}
-
-static void
-collect_sessions (GdmSessionChooserWidget *widget)
-{
- collect_sessions_from_directories (widget);
-}
-
-static void
-on_row_activated (GtkTreeView *tree_view,
- GtkTreePath *tree_path,
- GtkTreeViewColumn *tree_column,
- GdmSessionChooserWidget *widget)
-{
- g_signal_emit (widget, signals[SESSION_ACTIVATED], 0);
-}
-
-static void
-add_session_to_model (const char *name,
- GdmChooserSession *session,
- GdmSessionChooserWidget *widget)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (session->flags & DESKTOP_ENTRY_NO_DISPLAY
- || session->flags & DESKTOP_ENTRY_HIDDEN
- || session->flags & DESKTOP_ENTRY_TRYEXEC_FAILED) {
- /* skip */
- g_debug ("Not adding session to list: %s", session->filename);
- }
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- CHOOSER_LIST_NAME_COLUMN, session->translated_name,
- CHOOSER_LIST_COMMENT_COLUMN, session->translated_comment,
- CHOOSER_LIST_ID_COLUMN, name,
- -1);
-}
-
-static void
-populate_model (GdmSessionChooserWidget *widget,
- GtkTreeModel *model)
-{
- GtkTreeIter iter;
-
- /* Add some fake entries */
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, _("Previous Session"),
- CHOOSER_LIST_ID_COLUMN, "__previous-session",
- -1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, _("System Default"),
- CHOOSER_LIST_ID_COLUMN, "__default-session",
- -1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_NAME_COLUMN, NULL,
- CHOOSER_LIST_ID_COLUMN, "__separator",
- -1);
-
- g_hash_table_foreach (widget->priv->available_sessions,
- (GHFunc)add_session_to_model,
- widget);
-}
-
-static gboolean
-separator_func (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- int column = GPOINTER_TO_INT (data);
- char *text;
-
- gtk_tree_model_get (model, iter, column, &text, -1);
-
- if (text != NULL && strcmp (text, "__separator") == 0) {
- return TRUE;
- }
-
- g_free (text);
-
- return FALSE;
-}
-
-static int
-compare_session_names (char *name_a,
- char *name_b,
- char *id_a,
- char *id_b)
-{
-
- if (id_a == NULL) {
- return 1;
- } else if (id_b == NULL) {
- return -1;
- }
-
- if (strcmp (id_a, "__previous-session") == 0) {
- return -1;
- } else if (strcmp (id_b, "__previous-session") == 0) {
- return 1;
- } else if (strcmp (id_a, "__default-session") == 0) {
- return -1;
- } else if (strcmp (id_b, "__default-session") == 0) {
- return 1;
- } else if (strcmp (id_a, "__separator") == 0) {
- return -1;
- } else if (strcmp (id_b, "__separator") == 0) {
- return 1;
- }
-
- if (name_a == NULL) {
- return 1;
- } else if (name_b == NULL) {
- return -1;
- }
-
- return g_utf8_collate (name_a, name_b);
-}
-
-static int
-compare_session (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- char *name_a;
- char *name_b;
- char *id_a;
- char *id_b;
- int result;
-
- gtk_tree_model_get (model, a, CHOOSER_LIST_NAME_COLUMN, &name_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_NAME_COLUMN, &name_b, -1);
- gtk_tree_model_get (model, a, CHOOSER_LIST_ID_COLUMN, &id_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_ID_COLUMN, &id_b, -1);
-
- result = compare_session_names (name_a, name_b, id_a, id_b);
-
- g_free (name_a);
- g_free (name_b);
- g_free (id_a);
- g_free (id_b);
-
- return result;
-}
-
-static void
-gdm_session_chooser_widget_init (GdmSessionChooserWidget *widget)
-{
- GtkWidget *scrolled;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkTreeModel *model;
-
- widget->priv = GDM_SESSION_CHOOSER_WIDGET_GET_PRIVATE (widget);
-
- widget->priv->available_sessions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)chooser_session_free);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
-
- widget->priv->treeview = gtk_tree_view_new ();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget->priv->treeview), FALSE);
- g_signal_connect (widget->priv->treeview,
- "row-activated",
- G_CALLBACK (on_row_activated),
- widget);
- gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->treeview);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_session_selected),
- widget);
-
- model = (GtkTreeModel *)gtk_list_store_new (3,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget->priv->treeview), model);
-
- column = gtk_tree_view_column_new_with_attributes ("Session",
- gtk_cell_renderer_text_new (),
- "text", CHOOSER_LIST_NAME_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- column = gtk_tree_view_column_new_with_attributes ("Comment",
- gtk_cell_renderer_text_new (),
- "text", CHOOSER_LIST_COMMENT_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget->priv->treeview), column);
-
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_NAME_COLUMN,
- compare_session,
- NULL, NULL);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_NAME_COLUMN,
- GTK_SORT_ASCENDING);
-
- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget->priv->treeview),
- separator_func,
- GINT_TO_POINTER (CHOOSER_LIST_ID_COLUMN),
- NULL);
-
- collect_sessions (widget);
-
- populate_model (widget, model);
-}
-
-static void
-gdm_session_chooser_widget_finalize (GObject *object)
-{
- GdmSessionChooserWidget *session_chooser_widget;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_SESSION_CHOOSER_WIDGET (object));
-
- session_chooser_widget = GDM_SESSION_CHOOSER_WIDGET (object);
-
- g_return_if_fail (session_chooser_widget->priv != NULL);
-
- G_OBJECT_CLASS (gdm_session_chooser_widget_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_session_chooser_widget_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_SESSION_CHOOSER_WIDGET,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-session-chooser-widget.h b/gui/simple-greeter/gdm-session-chooser-widget.h
deleted file mode 100644
index ec32b23c..00000000
--- a/gui/simple-greeter/gdm-session-chooser-widget.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_SESSION_CHOOSER_WIDGET_H
-#define __GDM_SESSION_CHOOSER_WIDGET_H
-
-#include <glib-object.h>
-#include <gtk/gtkvbox.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_SESSION_CHOOSER_WIDGET (gdm_session_chooser_widget_get_type ())
-#define GDM_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidget))
-#define GDM_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
-#define GDM_IS_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET))
-#define GDM_IS_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_WIDGET))
-#define GDM_SESSION_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
-
-typedef struct GdmSessionChooserWidgetPrivate GdmSessionChooserWidgetPrivate;
-
-typedef struct
-{
- GtkVBox parent;
- GdmSessionChooserWidgetPrivate *priv;
-} GdmSessionChooserWidget;
-
-typedef struct
-{
- GtkVBoxClass parent_class;
-
- /* signals */
- void (* session_activated) (GdmSessionChooserWidget *widget);
-} GdmSessionChooserWidgetClass;
-
-GType gdm_session_chooser_widget_get_type (void);
-GtkWidget * gdm_session_chooser_widget_new (void);
-
-char * gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget);
-void gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
- const char *session_name);
-
-G_END_DECLS
-
-#endif /* __GDM_SESSION_CHOOSER_WIDGET_H */
diff --git a/gui/simple-greeter/gdm-simple-greeter.c b/gui/simple-greeter/gdm-simple-greeter.c
deleted file mode 100644
index 8f8a52c9..00000000
--- a/gui/simple-greeter/gdm-simple-greeter.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#include <glade/glade-xml.h>
-
-#include "gdm-greeter.h"
-#include "gdm-simple-greeter.h"
-#include "gdm-common.h"
-#include "gdm-settings-client.h"
-#include "gdm-settings-keys.h"
-
-#include "gdm-greeter-panel.h"
-#include "gdm-greeter-background.h"
-#include "gdm-user-chooser-widget.h"
-
-#if HAVE_PAM
-#include <security/pam_appl.h>
-#define PW_ENTRY_SIZE PAM_MAX_RESP_SIZE
-#else
-#define PW_ENTRY_SIZE GDM_MAX_PASS
-#endif
-
-#define GLADE_XML_FILE "gdm-simple-greeter.glade"
-
-#define GPM_DBUS_NAME "org.freedesktop.PowerManagement"
-#define GPM_DBUS_PATH "/org/freedesktop/PowerManagement"
-#define GPM_DBUS_INTERFACE "org.freedesktop.PowerManagement"
-
-#define GDM_SIMPLE_GREETER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SIMPLE_GREETER, GdmSimpleGreeterPrivate))
-
-enum {
- PAGE_USERLIST = 0,
- PAGE_AUTH
-};
-
-enum {
- RESPONSE_RESTART,
- RESPONSE_REBOOT,
- RESPONSE_CLOSE
-};
-
-struct GdmSimpleGreeterPrivate
-{
- GladeXML *xml;
- GtkWidget *panel;
- GtkWidget *background;
- GtkWidget *user_chooser;
-};
-
-enum {
- PROP_0,
-};
-
-static void gdm_simple_greeter_class_init (GdmSimpleGreeterClass *klass);
-static void gdm_simple_greeter_init (GdmSimpleGreeter *simple_greeter);
-static void gdm_simple_greeter_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmSimpleGreeter, gdm_simple_greeter, GDM_TYPE_GREETER)
-
-static gboolean
-gdm_simple_greeter_start (GdmGreeter *greeter)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->start (greeter);
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_stop (GdmGreeter *greeter)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->stop (greeter);
-
- return TRUE;
-}
-
-static void
-set_busy (GdmSimpleGreeter *greeter)
-{
- GdkCursor *cursor;
- GtkWidget *top_level;
-
- top_level = glade_xml_get_widget (greeter->priv->xml, "auth-window");
-
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (top_level->window, cursor);
- gdk_cursor_unref (cursor);
-}
-
-static void
-set_ready (GdmSimpleGreeter *greeter)
-{
- GdkCursor *cursor;
- GtkWidget *top_level;
-
- top_level = glade_xml_get_widget (greeter->priv->xml, "auth-window");
-
- cursor = gdk_cursor_new (GDK_LEFT_PTR);
- gdk_window_set_cursor (top_level->window, cursor);
- gdk_cursor_unref (cursor);
-}
-
-static void
-set_sensitive (GdmSimpleGreeter *greeter,
- gboolean sensitive)
-{
- GtkWidget *box;
-
- box = glade_xml_get_widget (greeter->priv->xml, "auth-input-box");
- gtk_widget_set_sensitive (box, sensitive);
-
- box = glade_xml_get_widget (greeter->priv->xml, "auth-button-box");
- gtk_widget_set_sensitive (box, sensitive);
-}
-
-static void
-set_focus (GdmSimpleGreeter *greeter)
-{
- GtkWidget *top_level;
- GtkWidget *entry;
-
- entry = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-entry");
- top_level = glade_xml_get_widget (greeter->priv->xml, "auth-window");
-
- gdk_window_focus (top_level->window, GDK_CURRENT_TIME);
-
- if (! GTK_WIDGET_HAS_FOCUS (entry)) {
- gtk_widget_grab_focus (entry);
- }
-}
-
-
-static void
-set_message (GdmSimpleGreeter *greeter,
- const char *text)
-{
- GtkWidget *label;
-
- label = glade_xml_get_widget (greeter->priv->xml, "auth-message-label");
- gtk_label_set_text (GTK_LABEL (label), text);
-}
-
-static void
-switch_page (GdmSimpleGreeter *greeter,
- int number)
-{
- GtkWidget *notebook;
-
- /* switch page */
- notebook = glade_xml_get_widget (greeter->priv->xml, "notebook");
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), number);
-
-}
-
-static void
-do_cancel (GdmSimpleGreeter *greeter)
-{
- switch_page (greeter, PAGE_USERLIST);
- set_busy (greeter);
- set_sensitive (greeter, FALSE);
-
- gdm_greeter_emit_cancelled (GDM_GREETER (greeter));
-
- set_ready (greeter);
-}
-
-static void
-reset_dialog (GdmSimpleGreeter *greeter)
-{
- GtkWidget *entry;
- GtkWidget *label;
-
- g_debug ("Resetting dialog");
-
- entry = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-entry");
- gtk_entry_set_text (GTK_ENTRY (entry), "");
- gtk_entry_set_visibility (GTK_ENTRY (entry), TRUE);
-
- label = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-label");
- gtk_label_set_text (GTK_LABEL (label), "");
-
- set_message (greeter, "");
-
- switch_page (greeter, PAGE_USERLIST);
-
- set_sensitive (greeter, TRUE);
- set_ready (greeter);
- set_focus (GDM_SIMPLE_GREETER (greeter));
-}
-
-static gboolean
-gdm_simple_greeter_ready (GdmGreeter *greeter)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- /*GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->reset (greeter);*/
-
- set_sensitive (GDM_SIMPLE_GREETER (greeter), TRUE);
- set_ready (GDM_SIMPLE_GREETER (greeter));
- set_focus (GDM_SIMPLE_GREETER (greeter));
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_reset (GdmGreeter *greeter)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- /*GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->reset (greeter);*/
-
- reset_dialog (GDM_SIMPLE_GREETER (greeter));
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_info (GdmGreeter *greeter,
- const char *text)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->info (greeter, text);
-
- g_debug ("SIMPLE GREETER: info: %s", text);
-
- set_message (GDM_SIMPLE_GREETER (greeter), text);
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_problem (GdmGreeter *greeter,
- const char *text)
-{
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->problem (greeter, text);
-
- g_debug ("SIMPLE GREETER: problem: %s", text);
-
- set_message (GDM_SIMPLE_GREETER (greeter), text);
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_info_query (GdmGreeter *greeter,
- const char *text)
-{
- GtkWidget *entry;
- GtkWidget *label;
-
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->info_query (greeter, text);
-
- g_debug ("SIMPLE GREETER: info query: %s", text);
-
- entry = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-entry");
- gtk_entry_set_text (GTK_ENTRY (entry), "");
- gtk_entry_set_visibility (GTK_ENTRY (entry), TRUE);
-
- label = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-label");
- gtk_label_set_text (GTK_LABEL (label), text);
-
- set_sensitive (GDM_SIMPLE_GREETER (greeter), TRUE);
- set_ready (GDM_SIMPLE_GREETER (greeter));
- set_focus (GDM_SIMPLE_GREETER (greeter));
-
- if (! GTK_WIDGET_HAS_FOCUS (entry)) {
- gtk_widget_grab_focus (entry);
- }
-
- return TRUE;
-}
-
-static gboolean
-gdm_simple_greeter_secret_info_query (GdmGreeter *greeter,
- const char *text)
-{
- GtkWidget *entry;
- GtkWidget *label;
-
- g_return_val_if_fail (GDM_IS_GREETER (greeter), FALSE);
-
- GDM_GREETER_CLASS (gdm_simple_greeter_parent_class)->secret_info_query (greeter, text);
-
- g_debug ("SIMPLE GREETER: secret info query: %s", text);
-
- entry = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-entry");
- gtk_entry_set_text (GTK_ENTRY (entry), "");
- gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
-
- label = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-label");
- gtk_label_set_text (GTK_LABEL (label), text);
-
- set_sensitive (GDM_SIMPLE_GREETER (greeter), TRUE);
- set_ready (GDM_SIMPLE_GREETER (greeter));
- set_focus (GDM_SIMPLE_GREETER (greeter));
-
- return TRUE;
-}
-
-static void
-gdm_simple_greeter_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmSimpleGreeter *self;
-
- self = GDM_SIMPLE_GREETER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_simple_greeter_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmSimpleGreeter *self;
-
- self = GDM_SIMPLE_GREETER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-ok_button_clicked (GtkButton *button,
- GdmSimpleGreeter *greeter)
-{
- gboolean res;
- GtkWidget *entry;
- const char *text;
-
- set_busy (greeter);
- set_sensitive (greeter, FALSE);
-
- entry = glade_xml_get_widget (greeter->priv->xml, "auth-entry");
- text = gtk_entry_get_text (GTK_ENTRY (entry));
- res = gdm_greeter_emit_answer_query (GDM_GREETER (greeter), text);
-}
-
-static void
-cancel_button_clicked (GtkButton *button,
- GdmSimpleGreeter *greeter)
-{
- do_cancel (greeter);
-}
-
-static void
-suspend_button_clicked (GtkButton *button,
- GdmSimpleGreeter *greeter)
-{
- GError *error;
- DBusGConnection *connection;
- DBusGProxy *proxy;
-
- g_debug ("Suspend button clicked");
-
- error = NULL;
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_warning ("Couldn't suspend: %s", error->message);
- g_error_free (error);
- return;
- }
- proxy = dbus_g_proxy_new_for_name (connection,
- GPM_DBUS_NAME,
- GPM_DBUS_PATH,
- GPM_DBUS_INTERFACE);
- error = NULL;
- dbus_g_proxy_call (proxy,
- "Suspend",
- &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (error != NULL) {
- g_warning ("Couldn't suspend: %s", error->message);
- g_error_free (error);
- return;
- }
-
- g_object_unref (proxy);
-}
-
-static void
-on_user_activated (GdmUserChooserWidget *user_chooser,
- GdmSimpleGreeter *greeter)
-{
- char *user_name;
-
- user_name = gdm_user_chooser_widget_get_current_user_name (GDM_USER_CHOOSER_WIDGET (greeter->priv->user_chooser));
-
- gdm_greeter_emit_begin_verification (GDM_GREETER (greeter),
- user_name);
- switch_page (greeter, PAGE_AUTH);
-}
-
-#define INVISIBLE_CHAR_DEFAULT '*'
-#define INVISIBLE_CHAR_BLACK_CIRCLE 0x25cf
-#define INVISIBLE_CHAR_WHITE_BULLET 0x25e6
-#define INVISIBLE_CHAR_BULLET 0x2022
-#define INVISIBLE_CHAR_NONE 0
-
-static gboolean
-launch_compiz (GdmSimpleGreeter *greeter)
-{
- GError *error;
- gboolean ret;
-
- g_debug ("Launching compiz");
-
- ret = FALSE;
-
- error = NULL;
- g_spawn_command_line_async ("gtk-window-decorator --replace", &error);
- if (error != NULL) {
- g_warning ("Error starting WM: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- error = NULL;
- g_spawn_command_line_async ("compiz --replace", &error);
- if (error != NULL) {
- g_warning ("Error starting WM: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- ret = TRUE;
-
- /* FIXME: should try to detect if it actually works */
-
- out:
- return ret;
-}
-
-static gboolean
-launch_metacity (GdmSimpleGreeter *greeter)
-{
- GError *error;
- gboolean ret;
-
- g_debug ("Launching metacity");
-
- ret = FALSE;
-
- error = NULL;
- g_spawn_command_line_async ("metacity --replace", &error);
- if (error != NULL) {
- g_warning ("Error starting WM: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- ret = TRUE;
-
- out:
- return ret;
-}
-
-static void
-create_greeter (GdmSimpleGreeter *greeter)
-{
- GtkWidget *dialog;
- GtkWidget *entry;
- GtkWidget *button;
- GtkWidget *box;
-
- if (! launch_compiz (greeter)) {
- launch_metacity (greeter);
- }
-
- greeter->priv->user_chooser = gdm_user_chooser_widget_new ();
- g_signal_connect (greeter->priv->user_chooser,
- "user-activated",
- G_CALLBACK (on_user_activated),
- greeter);
-
- gtk_widget_show_all (greeter->priv->user_chooser);
-
- greeter->priv->xml = glade_xml_new (GLADEDIR "/" GLADE_XML_FILE, NULL, PACKAGE);
- if (greeter->priv->xml == NULL) {
- /* FIXME: */
- }
-
- dialog = glade_xml_get_widget (greeter->priv->xml, "auth-window");
- if (dialog == NULL) {
- /* FIXME: */
- }
-
- box = glade_xml_get_widget (greeter->priv->xml, "userlist-box");
- if (box == NULL) {
- g_warning ("Userlist box not found");
- /* FIXME: */
- }
- gtk_container_add (GTK_CONTAINER (box), greeter->priv->user_chooser);
-
- button = glade_xml_get_widget (greeter->priv->xml, "auth-ok-button");
- if (dialog != NULL) {
- gtk_widget_grab_default (button);
- g_signal_connect (button, "clicked", G_CALLBACK (ok_button_clicked), greeter);
- }
-
- button = glade_xml_get_widget (greeter->priv->xml, "auth-cancel-button");
- if (dialog != NULL) {
- g_signal_connect (button, "clicked", G_CALLBACK (cancel_button_clicked), greeter);
- }
-
- entry = glade_xml_get_widget (GDM_SIMPLE_GREETER (greeter)->priv->xml, "auth-entry");
- /* Only change the invisible character if it '*' otherwise assume it is OK */
- if ('*' == gtk_entry_get_invisible_char (GTK_ENTRY (entry))) {
- gunichar invisible_char;
- invisible_char = INVISIBLE_CHAR_BLACK_CIRCLE;
- gtk_entry_set_invisible_char (GTK_ENTRY (entry), invisible_char);
- }
-
- gtk_window_set_opacity (GTK_WINDOW (dialog), 0.75);
-
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
- gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
- gtk_window_set_decorated (GTK_WINDOW (dialog), FALSE);
- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_skip_pager_hint (GTK_WINDOW (dialog), TRUE);
- gtk_window_stick (GTK_WINDOW (dialog));
- gtk_widget_show (dialog);
-}
-
-static void
-create_panel (GdmSimpleGreeter *greeter)
-{
- greeter->priv->background = gdm_greeter_background_new ();
- gtk_widget_show (greeter->priv->background);
- greeter->priv->panel = gdm_greeter_panel_new ();
- gtk_widget_show (greeter->priv->panel);
-}
-
-static GObject *
-gdm_simple_greeter_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmSimpleGreeter *greeter;
- GdmSimpleGreeterClass *klass;
-
- klass = GDM_SIMPLE_GREETER_CLASS (g_type_class_peek (GDM_TYPE_SIMPLE_GREETER));
-
- greeter = GDM_SIMPLE_GREETER (G_OBJECT_CLASS (gdm_simple_greeter_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
- create_greeter (greeter);
- create_panel (greeter);
-
- return G_OBJECT (greeter);
-}
-
-static void
-gdm_simple_greeter_class_init (GdmSimpleGreeterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdmGreeterClass *greeter_class = GDM_GREETER_CLASS (klass);
-
- object_class->get_property = gdm_simple_greeter_get_property;
- object_class->set_property = gdm_simple_greeter_set_property;
- object_class->constructor = gdm_simple_greeter_constructor;
- object_class->finalize = gdm_simple_greeter_finalize;
-
- greeter_class->start = gdm_simple_greeter_start;
- greeter_class->stop = gdm_simple_greeter_stop;
- greeter_class->ready = gdm_simple_greeter_ready;
- greeter_class->reset = gdm_simple_greeter_reset;
- greeter_class->info = gdm_simple_greeter_info;
- greeter_class->problem = gdm_simple_greeter_problem;
- greeter_class->info_query = gdm_simple_greeter_info_query;
- greeter_class->secret_info_query = gdm_simple_greeter_secret_info_query;
-
- g_type_class_add_private (klass, sizeof (GdmSimpleGreeterPrivate));
-}
-
-static void
-gdm_simple_greeter_init (GdmSimpleGreeter *simple_greeter)
-{
-
- simple_greeter->priv = GDM_SIMPLE_GREETER_GET_PRIVATE (simple_greeter);
-
-}
-
-static void
-gdm_simple_greeter_finalize (GObject *object)
-{
- GdmSimpleGreeter *simple_greeter;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_SIMPLE_GREETER (object));
-
- simple_greeter = GDM_SIMPLE_GREETER (object);
-
- g_return_if_fail (simple_greeter->priv != NULL);
-
- G_OBJECT_CLASS (gdm_simple_greeter_parent_class)->finalize (object);
-}
-
-GdmGreeter *
-gdm_simple_greeter_new (const char *display_id)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_SIMPLE_GREETER,
- "display-id", display_id,
- NULL);
-
- return GDM_GREETER (object);
-}
diff --git a/gui/simple-greeter/gdm-simple-greeter.glade b/gui/simple-greeter/gdm-simple-greeter.glade
deleted file mode 100644
index 6701f25a..00000000
--- a/gui/simple-greeter/gdm-simple-greeter.glade
+++ /dev/null
@@ -1,348 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkWindow" id="auth-window">
- <property name="border_width">12</property>
- <property name="height_request">400</property>
- <property name="visible">True</property>
- <property name="title" translatable="yes">Authentication Dialog</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="notebook">
- <property name="visible">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="userlist-page-vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkHBox" id="userlist-box">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="userlist-cancel-button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">label1</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="auth-page-vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkHBox" id="auth-user-icon-box">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="auth-input-box">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="auth-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Prompt:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="auth-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="auth-message-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="auth-button-box">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="auth-cancel-button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="auth-ok-button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-home</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label">Log In</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">label2</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/gui/simple-greeter/gdm-simple-greeter.h b/gui/simple-greeter/gdm-simple-greeter.h
deleted file mode 100644
index 51ec9983..00000000
--- a/gui/simple-greeter/gdm-simple-greeter.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef __GDM_SIMPLE_GREETER_H
-#define __GDM_SIMPLE_GREETER_H
-
-#include <glib-object.h>
-
-#include "gdm-greeter.h"
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_SIMPLE_GREETER (gdm_simple_greeter_get_type ())
-#define GDM_SIMPLE_GREETER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SIMPLE_GREETER, GdmSimpleGreeter))
-#define GDM_SIMPLE_GREETER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SIMPLE_GREETER, GdmSimpleGreeterClass))
-#define GDM_IS_SIMPLE_GREETER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SIMPLE_GREETER))
-#define GDM_IS_SIMPLE_GREETER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SIMPLE_GREETER))
-#define GDM_SIMPLE_GREETER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SIMPLE_GREETER, GdmSimpleGreeterClass))
-
-typedef struct GdmSimpleGreeterPrivate GdmSimpleGreeterPrivate;
-
-typedef struct
-{
- GdmGreeter parent;
- GdmSimpleGreeterPrivate *priv;
-} GdmSimpleGreeter;
-
-typedef struct
-{
- GdmGreeterClass parent_class;
-
-} GdmSimpleGreeterClass;
-
-GType gdm_simple_greeter_get_type (void);
-GdmGreeter * gdm_simple_greeter_new (const char *display_id);
-
-
-G_END_DECLS
-
-#endif /* __GDM_SIMPLE_GREETER_H */
diff --git a/gui/simple-greeter/gdm-user-chooser-dialog.c b/gui/simple-greeter/gdm-user-chooser-dialog.c
deleted file mode 100644
index 89552a0e..00000000
--- a/gui/simple-greeter/gdm-user-chooser-dialog.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include "gdm-user-chooser-widget.h"
-#include "gdm-user-chooser-dialog.h"
-
-#define GDM_USER_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogPrivate))
-
-struct GdmUserChooserDialogPrivate
-{
- GtkWidget *chooser_widget;
-};
-
-enum {
- PROP_0,
-};
-
-static void gdm_user_chooser_dialog_class_init (GdmUserChooserDialogClass *klass);
-static void gdm_user_chooser_dialog_init (GdmUserChooserDialog *user_chooser_dialog);
-static void gdm_user_chooser_dialog_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmUserChooserDialog, gdm_user_chooser_dialog, GTK_TYPE_DIALOG)
-
-char *
-gdm_user_chooser_dialog_get_current_user_name (GdmUserChooserDialog *dialog)
-{
- char *user_name;
-
- g_return_val_if_fail (GDM_IS_USER_CHOOSER_DIALOG (dialog), NULL);
-
- user_name = gdm_user_chooser_widget_get_current_user_name (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget));
-
- return user_name;
-}
-
-static void
-gdm_user_chooser_dialog_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmUserChooserDialog *self;
-
- self = GDM_USER_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_user_chooser_dialog_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmUserChooserDialog *self;
-
- self = GDM_USER_CHOOSER_DIALOG (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_user_chooser_dialog_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmUserChooserDialog *user_chooser_dialog;
- GdmUserChooserDialogClass *klass;
-
- klass = GDM_USER_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_USER_CHOOSER_DIALOG));
-
- user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (user_chooser_dialog);
-}
-
-static void
-gdm_user_chooser_dialog_dispose (GObject *object)
-{
- GdmUserChooserDialog *user_chooser_dialog;
-
- user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (object);
-
- G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->dispose (object);
-}
-
-static void
-gdm_user_chooser_dialog_class_init (GdmUserChooserDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_user_chooser_dialog_get_property;
- object_class->set_property = gdm_user_chooser_dialog_set_property;
- object_class->constructor = gdm_user_chooser_dialog_constructor;
- object_class->dispose = gdm_user_chooser_dialog_dispose;
- object_class->finalize = gdm_user_chooser_dialog_finalize;
-
- g_type_class_add_private (klass, sizeof (GdmUserChooserDialogPrivate));
-}
-
-static void
-on_response (GdmUserChooserDialog *dialog,
- gint response_id)
-{
- switch (response_id) {
- default:
- break;
- }
-}
-
-static void
-gdm_user_chooser_dialog_init (GdmUserChooserDialog *dialog)
-{
-
- dialog->priv = GDM_USER_CHOOSER_DIALOG_GET_PRIVATE (dialog);
-
- dialog->priv->chooser_widget = gdm_user_chooser_widget_new ();
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (on_response),
- dialog);
-
- gtk_widget_show_all (GTK_WIDGET (dialog));
-}
-
-static void
-gdm_user_chooser_dialog_finalize (GObject *object)
-{
- GdmUserChooserDialog *user_chooser_dialog;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_USER_CHOOSER_DIALOG (object));
-
- user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (object);
-
- g_return_if_fail (user_chooser_dialog->priv != NULL);
-
- G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_user_chooser_dialog_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_USER_CHOOSER_DIALOG,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-user-chooser-dialog.h b/gui/simple-greeter/gdm-user-chooser-dialog.h
deleted file mode 100644
index 30fdcf49..00000000
--- a/gui/simple-greeter/gdm-user-chooser-dialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_USER_CHOOSER_DIALOG_H
-#define __GDM_USER_CHOOSER_DIALOG_H
-
-#include <glib-object.h>
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_USER_CHOOSER_DIALOG (gdm_user_chooser_dialog_get_type ())
-#define GDM_USER_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialog))
-#define GDM_USER_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogClass))
-#define GDM_IS_USER_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_CHOOSER_DIALOG))
-#define GDM_IS_USER_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_CHOOSER_DIALOG))
-#define GDM_USER_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogClass))
-
-typedef struct GdmUserChooserDialogPrivate GdmUserChooserDialogPrivate;
-
-typedef struct
-{
- GtkDialog parent;
- GdmUserChooserDialogPrivate *priv;
-} GdmUserChooserDialog;
-
-typedef struct
-{
- GtkDialogClass parent_class;
-} GdmUserChooserDialogClass;
-
-GType gdm_user_chooser_dialog_get_type (void);
-
-GtkWidget * gdm_user_chooser_dialog_new (void);
-
-char * gdm_user_chooser_dialog_get_current_user_name (GdmUserChooserDialog *dialog);
-
-G_END_DECLS
-
-#endif /* __GDM_USER_CHOOSER_DIALOG_H */
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
deleted file mode 100644
index 525edc18..00000000
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
-
-#include "gdm-user-manager.h"
-#include "gdm-user-chooser-widget.h"
-
-enum {
- USER_NO_DISPLAY = 1 << 0,
- USER_ACCOUNT_DISABLED = 1 << 1,
-};
-
-#define GDM_USER_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetPrivate))
-
-typedef struct _GdmChooserUser {
- char *name;
- char *realname;
- GdkPixbuf *pixbuf;
- guint flags;
-} GdmChooserUser;
-
-struct GdmUserChooserWidgetPrivate
-{
- GtkWidget *iconview;
-
- GdmUserManager *manager;
- GHashTable *available_users;
- char *current_user;
-};
-
-enum {
- PROP_0,
-};
-
-enum {
- USER_ACTIVATED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
-static void gdm_user_chooser_widget_class_init (GdmUserChooserWidgetClass *klass);
-static void gdm_user_chooser_widget_init (GdmUserChooserWidget *user_chooser_widget);
-static void gdm_user_chooser_widget_finalize (GObject *object);
-
-G_DEFINE_TYPE (GdmUserChooserWidget, gdm_user_chooser_widget, GTK_TYPE_VBOX)
-
-enum {
- CHOOSER_LIST_PIXBUF_COLUMN = 0,
- CHOOSER_LIST_CAPTION_COLUMN,
- CHOOSER_LIST_TOOLTIP_COLUMN,
- CHOOSER_LIST_ID_COLUMN
-};
-
-static void
-chooser_user_free (GdmChooserUser *user)
-{
- if (user == NULL) {
- return;
- }
-
- if (user->pixbuf != NULL) {
- g_object_unref (user->pixbuf);
- }
-
- g_free (user->name);
- g_free (user->realname);
-
- g_free (user);
-}
-
-char *
-gdm_user_chooser_widget_get_current_user_name (GdmUserChooserWidget *widget)
-{
- char *user_name;
-
- g_return_val_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget), NULL);
-
- user_name = NULL;
- if (widget->priv->current_user != NULL) {
- user_name = g_strdup (widget->priv->current_user);
- }
-
- return user_name;
-}
-
-static void
-select_name (GdmUserChooserWidget *widget,
- const char *name)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = NULL;
-
- model = gtk_icon_view_get_model (GTK_ICON_VIEW (widget->priv->iconview));
-
- if (name != NULL && gtk_tree_model_get_iter_first (model, &iter)) {
-
- do {
- GdmChooserUser *user;
- char *id;
- gboolean found;
-
- user = NULL;
- id = NULL;
- gtk_tree_model_get (model,
- &iter,
- CHOOSER_LIST_ID_COLUMN, &id,
- -1);
- if (id != NULL) {
- user = g_hash_table_lookup (widget->priv->available_users, id);
- g_free (id);
- }
-
- found = (user != NULL
- && user->name != NULL
- && strcmp (user->name, name) == 0);
-
- if (found) {
- path = gtk_tree_model_get_path (model, &iter);
- break;
- }
-
- } while (gtk_tree_model_iter_next (model, &iter));
- }
-
- if (path != NULL) {
- gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (widget->priv->iconview),
- path,
- TRUE,
- 0.5,
- 0.0);
- gtk_icon_view_set_cursor (GTK_ICON_VIEW (widget->priv->iconview),
- path,
- NULL,
- FALSE);
-
- gtk_tree_path_free (path);
- }
-}
-
-void
-gdm_user_chooser_widget_set_current_user_name (GdmUserChooserWidget *widget,
- const char *name)
-{
- g_return_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget));
-
- if (name == NULL) {
- gtk_icon_view_unselect_all (GTK_ICON_VIEW (widget->priv->iconview));
- } else {
- select_name (widget, name);
- }
-}
-
-static void
-gdm_user_chooser_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmUserChooserWidget *self;
-
- self = GDM_USER_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdm_user_chooser_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmUserChooserWidget *self;
-
- self = GDM_USER_CHOOSER_WIDGET (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-gdm_user_chooser_widget_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- GdmUserChooserWidget *user_chooser_widget;
- GdmUserChooserWidgetClass *klass;
-
- klass = GDM_USER_CHOOSER_WIDGET_CLASS (g_type_class_peek (GDM_TYPE_USER_CHOOSER_WIDGET));
-
- user_chooser_widget = GDM_USER_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (user_chooser_widget);
-}
-
-static void
-gdm_user_chooser_widget_dispose (GObject *object)
-{
- GdmUserChooserWidget *widget;
-
- widget = GDM_USER_CHOOSER_WIDGET (object);
-
- if (widget->priv->available_users != NULL) {
- g_hash_table_destroy (widget->priv->available_users);
- widget->priv->available_users = NULL;
- }
-
- g_free (widget->priv->current_user);
- widget->priv->current_user = NULL;
-
- G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->dispose (object);
-}
-
-static void
-gdm_user_chooser_widget_class_init (GdmUserChooserWidgetClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = gdm_user_chooser_widget_get_property;
- object_class->set_property = gdm_user_chooser_widget_set_property;
- object_class->constructor = gdm_user_chooser_widget_constructor;
- object_class->dispose = gdm_user_chooser_widget_dispose;
- object_class->finalize = gdm_user_chooser_widget_finalize;
-
- signals [USER_ACTIVATED] = g_signal_new ("user-activated",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserChooserWidgetClass, user_activated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_type_class_add_private (klass, sizeof (GdmUserChooserWidgetPrivate));
-}
-
-static void
-on_selection_changed (GtkIconView *icon_view,
- GdmUserChooserWidget *widget)
-{
- GList *items;
- char *id;
-
- id = NULL;
-
- items = gtk_icon_view_get_selected_items (icon_view);
- if (items != NULL) {
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- path = items->data;
- model = gtk_icon_view_get_model (icon_view);
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, CHOOSER_LIST_ID_COLUMN, &id, -1);
- }
-
- g_free (widget->priv->current_user);
- widget->priv->current_user = g_strdup (id);
-
- g_list_foreach (items, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (items);
-}
-
-static void
-collect_users (GdmUserChooserWidget *widget)
-{
-
-}
-
-static void
-on_item_activated (GtkIconView *icon_view,
- GtkTreePath *tree_path,
- GdmUserChooserWidget *widget)
-{
- g_signal_emit (widget, signals[USER_ACTIVATED], 0);
-}
-
-static void
-add_user_to_model (const char *name,
- GdmChooserUser *user,
- GdmUserChooserWidget *widget)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- char *caption;
- char *tooltip;
-
- if (user->flags & USER_NO_DISPLAY
- || user->flags & USER_ACCOUNT_DISABLED) {
- /* skip */
- g_debug ("Not adding user to list: %s", user->name);
- }
-
- caption = g_strdup_printf ("<span size=\"x-large\">%s</span>",
- user->realname);
- tooltip = g_strdup_printf ("%s: %s",
- _("Short Name"),
- user->name);
-
- model = gtk_icon_view_get_model (GTK_ICON_VIEW (widget->priv->iconview));
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- CHOOSER_LIST_PIXBUF_COLUMN, user->pixbuf,
- CHOOSER_LIST_CAPTION_COLUMN, caption,
- CHOOSER_LIST_TOOLTIP_COLUMN, tooltip,
- CHOOSER_LIST_ID_COLUMN, name,
- -1);
- g_free (caption);
-}
-
-static GdkPixbuf *
-get_pixbuf_for_user (GdmUserChooserWidget *widget,
- const char *username)
-{
- GtkIconTheme *theme;
- GdkPixbuf *pixbuf;
- int size;
-
- theme = gtk_icon_theme_get_default ();
- gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (theme, "stock_person", size, 0, NULL);
-
- return pixbuf;
-}
-
-static void
-populate_model (GdmUserChooserWidget *widget,
- GtkTreeModel *model)
-{
-
- g_hash_table_foreach (widget->priv->available_users,
- (GHFunc)add_user_to_model,
- widget);
-}
-
-static gboolean
-separator_func (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- int column = GPOINTER_TO_INT (data);
- char *text;
-
- gtk_tree_model_get (model, iter, column, &text, -1);
-
- if (text != NULL && strcmp (text, "__separator") == 0) {
- return TRUE;
- }
-
- g_free (text);
-
- return FALSE;
-}
-
-static int
-compare_user_names (char *name_a,
- char *name_b,
- char *id_a,
- char *id_b)
-{
-
- if (id_a == NULL) {
- return 1;
- } else if (id_b == NULL) {
- return -1;
- }
-
- if (strcmp (id_a, "__previous-user") == 0) {
- return -1;
- } else if (strcmp (id_b, "__previous-user") == 0) {
- return 1;
- } else if (strcmp (id_a, "__default-user") == 0) {
- return -1;
- } else if (strcmp (id_b, "__default-user") == 0) {
- return 1;
- } else if (strcmp (id_a, "__separator") == 0) {
- return -1;
- } else if (strcmp (id_b, "__separator") == 0) {
- return 1;
- }
-
- if (name_a == NULL) {
- return 1;
- } else if (name_b == NULL) {
- return -1;
- }
-
- return g_utf8_collate (name_a, name_b);
-}
-
-static int
-compare_user (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- char *name_a;
- char *name_b;
- char *id_a;
- char *id_b;
- int result;
-
- gtk_tree_model_get (model, a, CHOOSER_LIST_CAPTION_COLUMN, &name_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_CAPTION_COLUMN, &name_b, -1);
- gtk_tree_model_get (model, a, CHOOSER_LIST_ID_COLUMN, &id_a, -1);
- gtk_tree_model_get (model, b, CHOOSER_LIST_ID_COLUMN, &id_b, -1);
-
- result = compare_user_names (name_a, name_b, id_a, id_b);
-
- g_free (name_a);
- g_free (name_b);
- g_free (id_a);
- g_free (id_b);
-
- return result;
-}
-
-static void
-on_user_added (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GdkPixbuf *pixbuf;
- char *caption;
- char *tooltip;
-
- g_debug ("User added: %s", gdm_user_get_user_name (user));
-
- pixbuf = get_pixbuf_for_user (widget, gdm_user_get_user_name (user));
-
- caption = g_strdup_printf ("<span size=\"x-large\">%s</span>",
- gdm_user_get_real_name (user));
- tooltip = g_strdup_printf ("%s: %s",
- _("Short Name"),
- gdm_user_get_user_name (user));
-
- model = gtk_icon_view_get_model (GTK_ICON_VIEW (widget->priv->iconview));
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- CHOOSER_LIST_PIXBUF_COLUMN, pixbuf,
- CHOOSER_LIST_CAPTION_COLUMN, caption,
- CHOOSER_LIST_TOOLTIP_COLUMN, tooltip,
- CHOOSER_LIST_ID_COLUMN, gdm_user_get_user_name (user),
- -1);
- g_free (caption);
- g_free (tooltip);
-
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
-}
-
-static void
-on_user_removed (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- g_debug ("User removed: %s", gdm_user_get_user_name (user));
-
- /* FIXME: */
-}
-
-static void
-gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
-{
- GtkTreeModel *model;
- GtkWidget *scrolled;
-
- widget->priv = GDM_USER_CHOOSER_WIDGET_GET_PRIVATE (widget);
-
- widget->priv->manager = gdm_user_manager_ref_default ();
- g_signal_connect (widget->priv->manager,
- "user-added",
- G_CALLBACK (on_user_added),
- widget);
- g_signal_connect (widget->priv->manager,
- "user-removed",
- G_CALLBACK (on_user_removed),
- widget);
-
- widget->priv->available_users = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)chooser_user_free);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
-
- widget->priv->iconview = gtk_icon_view_new ();
- gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (widget->priv->iconview), GTK_SELECTION_SINGLE);
- gtk_icon_view_set_orientation (GTK_ICON_VIEW (widget->priv->iconview), GTK_ORIENTATION_HORIZONTAL);
- g_signal_connect (widget->priv->iconview,
- "item-activated",
- G_CALLBACK (on_item_activated),
- widget);
- g_signal_connect (widget->priv->iconview,
- "selection-changed",
- G_CALLBACK (on_selection_changed),
- widget);
- gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->iconview);
-
- model = (GtkTreeModel *)gtk_list_store_new (4,
- GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING);
- gtk_icon_view_set_model (GTK_ICON_VIEW (widget->priv->iconview), model);
-
- gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (widget->priv->iconview), CHOOSER_LIST_PIXBUF_COLUMN);
- gtk_icon_view_set_markup_column (GTK_ICON_VIEW (widget->priv->iconview), CHOOSER_LIST_CAPTION_COLUMN);
- gtk_icon_view_set_tooltip_column (GTK_ICON_VIEW (widget->priv->iconview), CHOOSER_LIST_TOOLTIP_COLUMN);
-
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_CAPTION_COLUMN,
- compare_user,
- NULL, NULL);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
- CHOOSER_LIST_CAPTION_COLUMN,
- GTK_SORT_ASCENDING);
-
- collect_users (widget);
-
- populate_model (widget, model);
-}
-
-static void
-gdm_user_chooser_widget_finalize (GObject *object)
-{
- GdmUserChooserWidget *user_chooser_widget;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_USER_CHOOSER_WIDGET (object));
-
- user_chooser_widget = GDM_USER_CHOOSER_WIDGET (object);
-
- g_return_if_fail (user_chooser_widget->priv != NULL);
-
- G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->finalize (object);
-}
-
-GtkWidget *
-gdm_user_chooser_widget_new (void)
-{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_USER_CHOOSER_WIDGET,
- NULL);
-
- return GTK_WIDGET (object);
-}
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.h b/gui/simple-greeter/gdm-user-chooser-widget.h
deleted file mode 100644
index 5c17b9f4..00000000
--- a/gui/simple-greeter/gdm-user-chooser-widget.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_USER_CHOOSER_WIDGET_H
-#define __GDM_USER_CHOOSER_WIDGET_H
-
-#include <glib-object.h>
-#include <gtk/gtkvbox.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_USER_CHOOSER_WIDGET (gdm_user_chooser_widget_get_type ())
-#define GDM_USER_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidget))
-#define GDM_USER_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetClass))
-#define GDM_IS_USER_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_CHOOSER_WIDGET))
-#define GDM_IS_USER_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_CHOOSER_WIDGET))
-#define GDM_USER_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetClass))
-
-typedef struct GdmUserChooserWidgetPrivate GdmUserChooserWidgetPrivate;
-
-typedef struct
-{
- GtkVBox parent;
- GdmUserChooserWidgetPrivate *priv;
-} GdmUserChooserWidget;
-
-typedef struct
-{
- GtkVBoxClass parent_class;
-
- /* signals */
- void (* user_activated) (GdmUserChooserWidget *widget);
-} GdmUserChooserWidgetClass;
-
-GType gdm_user_chooser_widget_get_type (void);
-GtkWidget * gdm_user_chooser_widget_new (void);
-
-char * gdm_user_chooser_widget_get_current_user_name (GdmUserChooserWidget *widget);
-void gdm_user_chooser_widget_set_current_user_name (GdmUserChooserWidget *widget,
- const char *user_name);
-
-G_END_DECLS
-
-#endif /* __GDM_USER_CHOOSER_WIDGET_H */
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
deleted file mode 100644
index 73288023..00000000
--- a/gui/simple-greeter/gdm-user-manager.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <glib-object.h>
-
-#include <libgnomevfs/gnome-vfs-ops.h>
-
-#include "gdm-user-manager.h"
-#include "gdm-user-private.h"
-
-#define GDM_USER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_USER_MANAGER, GdmUserManagerPrivate))
-
-/* Prefs Defaults */
-#define DEFAULT_ALLOW_ROOT TRUE
-#define DEFAULT_MAX_ICON_SIZE 128
-#define DEFAULT_USER_MAX_FILE 65536
-
-#ifdef __sun
-#define DEFAULT_MINIMAL_UID 100
-#else
-#define DEFAULT_MINIMAL_UID 500
-#endif
-
-#define DEFAULT_GLOBAL_FACE_DIR DATADIR "/faces"
-#define DEFAULT_USER_ICON "stock_person"
-#define DEFAULT_EXCLUDE { "bin", \
- "daemon", \
- "adm", \
- "lp", \
- "sync", \
- "shutdown", \
- "halt", \
- "mail", \
- "news", \
- "uucp", \
- "operator", \
- "nobody", \
- "gdm", \
- "postgres", \
- "pvm", \
- "rpm", \
- "nfsnobody", \
- "pcap", \
- NULL }
-
-struct GdmUserManagerPrivate
-{
- GHashTable *users;
- GHashTable *shells;
- GHashTable *exclusions;
- GnomeVFSMonitorHandle *passwd_monitor;
- GnomeVFSMonitorHandle *shells_monitor;
-
- guint reload_id;
- uid_t minimal_uid;
-
- guint8 users_dirty : 1;
-};
-
-enum {
- USER_ADDED,
- USER_REMOVED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
-static void gdm_user_manager_class_init (GdmUserManagerClass *klass);
-static void gdm_user_manager_init (GdmUserManager *user_manager);
-static void gdm_user_manager_finalize (GObject *object);
-
-static gpointer user_manager_object = NULL;
-
-G_DEFINE_TYPE (GdmUserManager, gdm_user_manager, G_TYPE_OBJECT)
-
-GQuark
-gdm_user_manager_error_quark (void)
-{
- static GQuark ret = 0;
- if (ret == 0) {
- ret = g_quark_from_static_string ("gdm_user_manager_error");
- }
-
- return ret;
-}
-
-/**
- * gdm_manager_get_user:
- * @manager: the manager to query.
- * @username: the login name of the user to get.
- *
- * Retrieves a pointer to the #GdmUser object for the login named @username
- * from @manager. This pointer is not a reference, and should not be released.
- *
- * Returns: a pointer to a #GdmUser object.
- **/
-GdmUser *
-gdm_user_manager_get_user (GdmUserManager *manager,
- const char *username)
-{
- GdmUser *user;
-
- g_return_val_if_fail (GDM_IS_USER_MANAGER (manager), NULL);
- g_return_val_if_fail (username != NULL && username[0] != '\0', NULL);
-
- user = g_hash_table_lookup (manager->priv->users, username);
-
- if (user == NULL) {
- struct passwd *pwent;
-
- pwent = getpwnam (username);
-
- if (pwent != NULL) {
- user = g_object_new (GDM_TYPE_USER, "manager", manager, NULL);
- _gdm_user_update (user, pwent);
- g_hash_table_insert (manager->priv->users,
- g_strdup (pwent->pw_name),
- user);
- g_signal_emit (manager, signals[USER_ADDED], 0, user);
- }
- }
-
- return user;
-}
-
-static void
-listify_hash_values_hfunc (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GSList **list = user_data;
-
- *list = g_slist_prepend (*list, value);
-}
-
-GSList *
-gdm_user_manager_list_users (GdmUserManager *manager)
-{
- GSList *retval;
-
- g_return_val_if_fail (GDM_IS_USER_MANAGER (manager), NULL);
-
- retval = NULL;
- g_hash_table_foreach (manager->priv->users, listify_hash_values_hfunc, &retval);
-
- return g_slist_sort (retval, (GCompareFunc) gdm_user_collate);
-}
-
-static void
-reload_passwd (GdmUserManager *manager)
-{
- struct passwd *pwent;
- GSList *old_users;
- GSList *new_users;
- GSList *list;
-
- old_users = NULL;
- new_users = NULL;
-
- g_hash_table_foreach (manager->priv->users, listify_hash_values_hfunc, &old_users);
- g_slist_foreach (old_users, (GFunc) g_object_ref, NULL);
-
- /* Make sure we keep users who are logged in no matter what. */
- for (list = old_users; list; list = list->next) {
- if (gdm_user_get_n_sessions (list->data)) {
- g_object_freeze_notify (G_OBJECT (list->data));
- new_users = g_slist_prepend (new_users, g_object_ref (list->data));
- }
- }
-
- setpwent ();
-
- for (pwent = getpwent (); pwent; pwent = getpwent ()) {
- GdmUser *user;
-
- user = NULL;
-
- /* Skip users below MinimalUID... */
- if (pwent->pw_uid < manager->priv->minimal_uid) {
- continue;
- }
-
- /* ...And users w/ invalid shells... */
- if (!pwent->pw_shell ||
- !g_hash_table_lookup (manager->priv->shells, pwent->pw_shell)) {
- continue;
- }
-
- /* ...And explicitly excluded users */
- if (g_hash_table_lookup (manager->priv->exclusions, pwent->pw_name)) {
- continue;
- }
-
- user = g_hash_table_lookup (manager->priv->users, pwent->pw_name);
-
- /* Update users already in the *new* list */
- if (g_slist_find (new_users, user)) {
- _gdm_user_update (user, pwent);
- continue;
- }
-
- if (user == NULL) {
- user = g_object_new (GDM_TYPE_USER,
- "manager", manager,
- NULL);
- } else {
- g_object_ref (user);
- }
-
- /* Freeze & update users not already in the new list */
- g_object_freeze_notify (G_OBJECT (user));
- _gdm_user_update (user, pwent);
-
- new_users = g_slist_prepend (new_users, user);
- }
-
- endpwent ();
-
- /* Go through and handle added users */
- for (list = new_users; list; list = list->next) {
- if (! g_slist_find (old_users, list->data)) {
- g_hash_table_insert (manager->priv->users,
- g_strdup (gdm_user_get_user_name (list->data)),
- g_object_ref (list->data));
- g_signal_emit (manager, signals[USER_ADDED], 0, list->data);
- }
- }
-
- /* Go through and handle removed users */
- for (list = old_users; list; list = list->next) {
- if (! g_slist_find (new_users, list->data)) {
- g_signal_emit (manager, signals[USER_REMOVED], 0, list->data);
- g_hash_table_remove (manager->priv->users,
- gdm_user_get_user_name (list->data));
- }
- }
-
- /* Cleanup */
- g_slist_foreach (new_users, (GFunc) g_object_thaw_notify, NULL);
- g_slist_foreach (new_users, (GFunc) g_object_unref, NULL);
- g_slist_free (new_users);
-
- g_slist_foreach (old_users, (GFunc) g_object_unref, NULL);
- g_slist_free (old_users);
-}
-
-static void
-reload_shells (GdmUserManager *manager)
-{
- char *shell;
-
- setusershell ();
-
- g_hash_table_remove_all (manager->priv->shells);
- for (shell = getusershell (); shell; shell = getusershell ()) {
- g_hash_table_insert (manager->priv->shells,
- g_strdup (shell),
- GUINT_TO_POINTER (TRUE));
- }
-
- endusershell ();
-}
-
-static void
-shells_monitor_cb (GnomeVFSMonitorHandle *handle,
- const gchar *text_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- GdmUserManager *manager)
-{
- if (event_type != GNOME_VFS_MONITOR_EVENT_CHANGED &&
- event_type != GNOME_VFS_MONITOR_EVENT_CREATED)
- return;
-
- reload_shells (manager);
- reload_passwd (manager);
-}
-
-static void
-passwd_monitor_cb (GnomeVFSMonitorHandle *handle,
- const gchar *text_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- GdmUserManager *manager)
-{
- if (event_type != GNOME_VFS_MONITOR_EVENT_CHANGED &&
- event_type != GNOME_VFS_MONITOR_EVENT_CREATED)
- return;
-
- reload_passwd (manager);
-}
-
-static void
-gdm_user_manager_class_init (GdmUserManagerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gdm_user_manager_finalize;
-
- signals [USER_ADDED] =
- g_signal_new ("user-added",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserManagerClass, user_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, GDM_TYPE_USER);
- signals [USER_REMOVED] =
- g_signal_new ("user-removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserManagerClass, user_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, GDM_TYPE_USER);
-
- g_type_class_add_private (klass, sizeof (GdmUserManagerPrivate));
-}
-
-static gboolean
-reload_passwd_timeout (GdmUserManager *manager)
-{
- reload_passwd (manager);
- manager->priv->reload_id = 0;
- return FALSE;
-}
-
-static void
-queue_reload_passwd (GdmUserManager *manager)
-{
- if (manager->priv->reload_id > 0) {
- return;
- }
-
- manager->priv->reload_id = g_idle_add ((GSourceFunc)reload_passwd_timeout, manager);
-}
-
-static void
-gdm_user_manager_init (GdmUserManager *manager)
-{
- GError *error;
- char *uri;
- GnomeVFSResult result;
- int i;
- const char *exclude_default[] = DEFAULT_EXCLUDE;
-
- manager->priv = GDM_USER_MANAGER_GET_PRIVATE (manager);
-
- manager->priv->minimal_uid = DEFAULT_MINIMAL_UID;
-
- /* exclusions */
- manager->priv->exclusions = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
- for (i = 0; exclude_default[i] != NULL; i++) {
- g_hash_table_insert (manager->priv->exclusions,
- g_strdup (exclude_default [i]),
- GUINT_TO_POINTER (TRUE));
- }
-
- /* /etc/shells */
- manager->priv->shells = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
- reload_shells (manager);
- error = NULL;
- uri = g_filename_to_uri ("/etc/shells", NULL, &error);
- if (uri == NULL) {
- g_critical ("Could not create URI for shells file `/etc/shells': %s",
- error->message);
- g_error_free (error);
- } else {
- result = gnome_vfs_monitor_add (&(manager->priv->shells_monitor),
- uri,
- GNOME_VFS_MONITOR_FILE,
- (GnomeVFSMonitorCallback)shells_monitor_cb,
- manager);
- g_free (uri);
-
- if (result != GNOME_VFS_OK)
- g_critical ("Could not install monitor for shells file `/etc/shells': %s",
- gnome_vfs_result_to_string (result));
- }
-
- /* /etc/passwd */
- manager->priv->users = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- (GDestroyNotify) g_object_run_dispose);
- error = NULL;
- uri = g_filename_to_uri ("/etc/passwd", NULL, &error);
- if (uri == NULL) {
- g_critical ("Could not create URI for password file `/etc/passwd': %s",
- error->message);
- g_error_free (error);
- } else {
- result = gnome_vfs_monitor_add (&(manager->priv->passwd_monitor),
- uri,
- GNOME_VFS_MONITOR_FILE,
- (GnomeVFSMonitorCallback)passwd_monitor_cb,
- manager);
- g_free (uri);
-
- if (result != GNOME_VFS_OK)
- g_critical ("Could not install monitor for password file `/etc/passwd: %s",
- gnome_vfs_result_to_string (result));
- }
-
- /* FIXME: add ConsoleKit seat monitoring */
-
- queue_reload_passwd (manager);
-
- manager->priv->users_dirty = FALSE;
-
-}
-
-static void
-gdm_user_manager_finalize (GObject *object)
-{
- GdmUserManager *manager;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_USER_MANAGER (object));
-
- manager = GDM_USER_MANAGER (object);
-
- g_return_if_fail (manager->priv != NULL);
-
- if (manager->priv->reload_id > 0) {
- g_source_remove (manager->priv->reload_id);
- manager->priv->reload_id = 0;
- }
-
- gnome_vfs_monitor_cancel (manager->priv->shells_monitor);
- g_hash_table_destroy (manager->priv->shells);
-
- gnome_vfs_monitor_cancel (manager->priv->passwd_monitor);
- g_hash_table_destroy (manager->priv->users);
-
- G_OBJECT_CLASS (gdm_user_manager_parent_class)->finalize (object);
-}
-
-GdmUserManager *
-gdm_user_manager_ref_default (void)
-{
- if (user_manager_object != NULL) {
- g_object_ref (user_manager_object);
- } else {
- user_manager_object = g_object_new (GDM_TYPE_USER_MANAGER, NULL);
- g_object_add_weak_pointer (user_manager_object,
- (gpointer *) &user_manager_object);
- }
-
- return GDM_USER_MANAGER (user_manager_object);
-}
diff --git a/gui/simple-greeter/gdm-user-manager.h b/gui/simple-greeter/gdm-user-manager.h
deleted file mode 100644
index 590ab1da..00000000
--- a/gui/simple-greeter/gdm-user-manager.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __GDM_USER_MANAGER_H
-#define __GDM_USER_MANAGER_H
-
-#include <glib-object.h>
-
-#include "gdm-user.h"
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_USER_MANAGER (gdm_user_manager_get_type ())
-#define GDM_USER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_MANAGER, GdmUserManager))
-#define GDM_USER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_MANAGER, GdmUserManagerClass))
-#define GDM_IS_USER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_MANAGER))
-#define GDM_IS_USER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_MANAGER))
-#define GDM_USER_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_MANAGER, GdmUserManagerClass))
-
-typedef struct GdmUserManagerPrivate GdmUserManagerPrivate;
-
-typedef struct
-{
- GObject parent;
- GdmUserManagerPrivate *priv;
-} GdmUserManager;
-
-typedef struct
-{
- GObjectClass parent_class;
-
- void (* user_added) (GdmUserManager *user_manager,
- GdmUser *user);
- void (* user_removed) (GdmUserManager *user_manager,
- GdmUser *user);
-} GdmUserManagerClass;
-
-typedef enum
-{
- GDM_USER_MANAGER_ERROR_GENERAL,
- GDM_USER_MANAGER_ERROR_KEY_NOT_FOUND
-} GdmUserManagerError;
-
-#define GDM_USER_MANAGER_ERROR gdm_user_manager_error_quark ()
-
-GQuark gdm_user_manager_error_quark (void);
-GType gdm_user_manager_get_type (void);
-
-GdmUserManager * gdm_user_manager_ref_default (void);
-
-GSList * gdm_user_manager_list_users (GdmUserManager *manager);
-GdmUser * gdm_user_manager_get_user (GdmUserManager *manager,
- const char *user_name);
-G_END_DECLS
-
-#endif /* __GDM_USER_MANAGER_H */
diff --git a/gui/simple-greeter/gdm-user-private.h b/gui/simple-greeter/gdm-user-private.h
deleted file mode 100644
index 731fef3b..00000000
--- a/gui/simple-greeter/gdm-user-private.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Private interfaces to the GdmUser object
- */
-
-#ifndef __GDM_USER_PRIVATE__
-#define __GDM_USER_PRIVATE__ 1
-
-#include <pwd.h>
-
-#include "gdm-user.h"
-
-G_BEGIN_DECLS
-
-void _gdm_user_update (GdmUser *user,
- const struct passwd *pwent);
-void _gdm_user_add_session (GdmUser *user,
- const char *ssid);
-void _gdm_user_remove_session (GdmUser *user,
- const char *ssid);
-void _gdm_user_icon_changed (GdmUser *user);
-
-G_END_DECLS
-
-#endif /* !__GDM_USER_PRIVATE__ */
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
deleted file mode 100644
index a7d1e9ed..00000000
--- a/gui/simple-greeter/gdm-user.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <glib/gi18n.h>
-#include <gtk/gtkicontheme.h>
-
-#include "gdm-user-manager.h"
-#include "gdm-user-private.h"
-
-#define GDM_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_USER, GdmUserClass))
-#define GDM_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_USER))
-#define GDM_USER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GDM_TYPE_USER, GdmUserClass))
-
-enum {
- PROP_0,
- PROP_MANAGER,
- PROP_REAL_NAME,
- PROP_USER_NAME,
- PROP_UID,
- PROP_HOME_DIR,
- PROP_SHELL,
- PROP_SESSIONS
-};
-
-enum {
- ICON_CHANGED,
- SESSIONS_CHANGED,
- LAST_SIGNAL
-};
-
-struct _GdmUser {
- GObject parent;
-
- GdmUserManager *manager;
-
- uid_t uid;
- gchar *user_name;
- gchar *real_name;
- gchar *home_dir;
- gchar *shell;
- GSList *sessions;
-};
-
-typedef struct _GdmUserClass
-{
- GObjectClass parent_class;
-
- void (* icon_changed) (GdmUser *user);
- void (* sessions_changed) (GdmUser *user);
-} GdmUserClass;
-
-/* GObject Functions */
-static void gdm_user_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gdm_user_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void gdm_user_finalize (GObject *object);
-
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (GdmUser, gdm_user, G_TYPE_OBJECT);
-
-static void
-gdm_user_class_init (GdmUserClass *class)
-{
- GObjectClass *gobject_class;
-
- gobject_class = G_OBJECT_CLASS (class);
-
- gobject_class->set_property = gdm_user_set_property;
- gobject_class->get_property = gdm_user_get_property;
- gobject_class->finalize = gdm_user_finalize;
-
- g_object_class_install_property (gobject_class,
- PROP_MANAGER,
- g_param_spec_object ("manager",
- _("Manager"),
- _("The user manager object this user is controlled by."),
- GDM_TYPE_USER_MANAGER,
- (G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY)));
-
- g_object_class_install_property (gobject_class,
- PROP_REAL_NAME,
- g_param_spec_string ("real-name",
- "Real Name",
- "The real name to display for this user.",
- NULL,
- G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class,
- PROP_UID,
- g_param_spec_ulong ("uid",
- "User ID",
- "The UID for this user.",
- 0, G_MAXULONG, 0,
- G_PARAM_READABLE));
- g_object_class_install_property (gobject_class,
- PROP_USER_NAME,
- g_param_spec_string ("user-name",
- "User Name",
- "The login name for this user.",
- NULL,
- G_PARAM_READABLE));
- g_object_class_install_property (gobject_class,
- PROP_HOME_DIR,
- g_param_spec_string ("home-directory",
- "Home Directory",
- "The home directory for this user.",
- NULL,
- G_PARAM_READABLE));
- g_object_class_install_property (gobject_class,
- PROP_SHELL,
- g_param_spec_string ("shell",
- "Shell",
- "The shell for this user.",
- NULL,
- G_PARAM_READABLE));
-
- signals [ICON_CHANGED] =
- g_signal_new ("icon-changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserClass, icon_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals [SESSIONS_CHANGED] =
- g_signal_new ("sessions-changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdmUserClass, sessions_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-gdm_user_init (GdmUser *user)
-{
- user->manager = NULL;
- user->user_name = NULL;
- user->real_name = NULL;
- user->sessions = NULL;
-}
-
-static void
-gdm_user_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdmUser *user;
-
- user = GDM_USER (object);
-
- switch (param_id) {
- case PROP_MANAGER:
- user->manager = g_value_get_object (value);
- g_assert (user->manager);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-gdm_user_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdmUser *user;
-
- user = GDM_USER (object);
-
- switch (param_id) {
- case PROP_MANAGER:
- g_value_set_object (value, user->manager);
- break;
- case PROP_USER_NAME:
- g_value_set_string (value, user->user_name);
- break;
- case PROP_REAL_NAME:
- g_value_set_string (value, user->real_name);
- break;
- case PROP_HOME_DIR:
- g_value_set_string (value, user->home_dir);
- break;
- case PROP_UID:
- g_value_set_ulong (value, user->uid);
- break;
- case PROP_SHELL:
- g_value_set_string (value, user->shell);
- break;
- case PROP_SESSIONS:
- if (user->sessions) {
- GValueArray *ar;
- GSList *list;
- GValue tmp = { 0 };
-
- ar = g_value_array_new (g_slist_length (user->sessions));
- g_value_init (&tmp, GDM_TYPE_USER);
- for (list = user->sessions; list; list = list->next) {
- g_value_set_object (&tmp, list->data);
- g_value_array_append (ar, &tmp);
- g_value_reset (&tmp);
- }
-
- g_value_take_boxed (value, ar);
- } else {
- g_value_set_boxed (value, NULL);
- }
-
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-gdm_user_finalize (GObject *object)
-{
- GdmUser *user;
-
- user = GDM_USER (object);
-
- g_free (user->user_name);
- g_free (user->real_name);
-
- if (G_OBJECT_CLASS (gdm_user_parent_class)->finalize)
- (*G_OBJECT_CLASS (gdm_user_parent_class)->finalize) (object);
-}
-
-/**
- * _gdm_user_update:
- * @user: the user object to update.
- * @pwent: the user data to use.
- *
- * Updates the properties of @user using the data in @pwent.
- *
- * Since: 1.0
- **/
-void
-_gdm_user_update (GdmUser *user,
- const struct passwd *pwent)
-{
- gchar *real_name;
-
- g_return_if_fail (GDM_IS_USER (user));
- g_return_if_fail (pwent != NULL);
-
- g_object_freeze_notify (G_OBJECT (user));
-
- /* Display Name */
- if (pwent->pw_gecos && pwent->pw_gecos[0] != '\0') {
- gchar *first_comma;
-
- first_comma = strchr (pwent->pw_gecos, ',');
- if (first_comma) {
- real_name = g_strndup (pwent->pw_gecos,
- (first_comma - pwent->pw_gecos));
- } else {
- real_name = g_strdup (pwent->pw_gecos);
- }
-
- if (real_name[0] == '\0') {
- g_free (real_name);
- real_name = NULL;
- }
- } else {
- real_name = NULL;
- }
-
- if ((real_name && !user->real_name) ||
- (!real_name && user->real_name) ||
- (real_name &&
- user->real_name &&
- strcmp (real_name, user->real_name) != 0)) {
- g_free (user->real_name);
- user->real_name = real_name;
- g_object_notify (G_OBJECT (user), "real-name");
- } else {
- g_free (real_name);
- }
-
- /* UID */
- if (pwent->pw_uid != user->uid) {
- user->uid = pwent->pw_uid;
- g_object_notify (G_OBJECT (user), "uid");
- }
-
- /* Username */
- if ((pwent->pw_name && !user->user_name) ||
- (!pwent->pw_name && user->user_name) ||
- (pwent->pw_name &&
- user->user_name &&
- strcmp (user->user_name, pwent->pw_name) != 0)) {
- g_free (user->user_name);
- user->user_name = g_strdup (pwent->pw_name);
- g_object_notify (G_OBJECT (user), "user-name");
- }
-
- /* Home Directory */
- if ((pwent->pw_dir && !user->home_dir) ||
- (!pwent->pw_dir && user->home_dir) ||
- strcmp (user->home_dir, pwent->pw_dir) != 0) {
- g_free (user->home_dir);
- user->home_dir = g_strdup (pwent->pw_dir);
- g_object_notify (G_OBJECT (user), "home-directory");
- g_signal_emit (user, signals[ICON_CHANGED], 0);
- }
-
- /* Shell */
- if ((pwent->pw_shell && !user->shell) ||
- (!pwent->pw_shell && user->shell) ||
- (pwent->pw_shell &&
- user->shell &&
- strcmp (user->shell, pwent->pw_shell) != 0)) {
- g_free (user->shell);
- user->shell = g_strdup (pwent->pw_shell);
- g_object_notify (G_OBJECT (user), "shell");
- }
-
- g_object_thaw_notify (G_OBJECT (user));
-}
-
-void
-_gdm_user_add_session (GdmUser *user,
- const char *ssid)
-{
- g_return_if_fail (GDM_IS_USER (user));
- g_return_if_fail (ssid != NULL);
-
- if (! g_slist_find (user->sessions, ssid)) {
- user->sessions = g_slist_append (user->sessions, g_strdup (ssid));
- g_signal_emit (user, signals[SESSIONS_CHANGED], 0);
- }
-}
-
-/**
- * _gdm_user_remove_session:
- * @user: the user to modify.
- * @ssid: the session id to remove
- *
- * Removes @ssid from the list of sessions @user is using, and emits the
- * "sessions-changed" signal, if necessary.
- *
- * Since: 1.0
- **/
-void
-_gdm_user_remove_session (GdmUser *user,
- const char *ssid)
-{
- GSList *li;
-
- g_return_if_fail (GDM_IS_USER (user));
- g_return_if_fail (ssid != NULL);
-
- li = g_slist_find (user->sessions, ssid);
- if (li != NULL) {
- g_free (li->data);
- user->sessions = g_slist_delete_link (user->sessions, li);
- g_signal_emit (user, signals[SESSIONS_CHANGED], 0);
- }
-}
-
-/**
- * _gdm_user_icon_changed:
- * @user: the user to emit the signal for.
- *
- * Emits the "icon-changed" signal for @user.
- *
- * Since: 1.0
- **/
-void
-_gdm_user_icon_changed (GdmUser *user)
-{
- g_return_if_fail (GDM_IS_USER (user));
-
- g_signal_emit (user, signals[ICON_CHANGED], 0);
-}
-
-/**
- * gdm_user_get_uid:
- * @user: the user object to examine.
- *
- * Retrieves the ID of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-
-uid_t
-gdm_user_get_uid (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), -1);
-
- return user->uid;
-}
-
-/**
- * gdm_user_get_real_name:
- * @user: the user object to examine.
- *
- * Retrieves the display name of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-G_CONST_RETURN gchar *
-gdm_user_get_real_name (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return (user->real_name ? user->real_name : user->user_name);
-}
-
-/**
- * gdm_user_get_user_name:
- * @user: the user object to examine.
- *
- * Retrieves the login name of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-
-G_CONST_RETURN gchar *
-gdm_user_get_user_name (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return user->user_name;
-}
-
-/**
- * gdm_user_get_home_directory:
- * @user: the user object to examine.
- *
- * Retrieves the home directory of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-
-G_CONST_RETURN gchar *
-gdm_user_get_home_directory (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return user->home_dir;
-}
-
-/**
- * gdm_user_get_shell:
- * @user: the user object to examine.
- *
- * Retrieves the login shell of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-
-G_CONST_RETURN gchar *
-gdm_user_get_shell (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return user->shell;
-}
-
-/**
- * gdm_user_get_displays:
- * @user: the user object to examine.
- *
- * Retrieves a new list of the displays that @user is logged in on. The list
- * itself must be freed with g_slist_free() when no longer needed.
- *
- * Returns: a list of #GdmDisplay objects which must be freed with
- * g_slist_free().
- *
- * Since: 1.0
- **/
-GSList *
-gdm_user_get_sessions (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return g_slist_copy (user->sessions);
-}
-
-/**
- * gdm_user_get_n_sessions:
- * @user: the user object to examine.
- *
- * Retrieves the number of sessions that @user is logged into.
- *
- * Returns: an unsigned integer.
- *
- * Since: 1.0
- **/
-guint
-gdm_user_get_n_sessions (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), FALSE);
-
- return g_slist_length (user->sessions);
-}
-
-gint
-gdm_user_collate (GdmUser *user1,
- GdmUser *user2)
-{
- const gchar *str1, *str2;
-
- g_return_val_if_fail (user1 == NULL || GDM_IS_USER (user1), 0);
- g_return_val_if_fail (user2 == NULL || GDM_IS_USER (user2), 0);
-
- if (!user1 && user2)
- return -1;
-
- if (user1 && !user2)
- return 1;
-
- if (!user1 && !user2)
- return 0;
-
- if (user1->real_name)
- str1 = user1->real_name;
- else
- str1 = user1->user_name;
-
- if (user2->real_name)
- str2 = user2->real_name;
- else
- str2 = user2->user_name;
-
- if (!str1 && str2)
- return -1;
-
- if (str1 && !str2)
- return 1;
-
- if (!str1 && !str2)
- return 0;
-
- return g_utf8_collate (str1, str2);
-}
diff --git a/gui/simple-greeter/gdm-user.h b/gui/simple-greeter/gdm-user.h
deleted file mode 100644
index fb091534..00000000
--- a/gui/simple-greeter/gdm-user.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Facade object for user data, owned by GdmUserManager
- */
-
-#ifndef __GDM_USER__
-#define __GDM_USER__ 1
-
-#include <sys/types.h>
-#include <gtk/gtkwidget.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_USER (gdm_user_get_type ())
-#define GDM_USER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDM_TYPE_USER, GdmUser))
-#define GDM_IS_USER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDM_TYPE_USER))
-
-typedef struct _GdmUser GdmUser;
-
-GType gdm_user_get_type (void) G_GNUC_CONST;
-
-uid_t gdm_user_get_uid (GdmUser *user);
-G_CONST_RETURN gchar *gdm_user_get_user_name (GdmUser *user);
-G_CONST_RETURN gchar *gdm_user_get_real_name (GdmUser *user);
-G_CONST_RETURN gchar *gdm_user_get_home_directory (GdmUser *user);
-G_CONST_RETURN gchar *gdm_user_get_shell (GdmUser *user);
-
-GSList *gdm_user_get_sessions (GdmUser *user);
-guint gdm_user_get_n_sessions (GdmUser *user);
-
-GdkPixbuf *gdm_user_render_icon (GdmUser *user,
- GtkWidget *widget,
- gint icon_size);
-
-gint gdm_user_collate (GdmUser *user1,
- GdmUser *user2);
-
-G_END_DECLS
-
-#endif
diff --git a/gui/simple-greeter/greeter-main.c b/gui/simple-greeter/greeter-main.c
deleted file mode 100644
index d0b2cf02..00000000
--- a/gui/simple-greeter/greeter-main.c
+++ /dev/null
@@ -1,533 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-
-#include "gdm-common.h"
-#include "gdm-log.h"
-#include "gdm-settings-client.h"
-#include "gdm-settings-keys.h"
-
-#include "gdm-greeter.h"
-#include "gdm-simple-greeter.h"
-
-#define SERVER_DBUS_PATH "/org/gnome/DisplayManager/GreeterServer"
-#define SERVER_DBUS_INTERFACE "org.gnome.DisplayManager.GreeterServer"
-
-#define GPM_DBUS_NAME "org.freedesktop.PowerManagement"
-#define GPM_DBUS_PATH "/org/freedesktop/PowerManagement"
-#define GPM_DBUS_INTERFACE "org.freedesktop.PowerManagement"
-
-static DBusGConnection *connection = NULL;
-static GdmGreeter *greeter = NULL;
-static DBusGProxy *server_proxy = NULL;
-static DBusGProxy *gpm_proxy = NULL;
-
-static void
-on_info (DBusGProxy *proxy,
- const char *text,
- gpointer data)
-{
- g_debug ("GREETER INFO: %s", text);
-
- gdm_greeter_info (GDM_GREETER (greeter), text);
-}
-
-static void
-on_problem (DBusGProxy *proxy,
- const char *text,
- gpointer data)
-{
- g_debug ("GREETER PROBLEM: %s", text);
-
- gdm_greeter_problem (GDM_GREETER (greeter), text);
-}
-
-static void
-on_ready (DBusGProxy *proxy,
- gpointer data)
-{
- g_debug ("GREETER SERVER READY");
-
- gdm_greeter_ready (GDM_GREETER (greeter));
-}
-
-static void
-on_reset (DBusGProxy *proxy,
- gpointer data)
-{
- g_debug ("GREETER RESET");
-
- gdm_greeter_reset (GDM_GREETER (greeter));
-}
-
-static void
-on_info_query (DBusGProxy *proxy,
- const char *text,
- gpointer data)
-{
- g_debug ("GREETER Info query: %s", text);
-
- gdm_greeter_info_query (GDM_GREETER (greeter), text);
-}
-
-static void
-on_secret_info_query (DBusGProxy *proxy,
- const char *text,
- gpointer data)
-{
- g_debug ("GREETER Secret info query: %s", text);
-
- gdm_greeter_secret_info_query (GDM_GREETER (greeter), text);
-}
-
-static void
-on_begin_verification (GdmGreeter *greeter,
- const char *username,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER begin verification");
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "BeginVerification",
- &error,
- G_TYPE_STRING, username,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send BeginVerification: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_query_answer (GdmGreeter *greeter,
- const char *text,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER answer");
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "AnswerQuery",
- &error,
- G_TYPE_STRING, text,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send AnswerQuery: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_select_session (GdmGreeter *greeter,
- const char *text,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER session selected: %s", text);
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "SelectSession",
- &error,
- G_TYPE_STRING, text,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send SelectSession: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_select_language (GdmGreeter *greeter,
- const char *text,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER session selected: %s", text);
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "SelectLanguage",
- &error,
- G_TYPE_STRING, text,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send SelectLanguage: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_select_user (GdmGreeter *greeter,
- const char *text,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER user selected: %s", text);
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "SelectUser",
- &error,
- G_TYPE_STRING, text,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send SelectUser: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_select_hostname (GdmGreeter *greeter,
- const char *text,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER hostname selected: %s", text);
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "SelectHostname",
- &error,
- G_TYPE_STRING, text,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send SelectHostname: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_cancelled (GdmGreeter *greeter,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER cancelled");
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "Cancel",
- &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send Cancelled: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-on_disconnected (GdmGreeter *greeter,
- gpointer data)
-{
- gboolean res;
- GError *error;
-
- g_debug ("GREETER disconnected");
-
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "Disconnect",
- &error,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to send Disconnected: %s", error->message);
- g_error_free (error);
- }
-}
-
-static char *
-get_display_id (void)
-{
- gboolean res;
- GError *error;
- char *id;
-
- id = NULL;
- error = NULL;
- res = dbus_g_proxy_call (server_proxy,
- "GetDisplayId",
- &error,
- G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &id,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Unable to GetDisplayId: %s", error->message);
- g_error_free (error);
- }
-
- return id;
-}
-
-static void
-proxy_destroyed (GObject *object,
- gpointer data)
-{
- g_debug ("GREETER Proxy disconnected");
-}
-
-#if 0
-static void
-activate_power_manager (void)
-{
- DBusGConnection *connection;
- GError *error;
- gboolean res;
- guint result;
-
- g_debug ("Activating power management");
-
- error = NULL;
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- gpm_proxy = dbus_g_proxy_new_for_name (connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS);
- error = NULL;
- res = dbus_g_proxy_call (gpm_proxy,
- "StartServiceByName",
- &error,
- G_TYPE_STRING, GPM_DBUS_NAME,
- G_TYPE_UINT, 0,
- G_TYPE_INVALID,
- G_TYPE_UINT, &result,
- G_TYPE_INVALID);
- if (! res) {
- g_warning ("Could not start service: %s", error->message);
- g_error_free (error);
- } else {
- g_debug ("Result %u", result);
- }
-}
-#else
-static void
-activate_power_manager (void)
-{
- GError *error;
- gboolean res;
-
- g_debug ("Activating power management");
-
- error = NULL;
- res = g_spawn_command_line_async ("gnome-power-manager --no-daemon", &error);
- if (! res) {
- g_warning ("Unable to activate power management: %s", error->message);
- g_error_free (error);
- }
-}
-#endif
-
-int
-main (int argc, char *argv[])
-{
- GError *error;
- const char *address;
- char *display_id;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- g_type_init ();
-
- if (! gdm_settings_client_init (GDMCONFDIR "/gdm.schemas", "/")) {
- exit (1);
- }
-
- g_debug ("Greeter for display %s xauthority:%s", g_getenv ("DISPLAY"), g_getenv ("XAUTHORITY"));
-
- /*
- * gdm_common_atspi_launch () needs gdk initialized.
- * We cannot start gtk before the registry is running
- * because the atk-bridge will crash.
- */
- gdk_init (&argc, &argv);
- /*gdm_common_atspi_launch ();*/
- gtk_init (&argc, &argv);
- gnome_vfs_init ();
-
- gdm_log_init ();
-
- /*gdm_common_log_set_debug (gdm_settings_client_get_bool (GDM_KEY_DEBUG));*/
- gdm_log_set_debug (TRUE);
-
- address = g_getenv ("GDM_GREETER_DBUS_ADDRESS");
- if (address == NULL) {
- g_warning ("GDM_GREETER_DBUS_ADDRESS not set");
- exit (1);
- }
-
- g_debug ("GREETER connecting to address: %s", address);
-
- error = NULL;
- connection = dbus_g_connection_open (address, &error);
- if (connection == NULL) {
- if (error != NULL) {
- g_warning ("error opening connection: %s", error->message);
- g_error_free (error);
- } else {
- g_warning ("Unable to open connection");
- }
- exit (1);
- }
-
- g_debug ("GREETER creating proxy for peer: %s", SERVER_DBUS_PATH);
- server_proxy = dbus_g_proxy_new_for_peer (connection,
- SERVER_DBUS_PATH,
- SERVER_DBUS_INTERFACE);
- if (server_proxy == NULL) {
- g_warning ("Unable to create proxy for peer");
- exit (1);
- }
-
- g_signal_connect (server_proxy, "destroy", G_CALLBACK (proxy_destroyed), NULL);
-
- /* FIXME: not sure why introspection isn't working */
- dbus_g_proxy_add_signal (server_proxy, "InfoQuery", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (server_proxy, "SecretInfoQuery", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (server_proxy, "Info", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (server_proxy, "Problem", G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (server_proxy, "Ready", G_TYPE_INVALID);
- dbus_g_proxy_add_signal (server_proxy, "Reset", G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (server_proxy,
- "InfoQuery",
- G_CALLBACK (on_info_query),
- NULL,
- NULL);
- dbus_g_proxy_connect_signal (server_proxy,
- "SecretInfoQuery",
- G_CALLBACK (on_secret_info_query),
- NULL,
- NULL);
- dbus_g_proxy_connect_signal (server_proxy,
- "Info",
- G_CALLBACK (on_info),
- NULL,
- NULL);
- dbus_g_proxy_connect_signal (server_proxy,
- "Problem",
- G_CALLBACK (on_problem),
- NULL,
- NULL);
- dbus_g_proxy_connect_signal (server_proxy,
- "Ready",
- G_CALLBACK (on_ready),
- NULL,
- NULL);
- dbus_g_proxy_connect_signal (server_proxy,
- "Reset",
- G_CALLBACK (on_reset),
- NULL,
- NULL);
-
- display_id = get_display_id ();
- greeter = gdm_simple_greeter_new (display_id);
- g_free (display_id);
-
- g_signal_connect (greeter,
- "begin-verification",
- G_CALLBACK (on_begin_verification),
- NULL);
- g_signal_connect (greeter,
- "query-answer",
- G_CALLBACK (on_query_answer),
- NULL);
- g_signal_connect (greeter,
- "session-selected",
- G_CALLBACK (on_select_session),
- NULL);
- g_signal_connect (greeter,
- "language-selected",
- G_CALLBACK (on_select_language),
- NULL);
- g_signal_connect (greeter,
- "user-selected",
- G_CALLBACK (on_select_user),
- NULL);
- g_signal_connect (greeter,
- "hostname-selected",
- G_CALLBACK (on_select_hostname),
- NULL);
- g_signal_connect (greeter,
- "cancelled",
- G_CALLBACK (on_cancelled),
- NULL);
- g_signal_connect (greeter,
- "disconnected",
- G_CALLBACK (on_disconnected),
- NULL);
-
- activate_power_manager ();
-
- gtk_main ();
-
- if (greeter != NULL) {
- g_object_unref (greeter);
- }
-
- return 0;
-}
diff --git a/gui/simple-greeter/libnotificationarea/Makefile.am b/gui/simple-greeter/libnotificationarea/Makefile.am
deleted file mode 100644
index d1c82e34..00000000
--- a/gui/simple-greeter/libnotificationarea/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-NULL =
-
-INCLUDES = \
- -I. \
- -I.. \
- -DBINDIR=\"$(bindir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\" \
- -DLIBEXECDIR=\"$(libexecdir)\" \
- -DLOGDIR=\"$(logdir)\" \
- -DPIXMAPDIR=\"$(pixmapdir)\" \
- -DSBINDIR=\"$(sbindir)\" \
- $(GREETER_CFLAGS) \
- $(NULL)
-
-noinst_LTLIBRARIES = \
- libnotificationarea.la \
- $(NULL)
-
-BUILT_SOURCES = \
- na-marshal.c \
- na-marshal.h \
- $(NULL)
-
-libnotificationarea_la_SOURCES = \
- fixedtip.h \
- fixedtip.c \
- obox.c \
- obox.h \
- na-tray.c \
- na-tray.h \
- na-tray-manager.c \
- na-tray-manager.h \
- na-marshal.c \
- na-marshal.h \
- $(NULL)
-
-libnotificationarea_la_LIBADD = \
- $(GUI_LIBS) \
- $(NULL)
-
-libnotificationarea_la_LDFLAGS = \
- -export-dynamic \
- $(NULL)
-
-EXTRA_DIST = \
- na-marshal.list \
- $(NULL)
-
-na-marshal.h: na-marshal.list $(GLIB_GENMARSHAL)
- $(GLIB_GENMARSHAL) $< --header --prefix=_na_marshal > $@
-
-na-marshal.c: na-marshal.list $(GLIB_GENMARSHAL)
- echo "#include \"na-marshal.h\"" > $@ && \
- $(GLIB_GENMARSHAL) $< --body --prefix=_na_marshal >> $@
-
-noinst_PROGRAMS = testtray
-
-testtray_SOURCES = \
- testtray.c \
- $(NULL)
-
-testtray_LDADD = \
- libnotificationarea.la \
- $(GREETER_LIBS) \
- $(NULL)
diff --git a/gui/simple-greeter/libnotificationarea/fixedtip.c b/gui/simple-greeter/libnotificationarea/fixedtip.c
deleted file mode 100644
index 83bb77ed..00000000
--- a/gui/simple-greeter/libnotificationarea/fixedtip.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Metacity fixed tooltip routine */
-
-/*
- * Copyright (C) 2001 Havoc Pennington
- * Copyright (C) 2003-2006 Vincent Untz
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "fixedtip.h"
-
-/* Signals */
-enum
-{
- CLICKED,
- LAST_SIGNAL
-};
-
-static guint fixedtip_signals[LAST_SIGNAL] = { 0 };
-
-struct _NaFixedTipPrivate
-{
- GtkWidget *parent;
- GtkWidget *label;
- GtkOrientation orientation;
-};
-
-G_DEFINE_TYPE (NaFixedTip, na_fixed_tip, GTK_TYPE_WINDOW)
-
-static gboolean
-button_press_handler (GtkWidget *fixedtip,
- GdkEventButton *event,
- gpointer data)
-{
- if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
- g_signal_emit (fixedtip, fixedtip_signals[CLICKED], 0);
-
- return FALSE;
-}
-
-static gboolean
-expose_handler (GtkWidget *fixedtip)
-{
- GtkRequisition req;
-
- gtk_widget_size_request (fixedtip, &req);
-
- gtk_paint_flat_box (fixedtip->style, fixedtip->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, fixedtip, "tooltip",
- 0, 0, req.width, req.height);
-
- return FALSE;
-}
-
-static void
-na_fixed_tip_class_init (NaFixedTipClass *class)
-{
- fixedtip_signals[CLICKED] =
- g_signal_new ("clicked",
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaFixedTipClass, clicked),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_type_class_add_private (class, sizeof (NaFixedTipPrivate));
-}
-
-/* Did you already see this code? Yes, it's gtk_tooltips_force_window() ;-) */
-static void
-na_fixed_tip_init (NaFixedTip *fixedtip)
-{
- GtkWidget *label;
-
- fixedtip->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixedtip, NA_TYPE_FIXED_TIP,
- NaFixedTipPrivate);
-
- gtk_window_set_type_hint (GTK_WINDOW (fixedtip),
- GDK_WINDOW_TYPE_HINT_TOOLTIP);
-
- gtk_widget_set_app_paintable (GTK_WIDGET (fixedtip), TRUE);
- gtk_window_set_resizable (GTK_WINDOW (fixedtip), FALSE);
- gtk_widget_set_name (GTK_WIDGET (fixedtip), "gtk-tooltips");
- gtk_container_set_border_width (GTK_CONTAINER (fixedtip), 4);
-
- label = gtk_label_new (NULL);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (fixedtip), label);
- fixedtip->priv->label = label;
-
- g_signal_connect (fixedtip, "expose_event",
- G_CALLBACK (expose_handler), NULL);
-
- gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
-
- g_signal_connect (fixedtip, "button_press_event",
- G_CALLBACK (button_press_handler), NULL);
-
- fixedtip->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
-}
-
-static void
-na_fixed_tip_position (NaFixedTip *fixedtip)
-{
- GdkScreen *screen;
- GtkRequisition req;
- int root_x;
- int root_y;
- int parent_width;
- int parent_height;
- int screen_width;
- int screen_height;
-
- screen = gtk_widget_get_screen (fixedtip->priv->parent);
- gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
-
- gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
-
- gdk_window_get_origin (fixedtip->priv->parent->window, &root_x, &root_y);
- gdk_drawable_get_size (GDK_DRAWABLE (fixedtip->priv->parent->window),
- &parent_width, &parent_height);
-
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
-
- /* pad between panel and message window */
-#define PAD 5
-
- if (fixedtip->priv->orientation == GTK_ORIENTATION_VERTICAL)
- {
- if (root_x <= screen_width / 2)
- root_x += parent_width + PAD;
- else
- root_x -= req.width + PAD;
- }
- else
- {
- if (root_y <= screen_height / 2)
- root_y += parent_height + PAD;
- else
- root_y -= req.height + PAD;
- }
-
- /* Push onscreen */
- if ((root_x + req.width) > screen_width)
- root_x = screen_width - req.width;
-
- if ((root_y + req.height) > screen_height)
- root_y = screen_height - req.height;
-
- gtk_window_move (GTK_WINDOW (fixedtip), root_x, root_y);
-}
-
-static void
-na_fixed_tip_parent_size_allocated (GtkWidget *parent,
- GtkAllocation *allocation,
- NaFixedTip *fixedtip)
-{
- na_fixed_tip_position (fixedtip);
-}
-
-static void
-na_fixed_tip_parent_screen_changed (GtkWidget *parent,
- GdkScreen *new_screen,
- NaFixedTip *fixedtip)
-{
- na_fixed_tip_position (fixedtip);
-}
-
-GtkWidget *
-na_fixed_tip_new (GtkWidget *parent,
- GtkOrientation orientation)
-{
- NaFixedTip *fixedtip;
-
- g_return_val_if_fail (parent != NULL, NULL);
-
- fixedtip = g_object_new (NA_TYPE_FIXED_TIP, NULL);
-
- /* It doesn't work if we do this in na_fixed_tip_init(), so do it here */
- GTK_WINDOW (fixedtip)->type = GTK_WINDOW_POPUP;
-
- fixedtip->priv->parent = parent;
-
-#if 0
- //FIXME: would be nice to be able to get the toplevel for the tip, but this
- //doesn't work
- GtkWidget *toplevel;
-
- toplevel = gtk_widget_get_toplevel (parent);
- /*
- if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel) && GTK_IS_WINDOW (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (fixedtip), GTK_WINDOW (toplevel));
- */
-#endif
-
- fixedtip->priv->orientation = orientation;
-
- //FIXME: would be nice to move the tip when the notification area moves
- g_signal_connect_object (parent, "size-allocate",
- G_CALLBACK (na_fixed_tip_parent_size_allocated),
- fixedtip, 0);
- g_signal_connect_object (parent, "screen-changed",
- G_CALLBACK (na_fixed_tip_parent_screen_changed),
- fixedtip, 0);
-
- na_fixed_tip_position (fixedtip);
-
- return GTK_WIDGET (fixedtip);
-}
-
-void
-na_fixed_tip_set_markup (GtkWidget *widget,
- const char *markup_text)
-{
- NaFixedTip *fixedtip;
-
- g_return_if_fail (NA_IS_FIXED_TIP (widget));
-
- fixedtip = NA_FIXED_TIP (widget);
-
- gtk_label_set_markup (GTK_LABEL (fixedtip->priv->label),
- markup_text);
-
- na_fixed_tip_position (fixedtip);
-}
-
-void
-na_fixed_tip_set_orientation (GtkWidget *widget,
- GtkOrientation orientation)
-{
- NaFixedTip *fixedtip;
-
- g_return_if_fail (NA_IS_FIXED_TIP (widget));
-
- fixedtip = NA_FIXED_TIP (widget);
-
- if (orientation == fixedtip->priv->orientation)
- return;
-
- fixedtip->priv->orientation = orientation;
-
- na_fixed_tip_position (fixedtip);
-}
diff --git a/gui/simple-greeter/libnotificationarea/fixedtip.h b/gui/simple-greeter/libnotificationarea/fixedtip.h
deleted file mode 100644
index a29e85c9..00000000
--- a/gui/simple-greeter/libnotificationarea/fixedtip.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Fixed tooltip routine */
-
-/*
- * Copyright (C) 2001 Havoc Pennington, 2002 Red Hat Inc.
- * Copyright (C) 2003-2006 Vincent Untz
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef FIXED_TIP_H
-#define FIXED_TIP_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define NA_TYPE_FIXED_TIP (na_fixed_tip_get_type ())
-#define NA_FIXED_TIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_FIXED_TIP, NaFixedTip))
-#define NA_FIXED_TIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_FIXED_TIP, NaFixedTipClass))
-#define NA_IS_FIXED_TIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_FIXED_TIP))
-#define NA_IS_FIXED_TIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_FIXED_TIP))
-#define NA_FIXED_TIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_FIXED_TIP, NaFixedTipClass))
-
-typedef struct _NaFixedTip NaFixedTip;
-typedef struct _NaFixedTipPrivate NaFixedTipPrivate;
-typedef struct _NaFixedTipClass NaFixedTipClass;
-
-struct _NaFixedTip
-{
- GtkWindow parent_instance;
-
- NaFixedTipPrivate *priv;
-};
-
-struct _NaFixedTipClass
-{
- GtkWindowClass parent_class;
-
- void (* clicked) (NaFixedTip *fixedtip);
-};
-
-GType na_fixed_tip_get_type (void);
-
-GtkWidget *na_fixed_tip_new (GtkWidget *parent,
- GtkOrientation orientation);
-
-void na_fixed_tip_set_markup (GtkWidget *widget,
- const char *markup_text);
-
-void na_fixed_tip_set_orientation (GtkWidget *widget,
- GtkOrientation orientation);
-
-G_END_DECLS
-
-#endif /* FIXED_TIP_H */
diff --git a/gui/simple-greeter/libnotificationarea/na-marshal.list b/gui/simple-greeter/libnotificationarea/na-marshal.list
deleted file mode 100644
index e3fc3993..00000000
--- a/gui/simple-greeter/libnotificationarea/na-marshal.list
+++ /dev/null
@@ -1,3 +0,0 @@
-VOID:OBJECT,OBJECT
-VOID:OBJECT,STRING,LONG,LONG
-VOID:OBJECT,LONG
diff --git a/gui/simple-greeter/libnotificationarea/na-tray-manager.c b/gui/simple-greeter/libnotificationarea/na-tray-manager.c
deleted file mode 100644
index 59fdca36..00000000
--- a/gui/simple-greeter/libnotificationarea/na-tray-manager.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/* na-tray-manager.c
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- * Copyright (C) 2003-2006 Vincent Untz
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Used to be: eggtraymanager.c
- */
-
-#include <config.h>
-#include <string.h>
-#include <libintl.h>
-
-#include "na-tray-manager.h"
-
-#include <gdkconfig.h>
-#include <glib/gi18n.h>
-#if defined (GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
-#include <X11/Xatom.h>
-#elif defined (GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#endif
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtksocket.h>
-#include <gtk/gtkwindow.h>
-
-#include "na-marshal.h"
-
-/* Signals */
-enum
-{
- TRAY_ICON_ADDED,
- TRAY_ICON_REMOVED,
- MESSAGE_SENT,
- MESSAGE_CANCELLED,
- LOST_SELECTION,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_ORIENTATION
-};
-
-typedef struct
-{
- long id, len;
- long remaining_len;
-
- long timeout;
- char *str;
-#ifdef GDK_WINDOWING_X11
- Window window;
-#endif
-} PendingMessage;
-
-static guint manager_signals[LAST_SIGNAL];
-
-#define SYSTEM_TRAY_REQUEST_DOCK 0
-#define SYSTEM_TRAY_BEGIN_MESSAGE 1
-#define SYSTEM_TRAY_CANCEL_MESSAGE 2
-
-#define SYSTEM_TRAY_ORIENTATION_HORZ 0
-#define SYSTEM_TRAY_ORIENTATION_VERT 1
-
-#ifdef GDK_WINDOWING_X11
-static gboolean na_tray_manager_check_running_screen_x11 (GdkScreen *screen);
-#endif
-
-static void na_tray_manager_finalize (GObject *object);
-static void na_tray_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void na_tray_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void na_tray_manager_unmanage (NaTrayManager *manager);
-
-G_DEFINE_TYPE (NaTrayManager, na_tray_manager, G_TYPE_OBJECT)
-
-static void
-na_tray_manager_init (NaTrayManager *manager)
-{
- manager->invisible = NULL;
- manager->socket_table = g_hash_table_new (NULL, NULL);
-}
-
-static void
-na_tray_manager_class_init (NaTrayManagerClass *klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *)klass;
-
- gobject_class->finalize = na_tray_manager_finalize;
- gobject_class->set_property = na_tray_manager_set_property;
- gobject_class->get_property = na_tray_manager_get_property;
-
- g_object_class_install_property (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation",
- "orientation",
- "orientation",
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
-
- manager_signals[TRAY_ICON_ADDED] =
- g_signal_new ("tray_icon_added",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_SOCKET);
-
- manager_signals[TRAY_ICON_REMOVED] =
- g_signal_new ("tray_icon_removed",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaTrayManagerClass, tray_icon_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_SOCKET);
- manager_signals[MESSAGE_SENT] =
- g_signal_new ("message_sent",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaTrayManagerClass, message_sent),
- NULL, NULL,
- _na_marshal_VOID__OBJECT_STRING_LONG_LONG,
- G_TYPE_NONE, 4,
- GTK_TYPE_SOCKET,
- G_TYPE_STRING,
- G_TYPE_LONG,
- G_TYPE_LONG);
- manager_signals[MESSAGE_CANCELLED] =
- g_signal_new ("message_cancelled",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaTrayManagerClass, message_cancelled),
- NULL, NULL,
- _na_marshal_VOID__OBJECT_LONG,
- G_TYPE_NONE, 2,
- GTK_TYPE_SOCKET,
- G_TYPE_LONG);
- manager_signals[LOST_SELECTION] =
- g_signal_new ("lost_selection",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NaTrayManagerClass, lost_selection),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-#if defined (GDK_WINDOWING_X11)
- /* Nothing */
-#elif defined (GDK_WINDOWING_WIN32)
- g_warning ("Port NaTrayManager to Win32");
-#else
- g_warning ("Port NaTrayManager to this GTK+ backend");
-#endif
-}
-
-static void
-na_tray_manager_finalize (GObject *object)
-{
- NaTrayManager *manager;
-
- manager = NA_TRAY_MANAGER (object);
-
- na_tray_manager_unmanage (manager);
-
- g_list_free (manager->messages);
- g_hash_table_destroy (manager->socket_table);
-
- G_OBJECT_CLASS (na_tray_manager_parent_class)->finalize (object);
-}
-
-static void
-na_tray_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- NaTrayManager *manager = NA_TRAY_MANAGER (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- na_tray_manager_set_orientation (manager, g_value_get_enum (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-na_tray_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- NaTrayManager *manager = NA_TRAY_MANAGER (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, manager->orientation);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-NaTrayManager *
-na_tray_manager_new (void)
-{
- NaTrayManager *manager;
-
- manager = g_object_new (NA_TYPE_TRAY_MANAGER, NULL);
-
- return manager;
-}
-
-#ifdef GDK_WINDOWING_X11
-
-static gboolean
-na_tray_manager_plug_removed (GtkSocket *socket,
- NaTrayManager *manager)
-{
- Window *window;
-
- window = g_object_get_data (G_OBJECT (socket), "na-tray-child-window");
-
- g_hash_table_remove (manager->socket_table, GINT_TO_POINTER (*window));
- g_object_set_data (G_OBJECT (socket), "na-tray-child-window",
- NULL);
-
- g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, socket);
-
- /* This destroys the socket. */
- return FALSE;
-}
-
-static void
-na_tray_manager_make_socket_transparent (GtkWidget *widget,
- gpointer user_data)
-{
- if (GTK_WIDGET_NO_WINDOW (widget))
- return;
-
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
-}
-
-static gboolean
-na_tray_manager_socket_exposed (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer user_data)
-{
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- return FALSE;
-}
-
-static void
-na_tray_manager_socket_style_set (GtkWidget *widget,
- GtkStyle *previous_style,
- gpointer user_data)
-{
- if (widget->window == NULL)
- return;
-
- na_tray_manager_make_socket_transparent (widget, user_data);
-}
-
-static void
-na_tray_manager_handle_dock_request (NaTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GtkWidget *socket;
- Window *window;
- GtkRequisition req;
-
- if (g_hash_table_lookup (manager->socket_table, GINT_TO_POINTER (xevent->data.l[2])))
- {
- /* We already got this notification earlier, ignore this one */
- return;
- }
-
- socket = gtk_socket_new ();
-
- gtk_widget_set_app_paintable (socket, TRUE);
- //FIXME: need to find a theme where this (and expose event) is needed
- gtk_widget_set_double_buffered (socket, FALSE);
- g_signal_connect (socket, "realize",
- G_CALLBACK (na_tray_manager_make_socket_transparent), NULL);
- g_signal_connect (socket, "expose_event",
- G_CALLBACK (na_tray_manager_socket_exposed), NULL);
- g_signal_connect_after (socket, "style_set",
- G_CALLBACK (na_tray_manager_socket_style_set), NULL);
-
- /* We need to set the child window here
- * so that the client can call _get functions
- * in the signal handler
- */
- window = g_new (Window, 1);
- *window = xevent->data.l[2];
-
- g_object_set_data_full (G_OBJECT (socket),
- "na-tray-child-window",
- window, g_free);
- g_signal_emit (manager, manager_signals[TRAY_ICON_ADDED], 0,
- socket);
-
- /* Add the socket only if it's been attached */
- if (GTK_IS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (socket))))
- {
- g_signal_connect (socket, "plug_removed",
- G_CALLBACK (na_tray_manager_plug_removed), manager);
-
- gtk_socket_add_id (GTK_SOCKET (socket), *window);
-
- g_hash_table_insert (manager->socket_table, GINT_TO_POINTER (*window), socket);
-
- /*
- * Make sure the icons have a meaningfull size ...
- */
- req.width = req.height = 1;
- gtk_widget_size_request (socket, &req);
- /*
- if ((req.width < 16) || (req.height < 16))
- {
- gint nw = MAX (24, req.width);
- gint nh = MAX (24, req.height);
- g_warning (_("tray icon has requested a size of (%i x %i), resizing to (%i x %i)"),
- req.width, req.height, nw, nh);
- gtk_widget_set_size_request(icon, nw, nh);
- }
- */
- gtk_widget_show(socket);
- }
- else
- gtk_widget_destroy (socket);
-}
-
-static void
-pending_message_free (PendingMessage *message)
-{
- g_free (message->str);
- g_free (message);
-}
-
-static GdkFilterReturn
-na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-{
- XClientMessageEvent *xevent;
- NaTrayManager *manager;
- GList *p;
- int len;
-
- xevent = (XClientMessageEvent *) xev;
- manager = data;
-
- /* Try to see if we can find the pending message in the list */
- for (p = manager->messages; p; p = p->next)
- {
- PendingMessage *msg = p->data;
-
- if (xevent->window == msg->window)
- {
- /* Append the message */
- len = MIN (msg->remaining_len, 20);
-
- memcpy ((msg->str + msg->len - msg->remaining_len),
- &xevent->data, len);
- msg->remaining_len -= len;
-
- if (msg->remaining_len == 0)
- {
- GtkSocket *socket;
-
- socket = g_hash_table_lookup (manager->socket_table,
- GINT_TO_POINTER (msg->window));
-
- if (socket)
- g_signal_emit (manager, manager_signals[MESSAGE_SENT], 0,
- socket, msg->str, msg->id, msg->timeout);
-
- pending_message_free (msg);
- manager->messages = g_list_remove_link (manager->messages, p);
- g_list_free_1 (p);
- }
-
- break;
- }
- }
-
- return GDK_FILTER_REMOVE;
-}
-
-static void
-na_tray_manager_handle_begin_message (NaTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GtkSocket *socket;
- GList *p;
- PendingMessage *msg;
- long timeout;
- long len;
- long id;
-
- socket = g_hash_table_lookup (manager->socket_table,
- GINT_TO_POINTER (xevent->window));
- /* we don't know about this tray icon, so ignore the message */
- if (!socket)
- return;
-
- /* Check if the same message is already in the queue and remove it if so */
- for (p = manager->messages; p; p = p->next)
- {
- PendingMessage *msg = p->data;
-
- if (xevent->window == msg->window &&
- xevent->data.l[4] == msg->id)
- {
- /* Hmm, we found it, now remove it */
- pending_message_free (msg);
- manager->messages = g_list_remove_link (manager->messages, p);
- g_list_free_1 (p);
- break;
- }
- }
-
- timeout = xevent->data.l[2];
- len = xevent->data.l[3];
- id = xevent->data.l[4];
-
- if (len == 0)
- {
- g_signal_emit (manager, manager_signals[MESSAGE_SENT], 0,
- socket, "", id, timeout);
- }
- else
- {
- /* Now add the new message to the queue */
- msg = g_new0 (PendingMessage, 1);
- msg->window = xevent->window;
- msg->timeout = timeout;
- msg->len = len;
- msg->id = id;
- msg->remaining_len = msg->len;
- msg->str = g_malloc (msg->len + 1);
- msg->str[msg->len] = '\0';
- manager->messages = g_list_prepend (manager->messages, msg);
- }
-}
-
-static void
-na_tray_manager_handle_cancel_message (NaTrayManager *manager,
- XClientMessageEvent *xevent)
-{
- GList *p;
- GtkSocket *socket;
-
- /* Check if the message is in the queue and remove it if so */
- for (p = manager->messages; p; p = p->next)
- {
- PendingMessage *msg = p->data;
-
- if (xevent->window == msg->window &&
- xevent->data.l[4] == msg->id)
- {
- pending_message_free (msg);
- manager->messages = g_list_remove_link (manager->messages, p);
- g_list_free_1 (p);
- break;
- }
- }
-
- socket = g_hash_table_lookup (manager->socket_table,
- GINT_TO_POINTER (xevent->window));
-
- if (socket)
- {
- g_signal_emit (manager, manager_signals[MESSAGE_CANCELLED], 0,
- socket, xevent->data.l[2]);
- }
-}
-
-static GdkFilterReturn
-na_tray_manager_handle_client_message_opcode (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-{
- XClientMessageEvent *xevent;
- NaTrayManager *manager;
-
- xevent = (XClientMessageEvent *) xev;
- manager = data;
-
- switch (xevent->data.l[1])
- {
- case SYSTEM_TRAY_REQUEST_DOCK:
- /* Ignore this one since we don't know on which window this was received
- * and so we can't know for which screen this is. It will be handled
- * in na_tray_manager_window_filter() since we also receive it there */
- break;
-
- case SYSTEM_TRAY_BEGIN_MESSAGE:
- na_tray_manager_handle_begin_message (manager, xevent);
- return GDK_FILTER_REMOVE;
-
- case SYSTEM_TRAY_CANCEL_MESSAGE:
- na_tray_manager_handle_cancel_message (manager, xevent);
- return GDK_FILTER_REMOVE;
- default:
- break;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static GdkFilterReturn
-na_tray_manager_window_filter (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-{
- XEvent *xevent = (GdkXEvent *)xev;
- NaTrayManager *manager = data;
-
- if (xevent->type == ClientMessage)
- {
- /* We handle this client message here. See comment in
- * na_tray_manager_handle_client_message_opcode() for details */
- if (xevent->xclient.message_type == manager->opcode_atom &&
- xevent->xclient.data.l[1] == SYSTEM_TRAY_REQUEST_DOCK)
- {
- na_tray_manager_handle_dock_request (manager,
- (XClientMessageEvent *) xevent);
- return GDK_FILTER_REMOVE;
- }
- }
- else if (xevent->type == SelectionClear)
- {
- g_signal_emit (manager, manager_signals[LOST_SELECTION], 0);
- na_tray_manager_unmanage (manager);
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-#if 0
-//FIXME investigate why this doesn't work
-static gboolean
-na_tray_manager_selection_clear_event (GtkWidget *widget,
- GdkEventSelection *event,
- NaTrayManager *manager)
-{
- g_signal_emit (manager, manager_signals[LOST_SELECTION], 0);
- na_tray_manager_unmanage (manager);
-
- return FALSE;
-}
-#endif
-#endif
-
-static void
-na_tray_manager_unmanage (NaTrayManager *manager)
-{
-#ifdef GDK_WINDOWING_X11
- GdkDisplay *display;
- guint32 timestamp;
- GtkWidget *invisible;
-
- if (manager->invisible == NULL)
- return;
-
- invisible = manager->invisible;
- g_assert (GTK_IS_INVISIBLE (invisible));
- g_assert (GTK_WIDGET_REALIZED (invisible));
- g_assert (GDK_IS_WINDOW (invisible->window));
-
- display = gtk_widget_get_display (invisible);
-
- if (gdk_selection_owner_get_for_display (display, manager->selection_atom) ==
- invisible->window)
- {
- timestamp = gdk_x11_get_server_time (invisible->window);
- gdk_selection_owner_set_for_display (display,
- NULL,
- manager->selection_atom,
- timestamp,
- TRUE);
- }
-
- //FIXME: we should also use gdk_remove_client_message_filter when it's
- //available
- // See bug #351254
- gdk_window_remove_filter (invisible->window,
- na_tray_manager_window_filter, manager);
-
- manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
- gtk_widget_destroy (invisible);
- g_object_unref (G_OBJECT (invisible));
-#endif
-}
-
-static void
-na_tray_manager_set_orientation_property (NaTrayManager *manager)
-{
-#ifdef GDK_WINDOWING_X11
- GdkDisplay *display;
- Atom orientation_atom;
- gulong data[1];
-
- if (!manager->invisible || !manager->invisible->window)
- return;
-
- display = gtk_widget_get_display (manager->invisible);
- orientation_atom = gdk_x11_get_xatom_by_name_for_display (display,
- "_NET_SYSTEM_TRAY_ORIENTATION");
-
- data[0] = manager->orientation == GTK_ORIENTATION_HORIZONTAL ?
- SYSTEM_TRAY_ORIENTATION_HORZ :
- SYSTEM_TRAY_ORIENTATION_VERT;
-
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
- orientation_atom,
- XA_CARDINAL, 32,
- PropModeReplace,
- (guchar *) &data, 1);
-#endif
-}
-
-#ifdef GDK_WINDOWING_X11
-
-static gboolean
-na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
- GdkScreen *screen)
-{
- GdkDisplay *display;
- Screen *xscreen;
- GtkWidget *invisible;
- char *selection_atom_name;
- guint32 timestamp;
-
- g_return_val_if_fail (NA_IS_TRAY_MANAGER (manager), FALSE);
- g_return_val_if_fail (manager->screen == NULL, FALSE);
-
- /* If there's already a manager running on the screen
- * we can't create another one.
- */
-#if 0
- if (na_tray_manager_check_running_screen_x11 (screen))
- return FALSE;
-#endif
- display = gdk_screen_get_display (screen);
- xscreen = GDK_SCREEN_XSCREEN (screen);
-
- invisible = gtk_invisible_new_for_screen (screen);
- gtk_widget_realize (invisible);
-
- gtk_widget_add_events (invisible,
- GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK);
-
- selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- gdk_screen_get_number (screen));
- manager->selection_atom = gdk_atom_intern (selection_atom_name, FALSE);
- g_free (selection_atom_name);
-
- na_tray_manager_set_orientation_property (manager);
-
- timestamp = gdk_x11_get_server_time (invisible->window);
-
- /* Check if we could set the selection owner successfully */
- if (gdk_selection_owner_set_for_display (display,
- invisible->window,
- manager->selection_atom,
- timestamp,
- TRUE))
- {
- XClientMessageEvent xev;
- GdkAtom opcode_atom;
- GdkAtom message_data_atom;
-
- xev.type = ClientMessage;
- xev.window = RootWindowOfScreen (xscreen);
- xev.message_type = gdk_x11_get_xatom_by_name_for_display (display,
- "MANAGER");
-
- xev.format = 32;
- xev.data.l[0] = timestamp;
- xev.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
- manager->selection_atom);
- xev.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
- xev.data.l[3] = 0; /* manager specific data */
- xev.data.l[4] = 0; /* manager specific data */
-
- XSendEvent (GDK_DISPLAY_XDISPLAY (display),
- RootWindowOfScreen (xscreen),
- False, StructureNotifyMask, (XEvent *)&xev);
-
- manager->invisible = invisible;
- g_object_ref (G_OBJECT (manager->invisible));
-
- opcode_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_OPCODE", FALSE);
- manager->opcode_atom = gdk_x11_atom_to_xatom_for_display (display,
- opcode_atom);
-
- message_data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA",
- FALSE);
-
- /* Add a window filter */
-#if 0
- /* This is for when we lose the selection of _NET_SYSTEM_TRAY_Sx */
- g_signal_connect (invisible, "selection-clear-event",
- G_CALLBACK (na_tray_manager_selection_clear_event),
- manager);
-#endif
- /* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
- gdk_window_add_filter (invisible->window,
- na_tray_manager_window_filter, manager);
- /* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
- gdk_display_add_client_message_filter (display, opcode_atom,
- na_tray_manager_handle_client_message_opcode,
- manager);
- /* This is for _NET_SYSTEM_TRAY_MESSAGE_DATA */
- gdk_display_add_client_message_filter (display, message_data_atom,
- na_tray_manager_handle_client_message_message_data,
- manager);
- return TRUE;
- }
- else
- {
- gtk_widget_destroy (invisible);
-
- return FALSE;
- }
-}
-
-#endif
-
-gboolean
-na_tray_manager_manage_screen (NaTrayManager *manager,
- GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- g_return_val_if_fail (manager->screen == NULL, FALSE);
-
-#ifdef GDK_WINDOWING_X11
- return na_tray_manager_manage_screen_x11 (manager, screen);
-#else
- return FALSE;
-#endif
-}
-
-#ifdef GDK_WINDOWING_X11
-
-static gboolean
-na_tray_manager_check_running_screen_x11 (GdkScreen *screen)
-{
- GdkDisplay *display;
- Atom selection_atom;
- char *selection_atom_name;
-
- display = gdk_screen_get_display (screen);
- selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- gdk_screen_get_number (screen));
- selection_atom = gdk_x11_get_xatom_by_name_for_display (display,
- selection_atom_name);
- g_free (selection_atom_name);
-
- if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
- selection_atom) != None)
- return TRUE;
- else
- return FALSE;
-}
-
-#endif
-
-gboolean
-na_tray_manager_check_running (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
-#ifdef GDK_WINDOWING_X11
- return na_tray_manager_check_running_screen_x11 (screen);
-#else
- return FALSE;
-#endif
-}
-
-char *
-na_tray_manager_get_child_title (NaTrayManager *manager,
- NaTrayManagerChild *child)
-{
- char *retval = NULL;
-#ifdef GDK_WINDOWING_X11
- GdkDisplay *display;
- Window *child_window;
- Atom utf8_string, atom, type;
- int result;
- int format;
- gulong nitems;
- gulong bytes_after;
- gchar *val;
-
- g_return_val_if_fail (NA_IS_TRAY_MANAGER (manager), NULL);
- g_return_val_if_fail (GTK_IS_SOCKET (child), NULL);
-
- display = gdk_screen_get_display (manager->screen);
-
- child_window = g_object_get_data (G_OBJECT (child),
- "na-tray-child-window");
-
- utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
- atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
-
- gdk_error_trap_push ();
-
- result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
- *child_window,
- atom,
- 0, G_MAXLONG,
- False, utf8_string,
- &type, &format, &nitems,
- &bytes_after, (guchar **)&val);
-
- if (gdk_error_trap_pop () || result != Success)
- return NULL;
-
- if (type != utf8_string ||
- format != 8 ||
- nitems == 0)
- {
- if (val)
- XFree (val);
- return NULL;
- }
-
- if (!g_utf8_validate (val, nitems, NULL))
- {
- XFree (val);
- return NULL;
- }
-
- retval = g_strndup (val, nitems);
-
- XFree (val);
-#endif
- return retval;
-}
-
-void
-na_tray_manager_set_orientation (NaTrayManager *manager,
- GtkOrientation orientation)
-{
- g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
-
- if (manager->orientation != orientation)
- {
- manager->orientation = orientation;
-
- na_tray_manager_set_orientation_property (manager);
-
- g_object_notify (G_OBJECT (manager), "orientation");
- }
-}
-
-GtkOrientation
-na_tray_manager_get_orientation (NaTrayManager *manager)
-{
- g_return_val_if_fail (NA_IS_TRAY_MANAGER (manager), GTK_ORIENTATION_HORIZONTAL);
-
- return manager->orientation;
-}
diff --git a/gui/simple-greeter/libnotificationarea/na-tray-manager.h b/gui/simple-greeter/libnotificationarea/na-tray-manager.h
deleted file mode 100644
index 4d4e7880..00000000
--- a/gui/simple-greeter/libnotificationarea/na-tray-manager.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* na-tray-manager.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- * Copyright (C) 2003-2006 Vincent Untz
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Used to be: eggtraymanager.h
- */
-
-#ifndef __NA_TRAY_MANAGER_H__
-#define __NA_TRAY_MANAGER_H__
-
-#include <gtk/gtkwidget.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
-
-G_BEGIN_DECLS
-
-#define NA_TYPE_TRAY_MANAGER (na_tray_manager_get_type ())
-#define NA_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_TRAY_MANAGER, NaTrayManager))
-#define NA_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_TRAY_MANAGER, NaTrayManagerClass))
-#define NA_IS_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_TRAY_MANAGER))
-#define NA_IS_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_TRAY_MANAGER))
-#define NA_TRAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_TRAY_MANAGER, NaTrayManagerClass))
-
-typedef struct _NaTrayManager NaTrayManager;
-typedef struct _NaTrayManagerClass NaTrayManagerClass;
-typedef struct _NaTrayManagerChild NaTrayManagerChild;
-
-struct _NaTrayManager
-{
- GObject parent_instance;
-
-#ifdef GDK_WINDOWING_X11
- GdkAtom selection_atom;
- Atom opcode_atom;
-#endif
-
- GtkWidget *invisible;
- GdkScreen *screen;
- GtkOrientation orientation;
-
- GList *messages;
- GHashTable *socket_table;
-};
-
-struct _NaTrayManagerClass
-{
- GObjectClass parent_class;
-
- void (* tray_icon_added) (NaTrayManager *manager,
- NaTrayManagerChild *child);
- void (* tray_icon_removed) (NaTrayManager *manager,
- NaTrayManagerChild *child);
-
- void (* message_sent) (NaTrayManager *manager,
- NaTrayManagerChild *child,
- const gchar *message,
- glong id,
- glong timeout);
-
- void (* message_cancelled) (NaTrayManager *manager,
- NaTrayManagerChild *child,
- glong id);
-
- void (* lost_selection) (NaTrayManager *manager);
-};
-
-GType na_tray_manager_get_type (void);
-
-gboolean na_tray_manager_check_running (GdkScreen *screen);
-NaTrayManager *na_tray_manager_new (void);
-gboolean na_tray_manager_manage_screen (NaTrayManager *manager,
- GdkScreen *screen);
-char *na_tray_manager_get_child_title (NaTrayManager *manager,
- NaTrayManagerChild *child);
-void na_tray_manager_set_orientation (NaTrayManager *manager,
- GtkOrientation orientation);
-GtkOrientation na_tray_manager_get_orientation (NaTrayManager *manager);
-
-G_END_DECLS
-
-#endif /* __NA_TRAY_MANAGER_H__ */
diff --git a/gui/simple-greeter/libnotificationarea/na-tray.c b/gui/simple-greeter/libnotificationarea/na-tray.c
deleted file mode 100644
index 9bfc19f2..00000000
--- a/gui/simple-greeter/libnotificationarea/na-tray.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Copyright (C) 2002 Red Hat, Inc.
- * Copyright (C) 2003-2006 Vincent Untz
- * Copyright (C) 2007 Christian Persch
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-
-#include <gtk/gtk.h>
-
-#include "na-tray-manager.h"
-#include "fixedtip.h"
-#include "obox.h"
-
-#include "na-tray.h"
-
-#define ICON_SPACING 1
-#define MIN_BOX_SIZE 3
-
-typedef struct
-{
- NaTrayManager *tray_manager;
- GSList *all_trays;
- GHashTable *icon_table;
- GHashTable *tip_table;
-} TraysScreen;
-
-struct _NaTrayPrivate
-{
- GdkScreen *screen;
- TraysScreen *trays_screen;
-
- GtkWidget *box;
- GtkWidget *frame;
-
- guint idle_redraw_id;
-
- GtkOrientation orientation;
-};
-
-typedef struct
-{
- char *text;
- glong id;
- glong timeout;
-} IconTipBuffer;
-
-typedef struct
-{
- NaTray *tray; /* tray containing the tray icon */
- GtkWidget *icon; /* tray icon sending the message */
- GtkWidget *fixedtip;
- guint source_id;
- glong id; /* id of the current message */
- GSList *buffer; /* buffered messages */
-} IconTip;
-
-enum
-{
- PROP_0,
- PROP_ORIENTATION,
- PROP_SCREEN
-};
-
-static gboolean initialized = FALSE;
-static TraysScreen *trays_screens = NULL;
-
-static void icon_tip_show_next (IconTip *icontip);
-
-G_DEFINE_TYPE (NaTray, na_tray, GTK_TYPE_BIN);
-
-static NaTray *
-get_tray (TraysScreen *trays_screen)
-{
- if (trays_screen->all_trays == NULL)
- return NULL;
-
- return trays_screen->all_trays->data;
-}
-
-static void
-tray_added (NaTrayManager *manager,
- GtkWidget *icon,
- TraysScreen *trays_screen)
-{
- NaTray *tray;
- NaTrayPrivate *priv;
-
- tray = get_tray (trays_screen);
- if (tray == NULL)
- return;
-
- priv = tray->priv;
-
- g_assert (priv->trays_screen == trays_screen);
-
- g_hash_table_insert (trays_screen->icon_table, icon, tray);
-
- gtk_box_pack_end (GTK_BOX (priv->box), icon, FALSE, FALSE, 0);
-
- gtk_widget_show (icon);
- na_tray_force_redraw (tray);
-}
-
-static void
-tray_removed (NaTrayManager *manager,
- GtkWidget *icon,
- TraysScreen *trays_screen)
-{
- NaTray *tray;
-
- tray = g_hash_table_lookup (trays_screen->icon_table, icon);
- if (tray == NULL)
- return;
-
- g_assert (tray->priv->trays_screen == trays_screen);
-
- na_tray_force_redraw (tray);
-
- g_hash_table_remove (trays_screen->icon_table, icon);
- /* this will also destroy the tip associated to this icon */
- g_hash_table_remove (trays_screen->tip_table, icon);
-}
-
-static void
-icon_tip_buffer_free (gpointer data,
- gpointer userdata)
-{
- IconTipBuffer *buffer;
-
- buffer = data;
-
- g_free (buffer->text);
- buffer->text = NULL;
-
- g_free (buffer);
-}
-
-static void
-icon_tip_free (gpointer data)
-{
- IconTip *icontip;
-
- if (data == NULL)
- return;
-
- icontip = data;
-
- if (icontip->fixedtip != NULL)
- gtk_widget_destroy (GTK_WIDGET (icontip->fixedtip));
- icontip->fixedtip = NULL;
-
- if (icontip->source_id != 0)
- g_source_remove (icontip->source_id);
- icontip->source_id = 0;
-
- if (icontip->buffer != NULL)
- {
- g_slist_foreach (icontip->buffer, icon_tip_buffer_free, NULL);
- g_slist_free (icontip->buffer);
- }
- icontip->buffer = NULL;
-
- g_free (icontip);
-}
-
-static int
-icon_tip_buffer_compare (gconstpointer a,
- gconstpointer b)
-{
- const IconTipBuffer *buffer_a = a;
- const IconTipBuffer *buffer_b = b;
-
- if (buffer_a == NULL || buffer_b == NULL)
- return !(buffer_a == buffer_b);
-
- return buffer_a->id - buffer_b->id;
-}
-
-static void
-icon_tip_show_next_clicked (GtkWidget *widget,
- gpointer data)
-{
- icon_tip_show_next ((IconTip *) data);
-}
-
-static gboolean
-icon_tip_show_next_timeout (gpointer data)
-{
- IconTip *icontip = (IconTip *) data;
-
- icon_tip_show_next (icontip);
-
- return FALSE;
-}
-
-static void
-icon_tip_show_next (IconTip *icontip)
-{
- IconTipBuffer *buffer;
-
- if (icontip->buffer == NULL)
- {
- /* this will also destroy the tip window */
- g_hash_table_remove (icontip->tray->priv->trays_screen->tip_table,
- icontip->icon);
- return;
- }
-
- if (icontip->source_id != 0)
- g_source_remove (icontip->source_id);
- icontip->source_id = 0;
-
- buffer = icontip->buffer->data;
- icontip->buffer = g_slist_remove (icontip->buffer, buffer);
-
- if (icontip->fixedtip == NULL)
- {
- icontip->fixedtip = na_fixed_tip_new (icontip->icon,
- na_tray_get_orientation (icontip->tray));
-
- g_signal_connect (icontip->fixedtip, "clicked",
- G_CALLBACK (icon_tip_show_next_clicked), icontip);
- }
-
- na_fixed_tip_set_markup (icontip->fixedtip, buffer->text);
-
- if (!GTK_WIDGET_MAPPED (icontip->fixedtip))
- gtk_widget_show (icontip->fixedtip);
-
- icontip->id = buffer->id;
-
- if (buffer->timeout > 0)
- icontip->source_id = g_timeout_add (buffer->timeout * 1000,
- icon_tip_show_next_timeout, icontip);
-
- icon_tip_buffer_free (buffer, NULL);
-}
-
-static void
-message_sent (NaTrayManager *manager,
- GtkWidget *icon,
- const char *text,
- glong id,
- glong timeout,
- TraysScreen *trays_screen)
-{
- IconTip *icontip;
- IconTipBuffer find_buffer;
- IconTipBuffer *buffer;
- gboolean show_now;
-
- icontip = g_hash_table_lookup (trays_screen->tip_table, icon);
-
- find_buffer.id = id;
- if (icontip &&
- (icontip->id == id ||
- g_slist_find_custom (icontip->buffer, &find_buffer,
- icon_tip_buffer_compare) != NULL))
- /* we already have this message, so ignore it */
- /* FIXME: in an ideal world, we'd remember all the past ids and ignore them
- * too */
- return;
-
- show_now = FALSE;
-
- if (icontip == NULL)
- {
- NaTray *tray;
-
- tray = g_hash_table_lookup (trays_screen->icon_table, icon);
- if (tray == NULL)
- {
- /* We don't know about the icon sending the message, so ignore it.
- * But this should never happen since NaTrayManager shouldn't send
- * us the message if there's no socket for it. */
- g_critical ("Ignoring a message sent by a tray icon "
- "we don't know: \"%s\".\n", text);
- return;
- }
-
- icontip = g_new0 (IconTip, 1);
- icontip->tray = tray;
- icontip->icon = icon;
-
- g_hash_table_insert (trays_screen->tip_table, icon, icontip);
-
- show_now = TRUE;
- }
-
- buffer = g_new0 (IconTipBuffer, 1);
-
- buffer->text = g_strdup (text);
- buffer->id = id;
- buffer->timeout = timeout;
-
- icontip->buffer = g_slist_append (icontip->buffer, buffer);
-
- if (show_now)
- icon_tip_show_next (icontip);
-}
-
-static void
-message_cancelled (NaTrayManager *manager,
- GtkWidget *icon,
- glong id,
- TraysScreen *trays_screen)
-{
- IconTip *icontip;
- IconTipBuffer find_buffer;
- GSList *cancel_buffer_l;
- IconTipBuffer *cancel_buffer;
-
- icontip = g_hash_table_lookup (trays_screen->tip_table, icon);
- if (icontip == NULL)
- return;
-
- if (icontip->id == id)
- {
- icon_tip_show_next (icontip);
- return;
- }
-
- find_buffer.id = id;
- cancel_buffer_l = g_slist_find_custom (icontip->buffer, &find_buffer,
- icon_tip_buffer_compare);
- if (cancel_buffer_l == NULL)
- return;
-
- cancel_buffer = cancel_buffer_l->data;
- icon_tip_buffer_free (cancel_buffer, NULL);
-
- icontip->buffer = g_slist_remove_link (icontip->buffer, cancel_buffer_l);
- g_slist_free_1 (cancel_buffer_l);
-}
-
-static void
-update_orientation_for_messages (gpointer key,
- gpointer value,
- gpointer data)
-{
- NaTray *tray;
- IconTip *icontip;
-
- if (value == NULL)
- return;
-
- icontip = value;
- tray = data;
- if (icontip->tray != tray)
- return;
-
- if (icontip->fixedtip)
- na_fixed_tip_set_orientation (icontip->fixedtip, tray->priv->orientation);
-}
-
-static void
-update_size_and_orientation (NaTray *tray)
-{
- NaTrayPrivate *priv = tray->priv;
-
- na_obox_set_orientation (NA_OBOX (priv->box), priv->orientation);
-
- /* This only happens when setting the property during object construction */
- if (!priv->trays_screen)
- return;
-
- g_hash_table_foreach (priv->trays_screen->tip_table,
- update_orientation_for_messages, tray);
-
- if (get_tray (priv->trays_screen) == tray)
- na_tray_manager_set_orientation (priv->trays_screen->tray_manager,
- priv->orientation);
-
- /* note, you want this larger if the frame has non-NONE relief by default. */
- switch (priv->orientation)
- {
- case GTK_ORIENTATION_VERTICAL:
- /* Give box a min size so the frame doesn't look dumb */
- gtk_widget_set_size_request (priv->box, MIN_BOX_SIZE, -1);
- break;
- case GTK_ORIENTATION_HORIZONTAL:
- gtk_widget_set_size_request (priv->box, -1, MIN_BOX_SIZE);
- break;
- }
-
- na_tray_force_redraw (tray);
-}
-
-static void
-na_tray_init (NaTray *tray)
-{
- NaTrayPrivate *priv;
-
- priv = tray->priv = G_TYPE_INSTANCE_GET_PRIVATE (tray, NA_TYPE_TRAY, NaTrayPrivate);
-
- priv->screen = NULL;
- priv->orientation = GTK_ORIENTATION_HORIZONTAL;
-
- priv->frame = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (tray), priv->frame);
- gtk_widget_show (priv->frame);
-
- priv->box = na_obox_new ();
- gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING);
- gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
- gtk_widget_show (priv->box);
-}
-
-static GObject *
-na_tray_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
-{
- GObject *object;
- NaTray *tray;
- NaTrayPrivate *priv;
- int screen_number;
-
- object = G_OBJECT_CLASS (na_tray_parent_class)->constructor (type,
- n_construct_properties,
- construct_params);
- tray = NA_TRAY (object);
- priv = tray->priv;
-
- g_assert (priv->screen != NULL);
-
- if (!initialized)
- {
- GdkDisplay *display;
- int n_screens;
-
- display = gdk_display_get_default ();
- n_screens = gdk_display_get_n_screens (display);
- trays_screens = g_new0 (TraysScreen, n_screens);
- initialized = TRUE;
- }
-
- screen_number = gdk_screen_get_number (priv->screen);
-
- if (trays_screens [screen_number].tray_manager == NULL)
- {
- NaTrayManager *tray_manager;
-
- tray_manager = na_tray_manager_new ();
-
- if (na_tray_manager_manage_screen (tray_manager, priv->screen))
- {
- trays_screens [screen_number].tray_manager = tray_manager;
-
- g_signal_connect (tray_manager, "tray_icon_added",
- G_CALLBACK (tray_added),
- &trays_screens [screen_number]);
- g_signal_connect (tray_manager, "tray_icon_removed",
- G_CALLBACK (tray_removed),
- &trays_screens [screen_number]);
- g_signal_connect (tray_manager, "message_sent",
- G_CALLBACK (message_sent),
- &trays_screens [screen_number]);
- g_signal_connect (tray_manager, "message_cancelled",
- G_CALLBACK (message_cancelled),
- &trays_screens [screen_number]);
-
- trays_screens [screen_number].icon_table = g_hash_table_new (NULL,
- NULL);
- trays_screens [screen_number].tip_table = g_hash_table_new_full (
- NULL,
- NULL,
- NULL,
- icon_tip_free);
- }
- else
- {
- g_printerr ("System tray didn't get the system tray manager selection for screen %d\n",
- screen_number);
- g_object_unref (tray_manager);
- }
- }
-
- priv->trays_screen = &trays_screens [screen_number];
- trays_screens [screen_number].all_trays = g_slist_append (trays_screens [screen_number].all_trays,
- tray);
-
- update_size_and_orientation (tray);
-
- return object;
-}
-
-static void
-na_tray_dispose (GObject *object)
-{
- NaTray *tray = NA_TRAY (object);
- NaTrayPrivate *priv = tray->priv;
- TraysScreen *trays_screen = priv->trays_screen;
-
- if (trays_screen != NULL)
- {
- trays_screen->all_trays = g_slist_remove (trays_screen->all_trays, tray);
-
- if (trays_screen->all_trays == NULL)
- {
- /* Make sure we drop the manager selection */
- g_object_unref (trays_screen->tray_manager);
- trays_screen->tray_manager = NULL;
-
- g_hash_table_destroy (trays_screen->icon_table);
- trays_screen->icon_table = NULL;
-
- g_hash_table_destroy (trays_screen->tip_table);
- trays_screen->tip_table = NULL;
- }
- else
- {
- NaTray *new_tray;
-
- new_tray = get_tray (trays_screen);
- if (new_tray != NULL)
- na_tray_manager_set_orientation (trays_screen->tray_manager,
- na_tray_get_orientation (new_tray));
- }
- }
-
- priv->trays_screen = NULL;
-
- if (priv->idle_redraw_id != 0)
- {
- g_source_remove (priv->idle_redraw_id);
- priv->idle_redraw_id = 0;
- }
-
- G_OBJECT_CLASS (na_tray_parent_class)->dispose (object);
-}
-
-static void
-na_tray_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- NaTray *tray = NA_TRAY (object);
- NaTrayPrivate *priv = tray->priv;
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- na_tray_set_orientation (tray, g_value_get_enum (value));
- break;
- case PROP_SCREEN:
- priv->screen = g_value_get_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-na_tray_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), requisition);
-}
-
-static void
-na_tray_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), allocation);
-}
-
-static void
-na_tray_class_init (NaTrayClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- gobject_class->constructor = na_tray_constructor;
- gobject_class->set_property = na_tray_set_property;
- gobject_class->dispose = na_tray_dispose;
-
- widget_class->size_request = na_tray_size_request;
- widget_class->size_allocate = na_tray_size_allocate;
-
- g_object_class_install_property
- (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation", "orientation", "orientation",
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property
- (gobject_class,
- PROP_SCREEN,
- g_param_spec_object ("screen", "screen", "screen",
- GDK_TYPE_SCREEN,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
-
- g_type_class_add_private (gobject_class, sizeof (NaTrayPrivate));
-}
-
-NaTray *
-na_tray_new_for_screen (GdkScreen *screen,
- GtkOrientation orientation)
-{
- return g_object_new (NA_TYPE_TRAY,
- "screen", screen,
- "orientation", orientation,
- NULL);
-}
-
-void
-na_tray_set_orientation (NaTray *tray,
- GtkOrientation orientation)
-{
- NaTrayPrivate *priv = tray->priv;
-
- if (orientation == priv->orientation)
- return;
-
- priv->orientation = orientation;
-
- update_size_and_orientation (tray);
-}
-
-GtkOrientation
-na_tray_get_orientation (NaTray *tray)
-{
- return tray->priv->orientation;
-}
-
-static gboolean
-idle_redraw_cb (NaTray *tray)
-{
- NaTrayPrivate *priv = tray->priv;
-
- priv->idle_redraw_id = 0;
- gtk_widget_hide (priv->box);
- gtk_widget_show (priv->box);
-
- return FALSE;
-}
-
-void
-na_tray_force_redraw (NaTray *tray)
-{
- NaTrayPrivate *priv = tray->priv;
-
- /* Force the icons to redraw their backgrounds.
- * gtk_widget_queue_draw() doesn't work across process boundaries,
- * so we do this instead.
- */
- if (priv->idle_redraw_id == 0)
- priv->idle_redraw_id = g_idle_add ((GSourceFunc) idle_redraw_cb, tray);
-}
diff --git a/gui/simple-greeter/libnotificationarea/na-tray.h b/gui/simple-greeter/libnotificationarea/na-tray.h
deleted file mode 100644
index db6f058a..00000000
--- a/gui/simple-greeter/libnotificationarea/na-tray.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* na-tray-tray.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- * Copyright (C) 2003-2006 Vincent Untz
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Used to be: eggtraytray.h
- */
-
-#ifndef __NA_TRAY_H__
-#define __NA_TRAY_H__
-
-#include <gtk/gtkwidget.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
-
-G_BEGIN_DECLS
-
-#define NA_TYPE_TRAY (na_tray_get_type ())
-#define NA_TRAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_TRAY, NaTray))
-#define NA_TRAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_TRAY, NaTrayClass))
-#define NA_IS_TRAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_TRAY))
-#define NA_IS_TRAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_TRAY))
-#define NA_TRAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_TRAY, NaTrayClass))
-
-typedef struct _NaTray NaTray;
-typedef struct _NaTrayPrivate NaTrayPrivate;
-typedef struct _NaTrayClass NaTrayClass;
-typedef struct _NaTrayChild NaTrayChild;
-
-struct _NaTray
-{
- GtkBin parent_instance;
-
- NaTrayPrivate *priv;
-};
-
-struct _NaTrayClass
-{
- GtkBinClass parent_class;
-};
-
-GType na_tray_get_type (void);
-NaTray *na_tray_new_for_screen (GdkScreen *screen,
- GtkOrientation orientation);
-void na_tray_set_orientation (NaTray *tray,
- GtkOrientation orientation);
-GtkOrientation na_tray_get_orientation (NaTray *tray);
-void na_tray_force_redraw (NaTray *tray);
-
-G_END_DECLS
-
-#endif /* __NA_TRAY_H__ */
diff --git a/gui/simple-greeter/libnotificationarea/obox.c b/gui/simple-greeter/libnotificationarea/obox.c
deleted file mode 100644
index 96e4265c..00000000
--- a/gui/simple-greeter/libnotificationarea/obox.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* OBox Copyright (C) 2002 Red Hat Inc. based on GtkHBox */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "obox.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-
-static void na_obox_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void na_obox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-G_DEFINE_TYPE (NaOBox, na_obox, GTK_TYPE_BOX)
-
-static void
-na_obox_class_init (NaOBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = na_obox_size_request;
- widget_class->size_allocate = na_obox_size_allocate;
-}
-
-static void
-na_obox_init (NaOBox *obox)
-{
- obox->orientation = GTK_ORIENTATION_HORIZONTAL;
-}
-
-GtkWidget*
-na_obox_new (void)
-{
- NaOBox *obox;
-
- obox = g_object_new (NA_TYPE_OBOX, NULL);
-
- return GTK_WIDGET (obox);
-}
-
-static GtkWidgetClass*
-get_class (NaOBox *obox)
-{
- GtkWidgetClass *klass;
-
- switch (obox->orientation)
- {
- case GTK_ORIENTATION_HORIZONTAL:
- klass = GTK_WIDGET_CLASS (gtk_type_class (GTK_TYPE_HBOX));
- break;
- case GTK_ORIENTATION_VERTICAL:
- klass = GTK_WIDGET_CLASS (gtk_type_class (GTK_TYPE_VBOX));
- break;
- default:
- g_assert_not_reached ();
- klass = NULL;
- break;
- }
-
- return klass;
-}
-
-static void
-na_obox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWidgetClass *klass;
- NaOBox *obox;
-
- obox = NA_OBOX (widget);
-
- klass = get_class (obox);
-
- klass->size_request (widget, requisition);
-}
-
-static void
-na_obox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkWidgetClass *klass;
- NaOBox *obox;
-
- obox = NA_OBOX (widget);
-
- klass = get_class (obox);
-
- klass->size_allocate (widget, allocation);
-}
-
-void
-na_obox_set_orientation (NaOBox *obox,
- GtkOrientation orientation)
-{
- g_return_if_fail (NA_IS_OBOX (obox));
-
- if (obox->orientation == orientation)
- return;
-
- obox->orientation = orientation;
-
- gtk_widget_queue_resize (GTK_WIDGET (obox));
-}
diff --git a/gui/simple-greeter/libnotificationarea/obox.h b/gui/simple-greeter/libnotificationarea/obox.h
deleted file mode 100644
index 5995da46..00000000
--- a/gui/simple-greeter/libnotificationarea/obox.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* OBox Copyright (C) 2002 Red Hat Inc. based on GtkHBox */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __NA_OBOX_H__
-#define __NA_OBOX_H__
-
-#include <gtk/gtkbox.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define NA_TYPE_OBOX (na_obox_get_type ())
-#define NA_OBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_OBOX, NaOBox))
-#define NA_OBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_OBOX, NaOBoxClass))
-#define NA_IS_OBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_OBOX))
-#define NA_IS_OBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_OBOX))
-#define NA_OBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_OBOX, NaOBoxClass))
-
-
-typedef struct _NaOBox NaOBox;
-typedef struct _NaOBoxClass NaOBoxClass;
-
-struct _NaOBox
-{
- GtkBox box;
-
- GtkOrientation orientation;
-};
-
-struct _NaOBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-GType na_obox_get_type (void) G_GNUC_CONST;
-GtkWidget* na_obox_new (void);
-
-void na_obox_set_orientation (NaOBox *obox,
- GtkOrientation orientation);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __NA_OBOX_H__ */
diff --git a/gui/simple-greeter/libnotificationarea/testtray.c b/gui/simple-greeter/libnotificationarea/testtray.c
deleted file mode 100644
index 42d37329..00000000
--- a/gui/simple-greeter/libnotificationarea/testtray.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- * Copyright (C) 2003-2006 Vincent Untz
- * Copyright (C) 2006, 2007 Christian Persch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include "na-tray-manager.h"
-#include "na-tray.h"
-
-#define NOTIFICATION_AREA_ICON "gnome-panel-notification-area"
-
-static guint n_windows = 0;
-
-typedef struct
-{
- GdkScreen *screen;
- guint screen_num;
- GtkWidget *window;
- NaTray *tray;
- GtkWidget *box;
- GtkLabel *count_label;
-} TrayData;
-
-static void
-do_add (GtkWidget *child, guint *n_children)
-{
- *n_children += 1;
-}
-
-static void
-update_child_count (TrayData *data)
-{
- guint n_children = 0;
- char text[64];
-
- if (!GTK_WIDGET_REALIZED (data->window))
- return;
-
- gtk_container_foreach (GTK_CONTAINER (data->box), (GtkCallback) do_add, &n_children);
-
- g_snprintf (text, sizeof (text), "%u icons", n_children);
- gtk_label_set_text (data->count_label, text);
-}
-
-static void
-tray_added_cb (GtkContainer *box, GtkWidget *icon, TrayData *data)
-{
- g_print ("[Screen %u tray %p] Child %p added to tray: \"%s\"\n",
- data->screen_num, data->tray, icon, "XXX");//na_tray_manager_get_child_title (manager, icon));
-
- update_child_count (data);
-}
-
-static void
-tray_removed_cb (GtkContainer *box, GtkWidget *icon, TrayData *data)
-{
- g_print ("[Screen %u tray %p] Child %p removed from tray\n",
- data->screen_num, data->tray, icon);
-
- update_child_count (data);
-}
-
-static void orientation_changed_cb (GtkComboBox *combo, TrayData *data)
-{
- GtkOrientation orientation = (GtkOrientation) gtk_combo_box_get_active (combo);
-
- g_print ("[Screen %u tray %p] Setting orientation to \"%s\"\n",
- data->screen_num, data->tray, orientation == 0 ? "horizontal" : "vertical");
-
- na_tray_set_orientation (data->tray, orientation);
-}
-
-static void
-maybe_quit (gpointer data,
- GObject *zombie)
-{
- if (--n_windows == 0) {
- gtk_main_quit ();
- }
-}
-
-static TrayData *create_tray_on_screen (GdkScreen *screen, gboolean force);
-
-static void
-warning_dialog_response_cb (GtkWidget *dialog,
- gint response,
- GdkScreen *screen)
-{
- if (response == GTK_RESPONSE_YES) {
- create_tray_on_screen (screen, TRUE);
- }
-
- gtk_widget_destroy (dialog);
-}
-
-static void
-add_tray_cb (GtkWidget *button, TrayData *data)
-{
- create_tray_on_screen (data->screen, TRUE);
-}
-
-static TrayData *
-create_tray_on_screen (GdkScreen *screen,
- gboolean force)
-{
- GtkWidget *window, *hbox, *vbox, *button, *combo, *label;
- TrayData *data;
-
- n_windows++;
-
- if (!force && na_tray_manager_check_running (screen)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO,
- "Override tray manager?");
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- "There is already a tray manager running on screen %d.",
- gdk_screen_get_number (screen));
- gtk_window_set_screen (GTK_WINDOW (dialog), screen);
- g_signal_connect (dialog, "response", G_CALLBACK (warning_dialog_response_cb), screen);
- gtk_window_present (GTK_WINDOW (dialog));
- g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) maybe_quit, NULL);
- return NULL;
- }
-
- data = g_new0 (TrayData, 1);
- data->screen = screen;
- data->screen_num = gdk_screen_get_number (screen);
-
- data->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_object_weak_ref (G_OBJECT (window), (GWeakNotify) maybe_quit, NULL);
-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- button = gtk_button_new_with_mnemonic ("_Add another tray");
- g_signal_connect (button, "clicked", G_CALLBACK (add_tray_cb), data);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- label = gtk_label_new_with_mnemonic ("_Orientation:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "Horizontal");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "Vertical");
- g_signal_connect (combo, "changed",
- G_CALLBACK (orientation_changed_cb), data);
- gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
-
- label = gtk_label_new (NULL);
- data->count_label = GTK_LABEL (label);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- data->tray = na_tray_new_for_screen (screen, GTK_ORIENTATION_HORIZONTAL);
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (data->tray), TRUE, TRUE, 0);
-
- data->box = GTK_BIN (GTK_BIN (data->tray)->child)->child;
- g_signal_connect_after (data->box, "add", G_CALLBACK (tray_added_cb), data);
- g_signal_connect_after (data->box, "remove", G_CALLBACK (tray_removed_cb), data);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
-
- gtk_window_set_screen (GTK_WINDOW (window), screen);
- gtk_window_set_default_size (GTK_WINDOW (window), -1, 200);
-
- /* gtk_window_set_resizable (GTK_WINDOW (window), FALSE); */
-
- gtk_widget_show_all (window);
-
- update_child_count (data);
-
- return data;
-}
-
-int
-main (int argc, char *argv[])
-{
- GdkDisplay *display;
- GdkScreen *screen;
- int n_screens, i;
-
- gtk_init (&argc, &argv);
-
- gtk_window_set_default_icon_name (NOTIFICATION_AREA_ICON);
-
- display = gdk_display_get_default ();
- n_screens = gdk_display_get_n_screens (display);
- for (i = 0; i < n_screens; ++i) {
- screen = gdk_display_get_screen (display, i);
-
- create_tray_on_screen (screen, FALSE);
- }
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gui/simple-greeter/locarchive.h b/gui/simple-greeter/locarchive.h
deleted file mode 100644
index f933f4d9..00000000
--- a/gui/simple-greeter/locarchive.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Definitions for locale archive handling.
- Copyright (C) 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _LOCARCHIVE_H
-#define _LOCARCHIVE_H 1
-
-#include <stdint.h>
-
-#define AR_MAGIC 0xde020109
-
-struct locarhead
-{
- uint32_t magic;
- /* Serial number. */
- uint32_t serial;
- /* Name hash table. */
- uint32_t namehash_offset;
- uint32_t namehash_used;
- uint32_t namehash_size;
- /* String table. */
- uint32_t string_offset;
- uint32_t string_used;
- uint32_t string_size;
- /* Table with locale records. */
- uint32_t locrectab_offset;
- uint32_t locrectab_used;
- uint32_t locrectab_size;
- /* MD5 sum hash table. */
- uint32_t sumhash_offset;
- uint32_t sumhash_used;
- uint32_t sumhash_size;
-};
-
-
-struct namehashent
-{
- /* Hash value of the name. */
- uint32_t hashval;
- /* Offset of the name in the string table. */
- uint32_t name_offset;
- /* Offset of the locale record. */
- uint32_t locrec_offset;
-};
-
-
-struct sumhashent
-{
- /* MD5 sum. */
- char sum[16];
- /* Offset of the file in the archive. */
- uint32_t file_offset;
-};
-
-struct locrecent
-{
- uint32_t refs; /* # of namehashent records that point here */
- struct
- {
- uint32_t offset;
- uint32_t len;
- } record[__LC_LAST];
-};
-
-
-struct locarhandle
-{
- int fd;
- void *addr;
- size_t len;
-};
-
-
-/* In memory data for the locales with their checksums. */
-typedef struct locale_category_data
-{
- off_t size;
- void *addr;
- char sum[16];
-} locale_data_t[__LC_LAST];
-
-#endif /* locarchive.h */
diff --git a/gui/simple-greeter/test-greeter-background.c b/gui/simple-greeter/test-greeter-background.c
deleted file mode 100644
index 64fcc400..00000000
--- a/gui/simple-greeter/test-greeter-background.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "gdm-greeter-background.h"
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *background;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
-
- background = gdm_greeter_background_new ();
- gtk_widget_show_all (background);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gui/simple-greeter/test-greeter-panel.c b/gui/simple-greeter/test-greeter-panel.c
deleted file mode 100644
index ba9a0595..00000000
--- a/gui/simple-greeter/test-greeter-panel.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "gdm-greeter-panel.h"
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *panel;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
-
- panel = gdm_greeter_panel_new ();
- gtk_widget_show (panel);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gui/simple-greeter/test-language-chooser.c b/gui/simple-greeter/test-language-chooser.c
deleted file mode 100644
index 04e14580..00000000
--- a/gui/simple-greeter/test-language-chooser.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "gdm-language-chooser-dialog.h"
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
-
- dialog = gdm_language_chooser_dialog_new ();
- gtk_widget_set_size_request (dialog, 480, 480);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- char *name;
-
- name = gdm_language_chooser_dialog_get_current_language_name (GDM_LANGUAGE_CHOOSER_DIALOG (dialog));
- g_message ("Language: %s", name ? name : "(null)");
- g_free (name);
- }
- gtk_widget_destroy (dialog);
-
- return 0;
-}
diff --git a/gui/simple-greeter/test-session-chooser.c b/gui/simple-greeter/test-session-chooser.c
deleted file mode 100644
index 533ce5be..00000000
--- a/gui/simple-greeter/test-session-chooser.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "gdm-session-chooser-dialog.h"
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
-
- dialog = gdm_session_chooser_dialog_new ();
- gtk_widget_set_size_request (dialog, 480, 480);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- char *name;
-
- name = gdm_session_chooser_dialog_get_current_session_name (GDM_SESSION_CHOOSER_DIALOG (dialog));
- g_message ("Session: %s", name ? name : "(null)");
- g_free (name);
- }
- gtk_widget_destroy (dialog);
-
- return 0;
-}
diff --git a/gui/simple-greeter/test-user-chooser.c b/gui/simple-greeter/test-user-chooser.c
deleted file mode 100644
index 7efd8c33..00000000
--- a/gui/simple-greeter/test-user-chooser.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-
-#include "gdm-user-chooser-dialog.h"
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
- gnome_vfs_init ();
-
- dialog = gdm_user_chooser_dialog_new ();
- /*gtk_widget_set_size_request (dialog, 480, 128);*/
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- char *name;
-
- name = gdm_user_chooser_dialog_get_current_user_name (GDM_USER_CHOOSER_DIALOG (dialog));
- g_message ("User: %s", name ? name : "(null)");
- g_free (name);
- }
- gtk_widget_destroy (dialog);
-
- return 0;
-}
diff --git a/gui/simple-greeter/test-user-manager.c b/gui/simple-greeter/test-user-manager.c
deleted file mode 100644
index 436dce18..00000000
--- a/gui/simple-greeter/test-user-manager.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include <libgnomevfs/gnome-vfs-init.h>
-
-#include "gdm-user-manager.h"
-
-static GdmUserManager *manager = NULL;
-
-static void
-on_user_added (GdmUserManager *manager,
- GdmUser *user,
- gpointer data)
-{
- g_debug ("User added: %s", gdm_user_get_user_name (user));
-}
-
-static void
-on_user_removed (GdmUserManager *manager,
- GdmUser *user,
- gpointer data)
-{
- g_debug ("User removed: %s", gdm_user_get_user_name (user));
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- setlocale (LC_ALL, "");
-
- gtk_init (&argc, &argv);
- gnome_vfs_init ();
-
- manager = gdm_user_manager_ref_default ();
- g_signal_connect (manager,
- "user-added",
- G_CALLBACK (on_user_added),
- NULL);
- g_signal_connect (manager,
- "user-removed",
- G_CALLBACK (on_user_removed),
- NULL);
-
- gtk_main ();
-
- return 0;
-}