summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2002-04-26 00:12:32 +0000
committerGeorge Lebl <jirka@src.gnome.org>2002-04-26 00:12:32 +0000
commit0b6ad30c1b7c8de86f18e419c63a651c325a9fab (patch)
tree6f4c67faf05673bbfde2ee1e8aab701b046292c0
parent05ed8db23dee1fef15bb04cb055abf795813a811 (diff)
downloadgdm-0b6ad30c1b7c8de86f18e419c63a651c325a9fab.tar.gz
Whack the gdmconfig again, gdmconfig is now really dead
Thu Apr 25 17:20:52 2002 George Lebl <jirka@5z.com> * Makefile.am, configure.in, gdm.spec.in, gdmsetup-security.in: Whack the gdmconfig again, gdmconfig is now really dead * configure.in, docs/Makefile.am: don't build gdmconfig docs * gui/greeter/greeter.c, gui/greeter/greeter_canvas_item.c, gui/greeter/greeter_events.c, gui/greeter/greeter_geometry.c, gui/greeter/greeter_item.c, gui/greeter/greeter_item.h, gui/greeter/greeter_item_capslock.c, gui/greeter/greeter_parser.c, gui/greeter/greeter_parser.h: Handle multi-item buttons so that we can catch clicks on the labels next to the buttons in the circles theme. Add 'show modes' since some items may not be shown depending on what the daemon tells us. Reformat some code to be in the same style. Fix a bunch of leaks and some other minor fixes. Also the text is now not taken from a "val" property but from the content since text in a property is just on crack. * gui/greeter/greeter.dtd: update a tad but it's still out of date * gui/greeter/themes/circles/circles.xml: update for the above changes
-rw-r--r--ChangeLog24
-rw-r--r--Makefile.am4
-rw-r--r--configure.in5
-rw-r--r--docs/Makefile.am2
-rw-r--r--gdm.spec.in8
-rwxr-xr-xgdmconfig1
-rw-r--r--gdmconfig-pam6
-rw-r--r--gdmconfig-security.in5
-rw-r--r--gdmsetup-security.in2
-rw-r--r--gui/greeter/greeter.c238
-rw-r--r--gui/greeter/greeter.dtd10
-rw-r--r--gui/greeter/greeter_canvas_item.c8
-rw-r--r--gui/greeter/greeter_events.c108
-rw-r--r--gui/greeter/greeter_geometry.c30
-rw-r--r--gui/greeter/greeter_item.c75
-rw-r--r--gui/greeter/greeter_item.h21
-rw-r--r--gui/greeter/greeter_item_capslock.c14
-rw-r--r--gui/greeter/greeter_parser.c388
-rw-r--r--gui/greeter/greeter_parser.h4
-rw-r--r--gui/greeter/themes/circles/circles.xml123
20 files changed, 799 insertions, 277 deletions
diff --git a/ChangeLog b/ChangeLog
index 703f30b9..dcf0508d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Thu Apr 25 17:20:52 2002 George Lebl <jirka@5z.com>
+
+ * Makefile.am, configure.in, gdm.spec.in, gdmsetup-security.in:
+ Whack the gdmconfig again, gdmconfig is now really dead
+
+ * configure.in, docs/Makefile.am: don't build gdmconfig docs
+
+ * gui/greeter/greeter.c, gui/greeter/greeter_canvas_item.c,
+ gui/greeter/greeter_events.c, gui/greeter/greeter_geometry.c,
+ gui/greeter/greeter_item.c, gui/greeter/greeter_item.h,
+ gui/greeter/greeter_item_capslock.c, gui/greeter/greeter_parser.c,
+ gui/greeter/greeter_parser.h: Handle multi-item buttons so that
+ we can catch clicks on the labels next to the buttons in the
+ circles theme. Add 'show modes' since some items may not be shown
+ depending on what the daemon tells us. Reformat some code to be in
+ the same style. Fix a bunch of leaks and some other minor fixes.
+ Also the text is now not taken from a "val" property but from the
+ content since text in a property is just on crack.
+
+ * gui/greeter/greeter.dtd: update a tad but it's still out of date
+
+ * gui/greeter/themes/circles/circles.xml: update for the above
+ changes
+
2002-04-25 Jacob Berkman <jacob@ximian.com>
* configure.in (AC_OUTPUT): add gdmsetup-security
diff --git a/Makefile.am b/Makefile.am
index cc3e61bd..6a048f71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,9 +12,7 @@ EXTRA_DIST = \
intltool-merge.in \
intltool-update.in \
gdm-restart.in \
- gdm-safe-restart.in \
- gdmconfig \
- gdmconfig-security.in
+ gdm-safe-restart.in
sbin_SCRIPTS = gdm-restart gdm-safe-restart gdmconfig
diff --git a/configure.in b/configure.in
index 65535e2f..862fcba5 100644
--- a/configure.in
+++ b/configure.in
@@ -133,7 +133,7 @@ if test -z $LIBGLADE_CONVERT; then
AC_MSG_ERROR([libglade-convert (from libglade 2.0) is needed to build gdm.])
fi
-dnl Allow users to run gdmconfig using the console helper PAM stuff.
+dnl Allow users to run gdmsetup using the console helper PAM stuff.
if test "x$enable_console_helper" = "xyes"; then
AM_CONDITIONAL(CONSOLE_HELPER, true)
else
@@ -425,8 +425,6 @@ pixmaps/Makefile
config/Makefile
docs/Makefile
docs/C/Makefile
-docs/gdmconfig/Makefile
-docs/gdmconfig/C/Makefile
omf-install/Makefile
po/Makefile.in
vicious-extensions/Makefile
@@ -435,7 +433,6 @@ config/Gnome
config/gnomerc
gdm-restart
gdm-safe-restart
-gdmconfig-security
gdmsetup-security
gdm.spec
])
diff --git a/docs/Makefile.am b/docs/Makefile.am
index fb68326f..bed8dca0 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = C gdmconfig
+SUBDIRS = C
EXTRA_DIST = sgmldocs.make
diff --git a/gdm.spec.in b/gdm.spec.in
index a894519f..801ef115 100644
--- a/gdm.spec.in
+++ b/gdm.spec.in
@@ -114,7 +114,7 @@ exit 0
%{_datadir}/gnome/apps/*/*
%{_datadir}/gnome/help/*
%{_datadir}/omf/gdm
-# %config %{sysconfdir}/security/console.apps/gdmconfig
+# %config %{sysconfdir}/security/console.apps/gdmsetup
# %config %{sysconfdir}/X11/gdm/gnomerc
# %config %{sysconfdir}/X11/gdm/gdm.conf
# %config %{sysconfdir}/X11/gdm/locale.alias
@@ -122,14 +122,14 @@ exit 0
# %config %{sysconfdir}/X11/gdm/Init/*
# %config %{sysconfdir}/X11/gdm/PreSession/*
# %config %{sysconfdir}/X11/gdm/PostSession/*
-# %{_datadir}/gdm/gdmconfig.glade
+# %{_datadir}/gdm/gdmsetup.glade
# %{_datadir}/gdm/gdmchooser.glade
-# %{_datadir}/gnome/apps/System/gdmconfig.desktop
+# %{_datadir}/gnome/apps/System/gdmsetup.desktop
# %{_datadir}/gnome/apps/Settings/gdmphotosetup.desktop
# %{_datadir}/locale/*/*/*
# %{_datadir}/pixmaps/*
# %{_datadir}/gnome/help/gdm/*
-# %{_datadir}/gnome/help/gdmconfig/*
+# %{_datadir}/gnome/help/gdmsetup/*
%attr(750, gdm, gdm) %dir %{localstatedir}/gdm
diff --git a/gdmconfig b/gdmconfig
index 3de97c1a..47f30808 100755
--- a/gdmconfig
+++ b/gdmconfig
@@ -1,2 +1,3 @@
#!/bin/sh
+# Just a script for some bin name compatibility
exec gdmsetup "$@"
diff --git a/gdmconfig-pam b/gdmconfig-pam
deleted file mode 100644
index 44b01cfc..00000000
--- a/gdmconfig-pam
+++ /dev/null
@@ -1,6 +0,0 @@
-#%PAM-1.0
-auth sufficient /lib/security/pam_rootok.so
-auth required /lib/security/pam_stack.so service=system-auth
-session required /lib/security/pam_permit.so
-session optional /lib/security/pam_xauth.so
-account required /lib/security/pam_permit.so
diff --git a/gdmconfig-security.in b/gdmconfig-security.in
deleted file mode 100644
index fb53f173..00000000
--- a/gdmconfig-security.in
+++ /dev/null
@@ -1,5 +0,0 @@
-USER=root
-PROGRAM=@EXPANDED_GDMCONFIGDIR@/gdmconfig
-SESSION=true
-FALLBACK=false
-
diff --git a/gdmsetup-security.in b/gdmsetup-security.in
index fb53f173..f04620b0 100644
--- a/gdmsetup-security.in
+++ b/gdmsetup-security.in
@@ -1,5 +1,5 @@
USER=root
-PROGRAM=@EXPANDED_GDMCONFIGDIR@/gdmconfig
+PROGRAM=@EXPANDED_GDMCONFIGDIR@/gdmsetup
SESSION=true
FALLBACK=false
diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c
index 0ef6b48a..de9718f1 100644
--- a/gui/greeter/greeter.c
+++ b/gui/greeter/greeter.c
@@ -600,6 +600,35 @@ setup_cursor (GdkCursorType type)
gdk_cursor_destroy (cursor);
}
+static char *
+get_theme_file (const char *in)
+{
+ char *file;
+
+ if (g_path_is_absolute (in))
+ {
+ file = g_strdup (in);
+ }
+ else
+ {
+ file = NULL;
+ if (DOING_GDM_DEVELOPMENT)
+ {
+ file = g_build_filename ("themes", in, NULL);
+ if (access (file, F_OK) != 0)
+ {
+ g_free (file);
+ file = NULL;
+ }
+ }
+ /* FIXME: look for the theme using the gnome_program thingie */
+ /* FIXME: Perhaps there should be a themedir config var */
+ if (file == NULL)
+ file = g_build_filename (GREETERTHEMEDIR, in, NULL);
+ }
+ return file;
+}
+
int
main (int argc, char *argv[])
{
@@ -703,30 +732,7 @@ main (int argc, char *argv[])
gdm_wm_screen.height);
gtk_container_add (GTK_CONTAINER (window), canvas);
- if (g_path_is_absolute (GreeterConfTheme))
- {
- theme_file = g_strdup (GreeterConfTheme);
- }
- else
- {
- theme_file = NULL;
- if (DOING_GDM_DEVELOPMENT)
- {
- theme_file = g_build_filename ("themes",
- GreeterConfTheme,
- NULL);
- if (access (theme_file, F_OK) != 0)
- {
- g_free (theme_file);
- theme_file = NULL;
- }
- }
- if (theme_file == NULL)
- theme_file = g_build_filename (GREETERTHEMEDIR,
- GreeterConfTheme,
- NULL);
- }
-
+ theme_file = get_theme_file (GreeterConfTheme);
theme_dir = g_path_get_dirname (theme_file);
error = NULL;
@@ -736,8 +742,64 @@ main (int argc, char *argv[])
gdm_wm_screen.height,
&error);
+ /* Try circles.xml */
if (root == NULL)
- g_warning ("Failed to parse file: %s!", error->message);
+ {
+ g_free (theme_file);
+ g_free (theme_dir);
+ theme_file = get_theme_file (GreeterConfTheme);
+ theme_dir = g_path_get_dirname (theme_file);
+
+ root = greeter_parse (theme_file, theme_dir,
+ GNOME_CANVAS (canvas),
+ gdm_wm_screen.width,
+ gdm_wm_screen.height,
+ NULL);
+ }
+
+
+ if (root == NULL)
+ {
+ GtkWidget *dialog;
+
+ gdm_wm_init (0);
+ gdm_wm_focus_new_windows (TRUE);
+
+ dialog = gtk_message_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("There was an error loading the "
+ "theme, and the default theme "
+ "also could not have been loaded, "
+ "I will attempt to start the "
+ "standard greeter"));
+
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ execl (EXPANDED_BINDIR "/gdmlogin", EXPANDED_BINDIR "/gdmlogin", NULL);
+ execlp ("gdmlogin", "gdmlogin", NULL);
+
+ dialog = gtk_message_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("I could not start the standard "
+ "greeter. This display will abort "
+ "and you may have to login another "
+ "way and fix the installation of "
+ "gdm"));
+
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ _exit (DISPLAY_ABORT);
+ }
greeter_layout (root, GNOME_CANVAS (canvas));
@@ -748,79 +810,83 @@ main (int argc, char *argv[])
gtk_widget_show_now (window);
/* can it ever happen that it'd be NULL here ??? */
- if (window->window != NULL) {
- gdm_wm_init (GDK_WINDOW_XWINDOW (window->window));
+ if (window->window != NULL)
+ {
+ gdm_wm_init (GDK_WINDOW_XWINDOW (window->window));
- /* Run the focus, note that this will work no matter what
- * since gdm_wm_init will set the display to the gdk one
- * if it fails */
- gdm_wm_focus_window (GDK_WINDOW_XWINDOW (window->window));
- }
+ /* Run the focus, note that this will work no matter what
+ * since gdm_wm_init will set the display to the gdk one
+ * if it fails */
+ gdm_wm_focus_window (GDK_WINDOW_XWINDOW (window->window));
+ }
- if (session_dir_whacked_out) {
- GtkWidget *dialog;
+ if (session_dir_whacked_out)
+ {
+ GtkWidget *dialog;
- gdm_wm_focus_new_windows (TRUE);
+ gdm_wm_focus_new_windows (TRUE);
- dialog = gtk_message_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Your session directory is missing or empty!\n\n"
- "There are two available sessions you can use, but\n"
- "you should log in and correct the gdm configuration."));
- gtk_widget_show_all (dialog);
- gdm_wm_center_window (GTK_WINDOW (dialog));
+ dialog = gtk_message_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Your session directory is missing or empty!\n\n"
+ "There are two available sessions you can use, but\n"
+ "you should log in and correct the gdm configuration."));
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
- gdm_wm_no_login_focus_push ();
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- gdm_wm_no_login_focus_pop ();
- }
+ gdm_wm_no_login_focus_push ();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop ();
+ }
- if (g_getenv ("GDM_WHACKED_GREETER_CONFIG") != NULL) {
- GtkWidget *dialog;
+ if (g_getenv ("GDM_WHACKED_GREETER_CONFIG") != NULL)
+ {
+ GtkWidget *dialog;
- gdm_wm_focus_new_windows (TRUE);
+ gdm_wm_focus_new_windows (TRUE);
- dialog = gtk_message_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("The configuration file contains an invalid command\n"
- "line for the login dialog, and thus I ran the\n"
- "default command. Please fix your configuration."));
- gtk_widget_show_all (dialog);
- gdm_wm_center_window (GTK_WINDOW (dialog));
+ dialog = gtk_message_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("The configuration file contains an invalid command\n"
+ "line for the login dialog, and thus I ran the\n"
+ "default command. Please fix your configuration."));
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
- gdm_wm_no_login_focus_push ();
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- gdm_wm_no_login_focus_pop ();
+ gdm_wm_no_login_focus_push ();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop ();
}
/* There was no config file */
- if (used_defaults) {
- GtkWidget *dialog;
-
- gdm_wm_focus_new_windows (TRUE);
-
- dialog = gtk_message_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("The configuration was not found. GDM is using\n"
- "defaults to run this session. You should log in\n"
- "and create a configuration file with the GDM\n"
- "configuration program."));
- gtk_widget_show_all (dialog);
- gdm_wm_center_window (GTK_WINDOW (dialog));
-
- gdm_wm_no_login_focus_push ();
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- gdm_wm_no_login_focus_pop ();
- }
+ if (used_defaults)
+ {
+ GtkWidget *dialog;
+
+ gdm_wm_focus_new_windows (TRUE);
+
+ dialog = gtk_message_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("The configuration was not found. GDM is using\n"
+ "defaults to run this session. You should log in\n"
+ "and create a configuration file with the GDM\n"
+ "configuration program."));
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ gdm_wm_no_login_focus_push ();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop ();
+ }
gtk_main ();
diff --git a/gui/greeter/greeter.dtd b/gui/greeter/greeter.dtd
index efb6c915..f2689e5a 100644
--- a/gui/greeter/greeter.dtd
+++ b/gui/greeter/greeter.dtd
@@ -1,4 +1,5 @@
<!-- dtd for greeter -->
+<!-- FIXME: this doesn't seem up to date -- George -->
<!ENTITY % colorattrs
"file CDATA #IMPLIED
@@ -8,10 +9,11 @@
>
<!ELEMENT greeter (item+)>
-<!ELEMENT item (pos,normal?,active?,prelight?,children?)>
+<!ELEMENT item (pos,normal?,active?,prelight?,children?,show?,text?)>
<!ELEMENT children (item+)>
<!ELEMENT pos EMPTY>
-<!ELEMENT text EMPTY>
+<!ELEMENT show EMPTY>
+<!ELEMENT text (#PCDATA)>
<!ELEMENT normal EMPTY>
<!ELEMENT active EMPTY>
<!ELEMENT prelight EMPTY>
@@ -38,3 +40,7 @@
<!ATTLIST prelight
%colorattrs;
>
+
+<!ATTLIST show
+ modes CDATA #REQUIRED
+>
diff --git a/gui/greeter/greeter_canvas_item.c b/gui/greeter/greeter_canvas_item.c
index b7af4a18..2c4c9982 100644
--- a/gui/greeter/greeter_canvas_item.c
+++ b/gui/greeter/greeter_canvas_item.c
@@ -102,7 +102,10 @@ greeter_item_create_canvas_item (GreeterItemInfo *item)
if (item->item != NULL)
return;
-
+
+ if ( ! greeter_item_is_visible (item))
+ return;
+
g_assert (item->parent->group_item);
if (item->fixed_children != NULL ||
@@ -205,7 +208,8 @@ greeter_item_create_canvas_item (GreeterItemInfo *item)
if (item->item_type == GREETER_ITEM_TYPE_RECT ||
item->item_type == GREETER_ITEM_TYPE_SVG ||
- item->item_type == GREETER_ITEM_TYPE_PIXMAP)
+ item->item_type == GREETER_ITEM_TYPE_PIXMAP ||
+ item->item_type == GREETER_ITEM_TYPE_LABEL)
gtk_signal_connect (GTK_OBJECT (item->item), "event",
(GtkSignalFunc) greeter_item_event_handler,
item);
diff --git a/gui/greeter/greeter_events.c b/gui/greeter/greeter_events.c
index b856c146..f34883d7 100644
--- a/gui/greeter/greeter_events.c
+++ b/gui/greeter/greeter_events.c
@@ -12,6 +12,81 @@ struct CallbackInfo {
static GHashTable *callback_hash = NULL;
+static void
+state_run (GreeterItemInfo *info,
+ GreeterItemState old_state)
+{
+ if (info->state != old_state &&
+ info->item != NULL)
+ {
+ if (info->pixbufs[info->state])
+ gnome_canvas_item_set (info->item,
+ "pixbuf", info->pixbufs[info->state],
+ NULL);
+ if (info->have_color[info->state])
+ gnome_canvas_item_set (info->item,
+ "fill_color_rgba", info->colors[info->state],
+ NULL);
+ if (info->fonts[info->state])
+ gnome_canvas_item_set (info->item,
+ "font_desc", info->fonts[info->state],
+ NULL);
+ }
+}
+
+static void propagate_state (GreeterItemInfo *info,
+ GreeterItemState old_state);
+
+static void
+propagate_state_foreach (gpointer data, gpointer user_data)
+{
+ GreeterItemInfo *info = data;
+ GreeterItemState state = GPOINTER_TO_INT (user_data);
+ GreeterItemState old_state;
+
+ old_state = info->state;
+ info->state = state;
+
+ propagate_state (info, old_state);
+}
+
+static void
+propagate_state (GreeterItemInfo *info,
+ GreeterItemState old_state)
+{
+ state_run (info, old_state);
+
+ g_list_foreach (info->fixed_children, propagate_state_foreach,
+ GINT_TO_POINTER (info->state));
+ g_list_foreach (info->box_children, propagate_state_foreach,
+ GINT_TO_POINTER (info->state));
+}
+
+static void propagate_reset_state (GreeterItemInfo *info,
+ GreeterItemState old_state);
+
+static void
+propagate_reset_state_foreach (gpointer data, gpointer user_data)
+{
+ GreeterItemInfo *info = data;
+ GreeterItemState old_state;
+
+ old_state = info->state;
+ info->state = info->base_state;
+
+ propagate_state (info, old_state);
+}
+
+static void
+propagate_reset_state (GreeterItemInfo *info,
+ GreeterItemState old_state)
+{
+ state_run (info, old_state);
+
+ g_list_foreach (info->fixed_children, propagate_reset_state_foreach, NULL);
+ g_list_foreach (info->box_children, propagate_reset_state_foreach, NULL);
+}
+
gint
greeter_item_event_handler (GnomeCanvasItem *item,
GdkEvent *event,
@@ -19,8 +94,21 @@ greeter_item_event_handler (GnomeCanvasItem *item,
{
GreeterItemState old_state;
GreeterItemInfo *info;
+ GreeterItemInfo *button;
info = data;
+ button = greeter_item_find_my_button (info);
+ if (button != NULL && button != info)
+ {
+ /* FIXME: this is a hack, we have not really left the container,
+ * but the container gets a stupid leave event and
+ * we send it an enter event back, it does two event propagations
+ * one of them is pointless. */
+ /* if this is a button, fake an event on the button */
+ return greeter_item_event_handler (button->item,
+ event,
+ button);
+ }
old_state = info->state;
@@ -65,17 +153,19 @@ greeter_item_event_handler (GnomeCanvasItem *item,
else
info->state = GREETER_ITEM_STATE_NORMAL;
-
+ info->base_state = info->state;
+
if (info->state != old_state)
{
- if (info->pixbufs[info->state])
- gnome_canvas_item_set (item,
- "pixbuf", info->pixbufs[info->state],
- NULL);
- if (info->have_color[info->state])
- gnome_canvas_item_set (item,
- "fill_color_rgba", info->colors[info->state],
- NULL);
+ if (info->button)
+ {
+ if (info->state == GREETER_ITEM_STATE_NORMAL)
+ propagate_reset_state (info, old_state);
+ else
+ propagate_state (info, old_state);
+ }
+ else
+ state_run (info, old_state);
}
return FALSE;
diff --git a/gui/greeter/greeter_geometry.c b/gui/greeter/greeter_geometry.c
index 9cfb02b7..3fde5464 100644
--- a/gui/greeter/greeter_geometry.c
+++ b/gui/greeter/greeter_geometry.c
@@ -25,6 +25,9 @@ greeter_item_size_allocate (GreeterItemInfo *item,
{
item->allocation = *allocation;
+ if ( ! greeter_item_is_visible (item))
+ return;
+
if (item->item == NULL)
greeter_item_create_canvas_item (item);
@@ -79,6 +82,8 @@ fixup_from_anchor (GtkAllocation *rect,
rect->x -= rect->width;
rect->y -= rect->height;
break;
+ default:
+ break;
}
}
@@ -98,7 +103,11 @@ greeter_size_allocate_fixed (GreeterItemInfo *fixed,
while (l != NULL)
{
child = l->data;
-
+ l = l->next;
+
+ if ( ! greeter_item_is_visible (child))
+ continue;
+
greeter_item_size_request (child,
&requisition,
fixed->allocation.width,
@@ -127,8 +136,6 @@ greeter_size_allocate_fixed (GreeterItemInfo *fixed,
greeter_item_size_allocate (child,
&child_allocation,
canvas);
-
- l = l->next;
}
}
@@ -162,9 +169,12 @@ greeter_size_allocate_box (GreeterItemInfo *box,
child = children->data;
children = children->next;
- nvis_children += 1;
- if (child->expand)
- nexpand_children += 1;
+ if (greeter_item_is_visible (child))
+ {
+ nvis_children += 1;
+ if (child->expand)
+ nexpand_children += 1;
+ }
}
if (nvis_children > 0)
@@ -221,6 +231,9 @@ greeter_size_allocate_box (GreeterItemInfo *box,
child = children->data;
children = children->next;
+ if ( ! greeter_item_is_visible (child))
+ continue;
+
if (box->box_homogeneous)
{
if (nvis_children == 1)
@@ -324,6 +337,9 @@ greeter_size_request_box (GreeterItemInfo *box,
child = children->data;
children = children->next;
+ if ( ! greeter_item_is_visible (child))
+ continue;
+
greeter_item_size_request (child,
&child_requisition,
0, 0, canvas);
@@ -433,7 +449,7 @@ greeter_item_size_request (GreeterItemInfo *item,
req->width = x2 - x1;
req->height = y2 - y1;
- gtk_object_destroy (canvas_item);
+ gtk_object_destroy (GTK_OBJECT (canvas_item));
g_free (text);
}
diff --git a/gui/greeter/greeter_item.c b/gui/greeter/greeter_item.c
index c248122b..bf89eb2d 100644
--- a/gui/greeter/greeter_item.c
+++ b/gui/greeter/greeter_item.c
@@ -35,6 +35,11 @@ greeter_item_info_new (GreeterItemInfo *parent,
info->box_orientation = GTK_ORIENTATION_VERTICAL;
info->state = GREETER_ITEM_STATE_NORMAL;
+ info->base_state = GREETER_ITEM_STATE_NORMAL;
+
+ info->show_modes = GREETER_ITEM_SHOW_EVERYWHERE;
+
+ info->button = FALSE;
return info;
}
@@ -72,22 +77,25 @@ greeter_item_update_text (GreeterItemInfo *info)
}
-static void
-get_clock (char *str, int str_len)
+static char *
+get_clock (void)
{
+ char str[256];
struct tm *the_tm;
time_t the_time;
time (&the_time);
the_tm = localtime (&the_time);
- if (strftime (str, str_len, "%a %b %d, %I:%M %p", the_tm) == 0) {
+ if (strftime (str, sizeof (str)-1, _("%a %b %d, %I:%M %p"), the_tm) == 0) {
/* according to docs, if the string does not fit, the
* contents of str are undefined, thus just use
* ??? */
strcpy (str, "???");
}
- str [str_len-1] = '\0'; /* just for sanity */
+ str [sizeof (str)-1] = '\0'; /* just for sanity */
+
+ return g_locale_to_utf8 (str, -1, NULL, NULL, NULL);
}
@@ -97,6 +105,7 @@ greeter_item_expand_text (const char *text)
GString *str;
const char *p;
const char *q;
+ char *clock;
int r;
char buf[256];
@@ -129,8 +138,9 @@ greeter_item_expand_text (const char *text)
g_string_append (str, buf);
break;
case 'c':
- get_clock (buf, sizeof(buf));
- g_string_append (str, buf);
+ clock = get_clock ();
+ g_string_append (str, clock);
+ g_free (clock);
break;
case 0:
g_warning ("Unescape %% at end of text\n");
@@ -161,3 +171,56 @@ greeter_item_expand_text (const char *text)
return g_string_free (str, FALSE);
}
+
+gboolean
+greeter_item_is_visible (GreeterItemInfo *info)
+{
+ static gboolean checked = FALSE;
+ static gboolean GDM_IS_LOCAL = FALSE;
+ static gboolean GDM_FLEXI_SERVER = FALSE;
+ static gboolean GDM_TIMED_LOGIN_OK = FALSE;
+
+ if ( ! checked)
+ {
+ if (g_getenv ("GDM_IS_LOCAL") != NULL)
+ GDM_IS_LOCAL = TRUE;
+ if (g_getenv ("GDM_FLEXI_SERVER") != NULL)
+ GDM_FLEXI_SERVER = TRUE;
+ if (g_getenv ("GDM_TIMED_LOGIN_OK") != NULL)
+ GDM_TIMED_LOGIN_OK = TRUE;
+ }
+
+ if (GDM_IS_LOCAL && ! GDM_FLEXI_SERVER &&
+ ! (info->show_modes & GREETER_ITEM_SHOW_CONSOLE_FIXED))
+ return FALSE;
+ if (GDM_IS_LOCAL && GDM_FLEXI_SERVER &&
+ ! (info->show_modes & GREETER_ITEM_SHOW_CONSOLE_FLEXI))
+ return FALSE;
+ if ( ! GDM_IS_LOCAL && GDM_FLEXI_SERVER &&
+ ! (info->show_modes & GREETER_ITEM_SHOW_REMOTE_FLEXI))
+ return FALSE;
+ if ( ! GDM_IS_LOCAL && ! GDM_FLEXI_SERVER &&
+ ! (info->show_modes & GREETER_ITEM_SHOW_REMOTE))
+ return FALSE;
+
+ /* FIXME: this is somewhat evil, maybe it should be part of the show
+ * modes */
+ if ( ! GDM_TIMED_LOGIN_OK && info->id != NULL)
+ {
+ if (strncmp (info->id, "timed_login", strlen ("timed_login")) == 0)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+GreeterItemInfo *
+greeter_item_find_my_button (GreeterItemInfo *info)
+{
+ if (info == NULL)
+ return NULL;
+ else if (info->button)
+ return info;
+ else
+ return greeter_item_find_my_button (info->parent);
+}
diff --git a/gui/greeter/greeter_item.h b/gui/greeter/greeter_item.h
index 350d8015..29c46ef4 100644
--- a/gui/greeter/greeter_item.h
+++ b/gui/greeter/greeter_item.h
@@ -8,6 +8,7 @@ typedef enum _GreeterItemState GreeterItemState;
typedef enum _GreeterItemType GreeterItemType;
typedef enum _GreeterItemSizeType GreeterItemSizeType;
typedef enum _GreeterItemPosType GreeterItemPosType;
+typedef enum _GreeterItemShowModes GreeterItemShowModes;
enum _GreeterItemState {
GREETER_ITEM_STATE_NORMAL,
@@ -37,6 +38,17 @@ enum _GreeterItemPosType {
GREETER_ITEM_POS_RELATIVE,
};
+enum _GreeterItemShowModes {
+ GREETER_ITEM_SHOW_EVERYWHERE = 0xffff,
+ GREETER_ITEM_SHOW_NOWHERE = 0,
+ GREETER_ITEM_SHOW_CONSOLE_FIXED = 1<<0,
+ GREETER_ITEM_SHOW_CONSOLE = (1<<0) | (1<<1),
+ GREETER_ITEM_SHOW_CONSOLE_FLEXI = 1<<1,
+ GREETER_ITEM_SHOW_REMOTE_FLEXI = 1<<2,
+ GREETER_ITEM_SHOW_FLEXI = (1<<1) | (1<<2),
+ GREETER_ITEM_SHOW_REMOTE = 1<<3
+};
+
struct _GreeterItemInfo {
GreeterItemInfo *parent;
@@ -45,6 +57,8 @@ struct _GreeterItemInfo {
GreeterItemPosType y_type;
double x;
double y;
+
+ GreeterItemShowModes show_modes;
GreeterItemSizeType width_type;
GreeterItemSizeType height_type;
@@ -56,6 +70,9 @@ struct _GreeterItemInfo {
char *id;
+ /* Button can propagate states and collect states from underlying items */
+ gboolean button;
+
GreeterItemType item_type;
char *files[GREETER_ITEM_STATE_MAX];
@@ -85,6 +102,7 @@ struct _GreeterItemInfo {
/* Runtime state: */
GreeterItemState state;
+ GreeterItemState base_state;
gboolean mouse_down;
gboolean mouse_over;
@@ -110,4 +128,7 @@ char *greeter_item_expand_text (const char *text);
void greeter_item_update_text (GreeterItemInfo *info);
+gboolean greeter_item_is_visible (GreeterItemInfo *info);
+GreeterItemInfo *greeter_item_find_my_button (GreeterItemInfo *info);
+
#endif /* __GREETER_ITEMS_H__ */
diff --git a/gui/greeter/greeter_item_capslock.c b/gui/greeter/greeter_item_capslock.c
index 9e707afb..b3ecf912 100644
--- a/gui/greeter/greeter_item_capslock.c
+++ b/gui/greeter/greeter_item_capslock.c
@@ -26,6 +26,7 @@ static void
capslock_update (gboolean new_state)
{
GreeterItemInfo *info;
+ GnomeCanvasItem *item;
caps_lock_state = new_state;
@@ -33,10 +34,19 @@ capslock_update (gboolean new_state)
if (info)
{
+ if (info->group_item != NULL)
+ item = GNOME_CANVAS_ITEM (info->group_item);
+ else
+ item = info->item;
+
if (caps_lock_state)
- gnome_canvas_item_show (GNOME_CANVAS_ITEM (info->group_item));
+ {
+ gnome_canvas_item_show (item);
+ }
else
- gnome_canvas_item_hide (GNOME_CANVAS_ITEM (info->group_item));
+ {
+ gnome_canvas_item_hide (item);
+ }
}
}
diff --git a/gui/greeter/greeter_parser.c b/gui/greeter/greeter_parser.c
index 33597758..cbcbb817 100644
--- a/gui/greeter/greeter_parser.c
+++ b/gui/greeter/greeter_parser.c
@@ -60,6 +60,38 @@ parse_id (xmlNodePtr node,
}
}
+static gboolean
+parse_button (xmlNodePtr node,
+ GreeterItemInfo *info,
+ GError **error)
+{
+ xmlChar *prop;
+
+ prop = xmlGetProp (node, "button");
+ if (prop)
+ {
+ if (strcmp (prop, "true") == 0)
+ {
+ info->button = TRUE;
+ }
+ else if (strcmp (prop, "false") == 0)
+ {
+ info->button = FALSE;
+ }
+ else
+ {
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad button spec %s\n", prop);
+ xmlFree (prop);
+ return FALSE;
+ }
+ xmlFree (prop);
+ }
+ return TRUE;
+}
+
/* Doesn't set the parts of rect that are not specified.
* If you want specific default values you need to fill them out
* in rect first
@@ -97,9 +129,11 @@ parse_pos (xmlNodePtr node,
info->anchor = GTK_ANCHOR_SE;
else
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Unknown anchor type %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Unknown anchor type %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -113,9 +147,11 @@ parse_pos (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad position specifier%s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad position specifier%s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -133,9 +169,11 @@ parse_pos (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad position specifier%s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad position specifier%s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -157,9 +195,11 @@ parse_pos (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad size specifier%s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad size specifier%s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -182,9 +222,11 @@ parse_pos (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad size specifier%s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad size specifier%s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -209,9 +251,11 @@ parse_pos (xmlNodePtr node,
}
else
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "bad expand spec %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad expand spec %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -222,6 +266,76 @@ parse_pos (xmlNodePtr node,
}
static gboolean
+parse_show (xmlNodePtr node,
+ GreeterItemInfo *info,
+ GError **error)
+{
+ xmlChar *prop;
+ char **argv = NULL;
+ int i;
+
+ prop = xmlGetProp (node, "modes");
+ if (prop != NULL)
+ {
+ if (strcmp (prop, "everywhere") == 0)
+ {
+ info->show_modes = GREETER_ITEM_SHOW_EVERYWHERE;
+ xmlFree (prop);
+ return TRUE;
+ }
+ else if (strcmp (prop, "nowhere") == 0)
+ {
+ info->show_modes = GREETER_ITEM_SHOW_NOWHERE;
+ xmlFree (prop);
+ return TRUE;
+ }
+
+ argv = g_strsplit (prop, ",", 0);
+ xmlFree (prop);
+ }
+ else
+ {
+ info->show_modes = GREETER_ITEM_SHOW_EVERYWHERE;
+ return TRUE;
+ }
+
+ info->show_modes = GREETER_ITEM_SHOW_NOWHERE;
+
+ if (argv != NULL)
+ {
+ for (i = 0; argv[i] != NULL; i++)
+ {
+ if (strcmp (argv[i], "console") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_CONSOLE;
+ }
+ else if (strcmp (argv[i], "console-fixed") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_CONSOLE_FIXED;
+ }
+ else if (strcmp (argv[i], "console-flexi") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_CONSOLE_FLEXI;
+ }
+ else if (strcmp (argv[i], "remote-flexi") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_REMOTE_FLEXI;
+ }
+ else if (strcmp (argv[i], "flexi") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_FLEXI;
+ }
+ else if (strcmp (argv[i], "remote") == 0)
+ {
+ info->show_modes |= GREETER_ITEM_SHOW_REMOTE;
+ }
+ }
+ g_strfreev (argv);
+ }
+ return TRUE;
+}
+
+static gboolean
parse_fixed (xmlNodePtr node,
GreeterItemInfo *info,
GError **error)
@@ -253,9 +367,11 @@ parse_box (xmlNodePtr node,
}
else
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "bad orientation %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad orientation %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -275,9 +391,11 @@ parse_box (xmlNodePtr node,
}
else
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "bad homogenous spec %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad homogenous spec %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
@@ -292,9 +410,11 @@ parse_box (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad padding specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad padding specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -307,9 +427,11 @@ parse_box (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad padding specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad padding specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -322,9 +444,11 @@ parse_box (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad min-width specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad min-width specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -337,9 +461,11 @@ parse_box (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad min-height specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad min-height specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -352,9 +478,11 @@ parse_box (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad spacing specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad spacing specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -377,16 +505,18 @@ parse_color (const char *str,
int i;
if (str[0] != '#')
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "colors must start with #, %s is an invalid color\n", str);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "colors must start with #, %s is an invalid color\n", str);
return FALSE;
}
if (strlen (str) != 7)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Colors must be on the format #xxxxxx, %s is an invalid color\n", str);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Colors must be on the format #xxxxxx, %s is an invalid color\n", str);
return FALSE;
}
@@ -438,9 +568,11 @@ parse_state_file (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad alpha specifier format %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad alpha specifier format %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -474,9 +606,11 @@ parse_state_color (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad alpha specifier format %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad alpha specifier format %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -528,15 +662,21 @@ parse_pixmap (xmlNodePtr node,
if (!parse_box (child, info, error))
return FALSE;
}
+ else if (strcmp (child->name, "show") == 0)
+ {
+ if (!parse_show (child, info, error))
+ return FALSE;
+ }
child = child->next;
}
if (!info->files[GREETER_ITEM_STATE_NORMAL])
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "No filename specified for normal state\n");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "No filename specified for normal state\n");
return FALSE;
}
@@ -601,6 +741,11 @@ parse_rect (xmlNodePtr node,
if (!parse_box (child, info, error))
return FALSE;
}
+ else if (strcmp (child->name, "show") == 0)
+ {
+ if (!parse_show (child, info, error))
+ return FALSE;
+ }
child = child->next;
}
@@ -637,9 +782,11 @@ parse_state_text (xmlNodePtr node,
info->fonts[state] = pango_font_description_from_string (prop);
if (info->fonts[state] == NULL)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad font specification %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad font specification %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -661,9 +808,11 @@ parse_state_text (xmlNodePtr node,
if ((char *)prop == p)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad alpha specifier format %s\n", prop);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad alpha specifier format %s\n", prop);
+ xmlFree (prop);
return FALSE;
}
xmlFree (prop);
@@ -695,6 +844,7 @@ parse_translated_text (xmlNodePtr node,
gint *translation_score,
GError **error)
{
+ xmlChar *text;
xmlChar *prop;
gint score;
@@ -709,21 +859,22 @@ parse_translated_text (xmlNodePtr node,
if (score >= *translation_score)
return TRUE;
- prop = xmlGetProp (node, "val");
- if (prop == NULL)
+ text = xmlNodeGetContent (node);
+ if (text == NULL)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "No string defined for text node\n");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "No string defined for text node\n");
return FALSE;
}
*translation_score = score;
if (*translated_text)
g_free (*translated_text);
- *translated_text = g_strdup (prop);
+ *translated_text = g_strdup (text);
- xmlFree (prop);
+ xmlFree (text);
return TRUE;
}
@@ -765,12 +916,18 @@ parse_label (xmlNodePtr node,
if (!parse_translated_text (child, &translated_text, &translation_score, error))
return FALSE;
}
+ else if (strcmp (child->name, "show") == 0)
+ {
+ if (!parse_show (child, info, error))
+ return FALSE;
+ }
else if (strcmp (child->name, "fixed") == 0 ||
- strcmp (child->name, "boxed") == 0)
+ strcmp (child->name, "box") == 0)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "label items cannot have children");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "label items cannot have children");
return FALSE;
}
@@ -779,9 +936,10 @@ parse_label (xmlNodePtr node,
if (translated_text == NULL)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "A label must specify the text attribute");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "A label must specify the text attribute");
}
for (i = 0; i < GREETER_ITEM_STATE_MAX; i++)
@@ -820,12 +978,18 @@ parse_entry (xmlNodePtr node,
if (!parse_pos (child, info, error))
return FALSE;
}
+ else if (strcmp (child->name, "show") == 0)
+ {
+ if (!parse_show (child, info, error))
+ return FALSE;
+ }
else if (strcmp (child->name, "fixed") == 0 ||
- strcmp (child->name, "boxed") == 0)
+ strcmp (child->name, "box") == 0)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "entry items cannot have children");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "entry items cannot have children");
return FALSE;
}
@@ -857,18 +1021,20 @@ parse_items (xmlNodePtr node,
{
if (strcmp (child->name, "item") != 0)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "found tag %s when looking for item", child->name);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "found tag %s when looking for item", child->name);
return FALSE;
}
type = xmlGetProp (child, "type");
if (!type)
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "items must specify their type");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "items must specify their type");
return FALSE;
}
@@ -884,15 +1050,19 @@ parse_items (xmlNodePtr node,
item_type = GREETER_ITEM_TYPE_ENTRY;
else
{
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "unknown item type %s", type);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "unknown item type %s", type);
+ xmlFree (type);
return FALSE;
}
info = greeter_item_info_new (parent, item_type);
parse_id (child, info);
+ if ( ! parse_button (child, info, error))
+ return FALSE;
switch (item_type)
{
@@ -912,9 +1082,10 @@ parse_items (xmlNodePtr node,
res = parse_entry (child, info, error);
break;
default:
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "bad item type");
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad item type");
res = FALSE;
}
@@ -945,7 +1116,7 @@ greeter_info_id_hash (GreeterItemInfo *key)
}
GreeterItemInfo *
-greeter_parse (char *file, char *datadir,
+greeter_parse (const char *file, const char *datadir,
GnomeCanvas *canvas,
int width, int height, GError **error)
{
@@ -955,14 +1126,15 @@ greeter_parse (char *file, char *datadir,
gboolean res;
GList *items;
- file_search_path = datadir;
+ /* FIXME: EVIL! GLOBAL! */
+ file_search_path = g_strdup (datadir);
if (!g_file_test (file, G_FILE_TEST_EXISTS))
{
- if (error)
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_NO_FILE,
- "Can't open file %s", file);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_NO_FILE,
+ "Can't open file %s", file);
return NULL;
}
@@ -970,29 +1142,29 @@ greeter_parse (char *file, char *datadir,
doc = xmlParseFile (file);
if (doc == NULL)
{
- if (error)
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_XML,
- "XML Parse error reading %s", file);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_XML,
+ "XML Parse error reading %s", file);
return NULL;
}
node = xmlDocGetRootElement (doc);
if (node == NULL)
{
- if (error)
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_XML,
- "Can't find the xml root node in file %s", file);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_XML,
+ "Can't find the xml root node in file %s", file);
return NULL;
}
if (strcmp (node->name, "greeter") != 0)
{
- if (error)
- *error = g_error_new (GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_WRONG_TYPE,
- "The file %s has the wrong xml type", file);
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_WRONG_TYPE,
+ "The file %s has the wrong xml type", file);
return NULL;
}
diff --git a/gui/greeter/greeter_parser.h b/gui/greeter/greeter_parser.h
index e6d38043..cb61ec1f 100644
--- a/gui/greeter/greeter_parser.h
+++ b/gui/greeter/greeter_parser.h
@@ -16,8 +16,8 @@ typedef enum
#define GREETER_PARSER_ERROR greeter_parser_error_quark()
GQuark greeter_parser_error_quark (void);
-GreeterItemInfo *greeter_parse (char *file,
- char *data_dir,
+GreeterItemInfo *greeter_parse (const char *file,
+ const char *data_dir,
GnomeCanvas *canvas,
int width,
int height,
diff --git a/gui/greeter/themes/circles/circles.xml b/gui/greeter/themes/circles/circles.xml
index 9a4af8a0..f3547134 100644
--- a/gui/greeter/themes/circles/circles.xml
+++ b/gui/greeter/themes/circles/circles.xml
@@ -13,28 +13,93 @@
<normal color="#ffffff"/>
<pos x="0" y="4" width="100%" height="100%"/>
<box orientation="horizontal" spacing="10" xpadding="10">
- <item type="pixmap" id="language_button">
- <normal file="options.png" tint="#dddddd"/>
- <prelight file="options.png"/>
- <active file="options.png" tint="#ff0000"/>
- <pos y="50%" anchor="w"/>
- </item>
- <item type="label">
- <normal color="#000000" font="Sans 14"/>
- <pos y="50%" anchor="w"/>
- <text val="Option"/>
- </item>
- <item type="pixmap" id="session_button">
- <normal file="help.png" tint="#dddddd"/>
- <prelight file="help.png"/>
- <active file="help.png" tint="#ff0000"/>
- <pos y="50%" anchor="w"/>
- </item>
- <item type="label">
- <normal color="#000000" font="Sans 14"/>
- <pos y="50%" anchor="w"/>
- <text val="Session"/>
- </item>
+ <item type="rect" id="language_button" button="true">
+ <normal color="#ffffff"/>
+ <pos y="50%" anchor="w" width="box" height="box"/>
+ <box orientation="horizontal" spacing="10" xpadding="10">
+ <item type="pixmap">
+ <normal file="options.png" tint="#dddddd"/>
+ <prelight file="options.png"/>
+ <active file="options.png" tint="#ff0000"/>
+ <pos y="50%" anchor="w"/>
+ </item>
+ <item type="label">
+ <normal color="#000000" font="Sans 14"/>
+ <prelight color="#666666" font="Sans 14"/>
+ <active color="#ff0000" font="Sans 14"/>
+ <pos y="50%" anchor="w"/>
+ <text>Option</text>
+ </item>
+ </box>
+ </item>
+ <item type="rect" id="session_button" button="true">
+ <normal color="#ffffff"/>
+ <pos y="50%" anchor="w" width="box" height="box"/>
+ <box orientation="horizontal" spacing="10" xpadding="10">
+ <item type="pixmap">
+ <normal file="help.png" tint="#dddddd"/>
+ <prelight file="help.png"/>
+ <active file="help.png" tint="#ff0000"/>
+ <pos y="50%" anchor="w"/>
+ </item>
+ <item type="label">
+ <normal color="#000000" font="Sans 14"/>
+ <prelight color="#666666" font="Sans 14"/>
+ <active color="#ff0000" font="Sans 14"/>
+ <pos y="50%" anchor="w"/>
+ <text>Session</text>
+ </item>
+ </box>
+ </item>
+ <item type="rect" id="system_button" button="true">
+ <normal color="#ffffff"/>
+ <show modes="console"/>
+ <pos y="50%" anchor="w" width="box" height="box"/>
+ <box orientation="horizontal" spacing="10" xpadding="10">
+ <item type="pixmap">
+ <normal file="options.png" tint="#dddddd"/>
+ <prelight file="options.png"/>
+ <active file="options.png" tint="#ff0000"/>
+ <pos y="50%" anchor="w"/>
+ </item>
+ <item type="label">
+ <normal color="#000000" font="Sans 14"/>
+ <prelight color="#666666" font="Sans 14"/>
+ <active color="#ff0000" font="Sans 14"/>
+ <pos y="50%" anchor="w"/>
+ <text>System</text>
+ </item>
+ </box>
+ </item>
+ <item type="rect" id="disconnect_button" button="true">
+ <normal color="#ffffff"/>
+ <show modes="flexi,remote"/>
+ <pos y="50%" anchor="w" width="box" height="box"/>
+ <box orientation="horizontal" spacing="10" xpadding="10">
+ <item type="pixmap">
+ <normal file="options.png" tint="#dddddd"/>
+ <prelight file="options.png"/>
+ <active file="options.png" tint="#ff0000"/>
+ <pos y="50%" anchor="w"/>
+ </item>
+ <item type="label">
+ <normal color="#000000" font="Sans 14"/>
+ <prelight color="#666666" font="Sans 14"/>
+ <active color="#ff0000" font="Sans 14"/>
+ <pos y="50%" anchor="w"/>
+ <text>Disconnect</text>
+ <show modes="remote"/>
+ </item>
+ <item type="label">
+ <normal color="#000000" font="Sans 14"/>
+ <prelight color="#666666" font="Sans 14"/>
+ <active color="#ff0000" font="Sans 14"/>
+ <pos y="50%" anchor="w"/>
+ <text>Quit</text>
+ <show modes="flexi"/>
+ </item>
+ </box>
+ </item>
</box>
</item>
</fixed>
@@ -46,7 +111,7 @@
<item type="label" id="clock">
<normal color="#000000" font="Sans 16"/>
<pos x="-20" y="-37" anchor="e"/>
- <text val="%c"/>
+ <text>%c</text>
</item>
<item type="rect" id="caps-lock-warning">
@@ -56,7 +121,7 @@
<item type="label">
<normal color="#000000" font="Sans 14"/>
<pos x="66" y="50%" anchor="w"/>
- <text val="You've got capslock on!"/>
+ <text>You've got capslock on!</text>
</item>
</fixed>
</item>
@@ -67,13 +132,13 @@
<item type="label">
<pos anchor="n" x="50%"/>
<normal color="#000000" font="Sans 18"/>
- <text val="Welcome to %h"/>
- <text lang="sv" val="Välkommen till %h"/>
+ <text>Welcome to %h</text>
+ <text lang="sv">Välkommen till %h</text>
</item>
<item type="label" id="pam-prompt">
<pos anchor="nw" x="10%"/>
<normal color="#000000" font="Sans 16"/>
- <text val="Username:"/>
+ <text>Username:</text>
</item>
<item type="rect">
<normal color="#000000"/>
@@ -87,14 +152,14 @@
<item type="label" id="pam-message">
<pos anchor="n" x="50%"/>
<normal color="#000000" font="Sans 16"/>
- <text val=""/>
+ <text></text>
</item>
</box>
<fixed>
<item type="label" id="pam-error">
<pos anchor="n" x="50%" y="110%"/>
<normal color="#000000" font="Sans 16"/>
- <text val=""/>
+ <text></text>
</item>
</fixed>
</item>