summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2006-04-27 02:10:17 +0000
committerBrian Cameron <bcameron@src.gnome.org>2006-04-27 02:10:17 +0000
commit4a8546fcd99afe8b98c94f6d8b2a2db8c64f93b0 (patch)
tree569646e2596659209ce610f66bb03f8266074d75
parent425ce74b5ddfe183ec538642f3f07630bd4dd121 (diff)
downloadgdm-4a8546fcd99afe8b98c94f6d8b2a2db8c64f93b0.tar.gz
Add pam-error-logo item type. Add item type button to use a real GTK+
2006-04-26 Brian Cameron <brian.cameron@sun.com> * gui/greeter_item_pam.c: Add pam-error-logo item type. * gui/greeter/greeter_item.h, gui/greeter/greeter_canvas_item.c, gui/greeter/greeter_geometry, gui/greeter/greeter_parser.c: Add item type button to use a real GTK+ button, this better supports accessibility. Add "startover" string to stock, this better name for the "Cancel" button was recommended. * gui/greeter/themes/happygnome/happygnome.xml, gui/greeter/themes/happygnome/happygnome-list.xml, gui/greeter/themes/circles/circles.xml: Updated theme to use real GTK+ buttons. Now says "Start Over" instead of "Cancel" on the button. * gui/greeter/greeter_events.c, gui/greeter/greeter_item.c: Code cleanup. * docs/gdm/gdm.xml: Add docs for new features and the gtk-theme greeter element feature added in 2.12 but after string-freeze, so docs couldn't be updated then.
-rw-r--r--ChangeLog19
-rw-r--r--docs/C/gdm.xml64
-rw-r--r--docs/es/gdm.xml39
-rw-r--r--docs/uk/gdm.xml39
-rw-r--r--gui/greeter/greeter_canvas_item.c27
-rw-r--r--gui/greeter/greeter_events.c2
-rw-r--r--gui/greeter/greeter_geometry.c34
-rw-r--r--gui/greeter/greeter_item.c3
-rw-r--r--gui/greeter/greeter_item.h11
-rw-r--r--gui/greeter/greeter_item_pam.c37
-rw-r--r--gui/greeter/greeter_parser.c444
-rw-r--r--gui/greeter/themes/circles/circles.xml56
-rw-r--r--gui/greeter/themes/happygnome-list/happygnome.xml56
-rw-r--r--gui/greeter/themes/happygnome/happygnome.xml56
14 files changed, 539 insertions, 348 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c93a202..5fba80c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
2006-04-26 Brian Cameron <brian.cameron@sun.com>
+ * gui/greeter_item_pam.c: Add pam-error-logo item type.
+ * gui/greeter/greeter_item.h, gui/greeter/greeter_canvas_item.c,
+ gui/greeter/greeter_geometry, gui/greeter/greeter_parser.c: Add item
+ type button to use a real GTK+ button, this better supports
+ accessibility. Add "startover" string to stock, this better name
+ for the "Cancel" button was recommended.
+ * gui/greeter/themes/happygnome/happygnome.xml,
+ gui/greeter/themes/happygnome/happygnome-list.xml,
+ gui/greeter/themes/circles/circles.xml: Updated theme to use real
+ GTK+ buttons. Now says "Start Over" instead of "Cancel" on the
+ button.
+ * gui/greeter/greeter_events.c, gui/greeter/greeter_item.c: Code
+ cleanup.
+ * docs/gdm/gdm.xml: Add docs for new features and the gtk-theme
+ greeter element feature added in 2.12 but after string-freeze, so
+ docs couldn't be updated then.
+
+2006-04-26 Brian Cameron <brian.cameron@sun.com>
+
Adding per-display configuration support to GDM. Now if user has
a file named /etc/gdm/custom.conf:<displaynum>, the settings in this
file will override the /usr/share/gdm/defaults.conf and
diff --git a/docs/C/gdm.xml b/docs/C/gdm.xml
index a19870c2..3cb2f72b 100644
--- a/docs/C/gdm.xml
+++ b/docs/C/gdm.xml
@@ -5340,6 +5340,33 @@ tar czvf &lt;theme_name&gt;.tar.gz &lt;theme_name&gt;/
<sect2 id="descofthemeformat">
<title>Detailed Description of Theme XML format</title>
+ <sect3 id="greetertag">
+ <title>greeter tag</title>
+
+ <para>
+ The GDM theme format is specified in XML format contained
+ within a &lt;greeter&gt; tag. You may specify a GTK+ theme to
+ be used with this theme by using the gtk-theme element in the
+ greeter tag as in the following example.
+ </para>
+
+<screen>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;!DOCTYPE greeter SYSTEM "greeter.dtd"&gt;
+&lt;greeter gtk-theme="Crux"&gt;
+[...]
+&lt;/greeter&gt;
+</screen>
+
+ <para>
+ Contained within the greeter tag can be the nodes described
+ in the next sections of this document. Some of these nodes are
+ containers (box nodes, rect item nodes) which can be used to
+ organize how to display the nodes that the user sees and interacts
+ with (such as button, pixmap and entry item nodes).
+ </para>
+ </sect3>
+
<sect3 id="boxnodes">
<title>Box Nodes</title>
@@ -5401,19 +5428,24 @@ homogeneous=&quot;bool&quot;&gt;
<variablelist>
<varlistentry>
- <term>entry</term>
+ <term>button</term>
<listitem>
<para>
- Text entry field.
+ A button field. This field uses a GTK+ button. It is also
+ possible to make a "rect" item act like a button by setting
+ its button element to true. However it is better to use
+ GTK+ buttons in GDM themes since these are accessible to
+ users with disabilities. Also, GTK+ buttons can be
+ themed.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>list</term>
+ <term>entry</term>
<listitem>
<para>
- A list widget.
+ Text entry field.
</para>
</listitem>
</varlistentry>
@@ -5429,6 +5461,16 @@ homogeneous=&quot;bool&quot;&gt;
</varlistentry>
<varlistentry>
+ <term>list</term>
+ <listitem>
+ <para>
+ A face browser widget. Only useful if the face browser is
+ enabled via the configuration.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pixmap</term>
<listitem>
<para>
@@ -5545,6 +5587,17 @@ homogeneous=&quot;bool&quot;&gt;
</varlistentry>
<varlistentry>
+ <term>pam-error-logo</term>
+ <listitem>
+ <para>
+ An image that will be displayed only when a pam-error message
+ is being displayed. This is useful for displaying an
+ &quot;Attention&quot; icon, for example.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pam-message</term>
<listitem>
<para>
@@ -6028,6 +6081,9 @@ homogeneous=&quot;bool&quot;&gt;
<filename>session</filename>, _(&quot;_Session&quot;
</para>
<para>
+ <filename>startover</filename>, _(&quot;_Start Over&quot;
+ </para>
+ <para>
<filename>suspend</filename>, _(&quot;Sus_pend&quot;
</para>
<para>
diff --git a/docs/es/gdm.xml b/docs/es/gdm.xml
index abdb82aa..e571b67e 100644
--- a/docs/es/gdm.xml
+++ b/docs/es/gdm.xml
@@ -2869,6 +2869,22 @@ tar czvf &lt;theme_name&gt;.tar.gz &lt;theme_name&gt;/
<sect2 id="descofthemeformat">
<title>Detailed Description of Theme XML format</title>
+ <sect3 id="greetertag">
+ <title>greeter tag</title>
+
+ <para>The GDM theme format is specified in XML format contained within a &lt;greeter&gt; tag. You may specify a GTK+ theme to be used with this theme by using the gtk-theme element in the greeter tag as in the following example.</para>
+
+<screen>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;!DOCTYPE greeter SYSTEM "greeter.dtd"&gt;
+&lt;greeter gtk-theme="Crux"&gt;
+[...]
+&lt;/greeter&gt;
+</screen>
+
+ <para>Contained within the greeter tag can be the nodes described in the next sections of this document. Some of these nodes are containers (box nodes, rect item nodes) which can be used to organize how to display the nodes that the user sees and interacts with (such as button, pixmap and entry item nodes).</para>
+ </sect3>
+
<sect3 id="boxnodes">
<title>Nodos contenedores.</title>
@@ -2900,16 +2916,16 @@ homogeneous="bool"&gt;
<variablelist>
<varlistentry>
- <term>entry</term>
+ <term>button</term>
<listitem>
- <para>Campo de entrada de texto.</para>
+ <para>A button field. This field uses a GTK+ button. It is also possible to make a "rect" item act like a button by setting its button element to true. However it is better to use GTK+ buttons in GDM themes since these are accessible to users with disabilities. Also, GTK+ buttons can be themed.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>list</term>
+ <term>entry</term>
<listitem>
- <para>Un widget de lista</para>
+ <para>Campo de entrada de texto.</para>
</listitem>
</varlistentry>
@@ -2921,6 +2937,13 @@ homogeneous="bool"&gt;
</varlistentry>
<varlistentry>
+ <term>list</term>
+ <listitem>
+ <para>A face browser widget. Only useful if the face browser is enabled via the configuration.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pixmap</term>
<listitem>
<para>Una imagen pixmap en un formato que gdk-pixbuf soporte como PNG, JPEG, Tiff, etc...)</para>
@@ -2996,6 +3019,13 @@ homogeneous="bool"&gt;
</varlistentry>
<varlistentry>
+ <term>pam-error-logo</term>
+ <listitem>
+ <para>An image that will be displayed only when a pam-error message is being displayed. This is useful for displaying an "Attention" icon, for example.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pam-message</term>
<listitem>
<para>Label that displays the PAM message. These are messages that PAM/GDM gives about state of the account, help about the prompts and other information.</para>
@@ -3233,6 +3263,7 @@ homogeneous="bool"&gt;
<para><filename>quit</filename>, _("_Salir"</para>
<para><filename>reboot</filename>, _("_Reiniciar"</para>
<para><filename>session</filename>, _("_Sesión"</para>
+ <para><filename>startover</filename>, _("_Start Over"</para>
<para><filename>suspend</filename>, _("Sus_pender"</para>
<para><filename>system</filename>, _("_Acciones" (Anteriormente "S_istema"</para>
<para><filename>timed-label</filename>, _("El usuario %u entrará en %t"</para>
diff --git a/docs/uk/gdm.xml b/docs/uk/gdm.xml
index 5e528337..6deeaab9 100644
--- a/docs/uk/gdm.xml
+++ b/docs/uk/gdm.xml
@@ -2867,6 +2867,22 @@ tar czvf &lt;theme_name&gt;.tar.gz &lt;theme_name&gt;/
<sect2 id="descofthemeformat">
<title>Докладний опис XML формату тем</title>
+ <sect3 id="greetertag">
+ <title>greeter tag</title>
+
+ <para>The GDM theme format is specified in XML format contained within a &lt;greeter&gt; tag. You may specify a GTK+ theme to be used with this theme by using the gtk-theme element in the greeter tag as in the following example.</para>
+
+<screen>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;!DOCTYPE greeter SYSTEM "greeter.dtd"&gt;
+&lt;greeter gtk-theme="Crux"&gt;
+[...]
+&lt;/greeter&gt;
+</screen>
+
+ <para>Contained within the greeter tag can be the nodes described in the next sections of this document. Some of these nodes are containers (box nodes, rect item nodes) which can be used to organize how to display the nodes that the user sees and interacts with (such as button, pixmap and entry item nodes).</para>
+ </sect3>
+
<sect3 id="boxnodes">
<title>Box Nodes</title>
@@ -2898,16 +2914,16 @@ homogeneous="bool"&gt;
<variablelist>
<varlistentry>
- <term>entry</term>
+ <term>button</term>
<listitem>
- <para>Поле вводу тексту.</para>
+ <para>A button field. This field uses a GTK+ button. It is also possible to make a "rect" item act like a button by setting its button element to true. However it is better to use GTK+ buttons in GDM themes since these are accessible to users with disabilities. Also, GTK+ buttons can be themed.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>list</term>
+ <term>entry</term>
<listitem>
- <para>Віджет списку.</para>
+ <para>Поле вводу тексту.</para>
</listitem>
</varlistentry>
@@ -2919,6 +2935,13 @@ homogeneous="bool"&gt;
</varlistentry>
<varlistentry>
+ <term>list</term>
+ <listitem>
+ <para>A face browser widget. Only useful if the face browser is enabled via the configuration.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pixmap</term>
<listitem>
<para>Растрове зображення у форматі, який підтримує gdk-pixbuf. Наприклад, PNG, JPEG, Tiff, etc...)</para>
@@ -2994,6 +3017,13 @@ homogeneous="bool"&gt;
</varlistentry>
<varlistentry>
+ <term>pam-error-logo</term>
+ <listitem>
+ <para>An image that will be displayed only when a pam-error message is being displayed. This is useful for displaying an "Attention" icon, for example.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>pam-message</term>
<listitem>
<para>Label that displays the PAM message. These are messages that PAM/GDM gives about state of the account, help about the prompts and other information.</para>
@@ -3231,6 +3261,7 @@ homogeneous="bool"&gt;
<para><filename>quit</filename>, _("_Quit"</para>
<para><filename>reboot</filename>, _("_Restart"</para>
<para><filename>session</filename>, _("_Session"</para>
+ <para><filename>startover</filename>, _("_Start Over"</para>
<para><filename>suspend</filename>, _("Sus_pend"</para>
<para><filename>system</filename>, _("_Actions" (Formerly "S_ystem"</para>
<para><filename>timed-label</filename>, _("User %u will login in %t"</para>
diff --git a/gui/greeter/greeter_canvas_item.c b/gui/greeter/greeter_canvas_item.c
index c2d109a2..16f72c69 100644
--- a/gui/greeter/greeter_canvas_item.c
+++ b/gui/greeter/greeter_canvas_item.c
@@ -228,11 +228,18 @@ greeter_options_handler (GreeterItemInfo *item, GtkWidget *menubar)
}
void
+greeter_item_run_button_action_callback (GtkButton *button, const char *id)
+{
+ greeter_item_run_action_callback (id);
+}
+
+void
greeter_item_create_canvas_item (GreeterItemInfo *item)
{
GnomeCanvasGroup *group;
GtkJustification just;
GtkWidget *entry;
+ GtkWidget *gtkbutton;
GtkWidget *list;
GtkWidget *swin;
double x1, y1, x2, y2;
@@ -393,14 +400,34 @@ greeter_item_create_canvas_item (GreeterItemInfo *item)
break;
+ case GREETER_ITEM_TYPE_BUTTON:
+ gtkbutton = gtk_button_new_with_mnemonic (item->data.text.orig_text);
+ gtk_widget_set_name (gtkbutton, item->id);
+ g_signal_connect (G_OBJECT (gtkbutton), "clicked",
+ G_CALLBACK (greeter_item_run_button_action_callback),
+ item->id);
+
+ item->item = gnome_canvas_item_new (group,
+ GNOME_TYPE_CANVAS_WIDGET,
+ "widget", gtkbutton,
+ "x", x1,
+ "y", y1,
+ "height", (double)rect.height,
+ "width", (double)rect.width,
+ NULL);
+
+ break;
+
case GREETER_ITEM_TYPE_ENTRY:
entry = gtk_entry_new ();
gtk_widget_set_name (entry, "user-pw-entry");
gtk_entry_set_has_frame (GTK_ENTRY (entry), FALSE);
+
if (gdm_config_get_bool (GDM_KEY_ENTRY_INVISIBLE))
gtk_entry_set_invisible_char (GTK_ENTRY (entry), 0);
else if (gdm_config_get_bool (GDM_KEY_ENTRY_CIRCLES))
gtk_entry_set_invisible_char (GTK_ENTRY (entry), 0x25cf);
+
gtk_widget_modify_font (entry, item->data.text.fonts[GREETER_ITEM_STATE_NORMAL]);
get_gdk_color_from_rgb (&c, item->data.text.colors[GREETER_ITEM_STATE_NORMAL]);
diff --git a/gui/greeter/greeter_events.c b/gui/greeter/greeter_events.c
index 873c8c9b..a9e396ef 100644
--- a/gui/greeter/greeter_events.c
+++ b/gui/greeter/greeter_events.c
@@ -202,7 +202,7 @@ greeter_item_event_handler (GnomeCanvasItem *item,
if (info->state != old_state)
{
- if (info->button)
+ if (info->canvasbutton)
{
if (info->state == GREETER_ITEM_STATE_NORMAL)
propagate_reset_state (info, old_state);
diff --git a/gui/greeter/greeter_geometry.c b/gui/greeter/greeter_geometry.c
index 81325564..2e377c28 100644
--- a/gui/greeter/greeter_geometry.c
+++ b/gui/greeter/greeter_geometry.c
@@ -19,6 +19,7 @@
#include "config.h"
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <librsvg/rsvg.h>
#include "gdmcommon.h"
#include "gdmwm.h"
@@ -559,6 +560,39 @@ greeter_item_size_request (GreeterItemInfo *item,
req->height = gdk_pixbuf_get_height (svg);
g_object_unref (svg);
}
+
+ if (item->item_type == GREETER_ITEM_TYPE_BUTTON)
+ {
+ PangoLayout *layout;
+ PangoFontDescription *font_desc;
+ int pango_width, pango_height;
+ int pix_width, pix_height;
+
+ GtkWidget *dummy_w = gtk_button_new ();
+
+ if (strcmp (item->id, "options_button") == 0)
+ layout = gtk_widget_create_pango_layout (dummy_w, _("Select Language..."));
+ else
+ layout = gtk_widget_create_pango_layout (dummy_w, item->data.text.orig_text);
+
+ pango_layout_get_size (layout, &pango_width, &pango_height);
+
+ pix_height = PANGO_PIXELS (pango_height);
+ pix_width = PANGO_PIXELS (pango_width);
+
+ if (strcmp (item->id, "options_button") == 0)
+ pix_width += pix_height * 2; /* add padding for combobox */
+
+ if (pix_width > item->parent->box_min_width)
+ req->width = pix_width;
+ else
+ req->width = item->parent->box_min_width;
+
+ if (pix_height > item->parent->box_min_height)
+ req->height = pix_height;
+ else
+ req->height = item->parent->box_min_height;
+ }
if (req->width > 0 && req->height > 0)
{
diff --git a/gui/greeter/greeter_item.c b/gui/greeter/greeter_item.c
index 5377ccfb..4ffb3081 100644
--- a/gui/greeter/greeter_item.c
+++ b/gui/greeter/greeter_item.c
@@ -73,7 +73,8 @@ greeter_item_info_new (GreeterItemInfo *parent,
info->show_modes = GREETER_ITEM_SHOW_EVERYWHERE;
- info->button = FALSE;
+ info->canvasbutton = FALSE;
+ info->gtkbutton = FALSE;
if (GREETER_ITEM_TYPE_IS_TEXT (info))
{
diff --git a/gui/greeter/greeter_item.h b/gui/greeter/greeter_item.h
index d70065df..ec7fd6aa 100644
--- a/gui/greeter/greeter_item.h
+++ b/gui/greeter/greeter_item.h
@@ -46,7 +46,8 @@ enum _GreeterItemType {
GREETER_ITEM_TYPE_PIXMAP,
GREETER_ITEM_TYPE_LABEL,
GREETER_ITEM_TYPE_ENTRY,
- GREETER_ITEM_TYPE_LIST
+ GREETER_ITEM_TYPE_LIST,
+ GREETER_ITEM_TYPE_BUTTON
};
/* Make sure to adjust the bitfield in the structure if
@@ -112,8 +113,12 @@ struct _GreeterItemInfo {
/* box flags */
guint box_homogeneous:1;
- /* is a button (see my_button comment) */
- guint button:1;
+ /* is a canvas rectangle that acts like a button */
+ /* (see the my_button comment) */
+ guint canvasbutton:1;
+
+ /* is a real GTK button (not the fake canvas button) */
+ guint gtkbutton:1;
/* geometry handling: */
guint has_requisition:1;
diff --git a/gui/greeter/greeter_item_pam.c b/gui/greeter/greeter_item_pam.c
index 812e5abd..bf1a185e 100644
--- a/gui/greeter/greeter_item_pam.c
+++ b/gui/greeter/greeter_item_pam.c
@@ -26,6 +26,7 @@
#include "viciousui.h"
#include "greeter.h"
+#include "greeter_item.h"
#include "greeter_item_pam.h"
#include "greeter_item_ulist.h"
#include "greeter_item_timed.h"
@@ -46,6 +47,30 @@ gboolean require_quarter = FALSE;
extern gboolean greeter_probably_login_prompt;
+gboolean
+greeter_item_pam_error_set (gboolean display)
+{
+ GreeterItemInfo *info;
+ GnomeCanvasItem *item;
+
+ info = greeter_lookup_id ("pam-error-logo");
+
+ if (info)
+ {
+ if (info->group_item != NULL)
+ item = GNOME_CANVAS_ITEM (info->group_item);
+ else
+ item = info->item;
+
+ if (display)
+ gnome_canvas_item_show (item);
+ else
+ gnome_canvas_item_hide (item);
+ }
+
+ return TRUE;
+}
+
void
greeter_item_pam_set_user (const char *user)
{
@@ -129,8 +154,10 @@ greeter_item_pam_login (GtkEntry *entry, GreeterItemInfo *info)
err_box_clear_handler = 0;
}
error_info = greeter_lookup_id ("pam-error");
- if (error_info)
+ if (error_info) {
+ greeter_item_pam_error_set (FALSE);
set_text (error_info, "");
+ }
tmp = ve_locale_from_utf8 (str);
printf ("%c%s\n", STX, tmp);
@@ -165,6 +192,8 @@ greeter_item_pam_setup (void)
{
GreeterItemInfo *entry_info;
+ greeter_item_pam_error_set (FALSE);
+
entry_info = greeter_lookup_id ("user-pw-entry");
if (entry_info && entry_info->item &&
GNOME_IS_CANVAS_WIDGET (entry_info->item) &&
@@ -191,6 +220,7 @@ greeter_item_pam_setup (void)
g_signal_connect (G_OBJECT (entry), "key_press_event",
G_CALLBACK (key_press_event), NULL);
}
+
return TRUE;
}
@@ -272,10 +302,11 @@ static gboolean
error_clear (gpointer data)
{
GreeterItemInfo *error_info = data;
+ err_box_clear_handler = 0;
set_text (error_info, "");
+ greeter_item_pam_error_set (FALSE);
- err_box_clear_handler = 0;
return FALSE;
}
@@ -299,12 +330,14 @@ greeter_item_pam_error (const char *message)
if (err_box_clear_handler > 0)
g_source_remove (err_box_clear_handler);
+
if (strlen (message) == 0)
err_box_clear_handler = 0;
else
err_box_clear_handler = g_timeout_add (30000,
error_clear,
error_info);
+ greeter_item_pam_error_set (TRUE);
}
}
diff --git a/gui/greeter/greeter_parser.c b/gui/greeter/greeter_parser.c
index b8d05be2..28a9049f 100644
--- a/gui/greeter/greeter_parser.c
+++ b/gui/greeter/greeter_parser.c
@@ -114,38 +114,6 @@ parse_id (xmlNodePtr node,
}
}
-static gboolean
-parse_button (xmlNodePtr node,
- GreeterItemInfo *info,
- GError **error)
-{
- xmlChar *prop;
-
- prop = xmlGetProp (node,(const xmlChar *) "button");
- if (prop)
- {
- if (strcmp ((char *) prop, "true") == 0)
- {
- info->button = TRUE;
- }
- else if (strcmp ((char *) prop, "false") == 0)
- {
- info->button = FALSE;
- }
- else
- {
- g_set_error (error,
- GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "bad button spec %s", 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
@@ -333,6 +301,251 @@ parse_pos (xmlNodePtr node,
return TRUE;
}
+/* We pass the same arguments as to translated text, since we'll override it
+ * with translation score */
+static gboolean
+parse_stock (xmlNodePtr node,
+ GreeterItemInfo *info,
+ char **translated_text,
+ gint *translation_score,
+ GError **error)
+{
+ xmlChar *prop;
+
+ prop = xmlGetProp (node,(const xmlChar *) "type");
+ if (prop)
+ {
+ if (g_ascii_strcasecmp ((char *) prop, "language") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Language"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "session") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Session"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "system") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Actions"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "disconnect") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("D_isconnect"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "quit") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Quit"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "halt") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Shut _Down"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "suspend") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Sus_pend"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "reboot") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Restart"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "chooser") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Remote Login via _XDMCP"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "config") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Confi_gure"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "options") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Op_tions"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "caps-lock-warning") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Caps Lock is on."));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "timed-label") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("User %u will login in %t"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "welcome-label") == 0)
+ {
+ /* FIXME: hack */
+ welcome_string_info = info;
+
+ g_free (*translated_text);
+ *translated_text = gdm_common_get_welcomemsg ();
+ }
+ /* FIXME: is this actually needed? */
+ else if (g_ascii_strcasecmp ((char *) prop, "username-label") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("Username:"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "ok") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_OK"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "cancel") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Cancel"));
+ }
+ else if (g_ascii_strcasecmp ((char *) prop, "startover") == 0)
+ {
+ g_free (*translated_text);
+ *translated_text = g_strdup (_("_Start Over"));
+ }
+ else
+ {
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Bad stock label type");
+ xmlFree (prop);
+ return FALSE;
+ }
+
+ /* This is the very very very best "translation" */
+ *translation_score = -1;
+
+ xmlFree (prop);
+
+ return TRUE;
+ }
+ else
+ {
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "Stock type not specified");
+ return FALSE;
+ }
+}
+
+static void
+do_font_size_reduction (GreeterItemInfo *info)
+{
+ double size_reduction = 1.0;
+ int i;
+
+ if (gdm_wm_screen.width <= 800 &&
+ gdm_wm_screen.width > 640)
+ size_reduction = PANGO_SCALE_SMALL;
+ else if (gdm_wm_screen.width <= 640)
+ size_reduction = PANGO_SCALE_X_SMALL;
+
+ if (size_reduction < 0.99)
+ {
+ for (i = 0; i < GREETER_ITEM_STATE_MAX; i++)
+ {
+ if (info->data.text.fonts[i] != NULL)
+ {
+ int old_size = pango_font_description_get_size (info->data.text.fonts[i]);
+ pango_font_description_set_size (info->data.text.fonts[i], old_size * size_reduction);
+ }
+ }
+ }
+}
+
+
+static gboolean
+parse_canvasbutton (xmlNodePtr node,
+ GreeterItemInfo *info,
+ GError **error)
+{
+ xmlChar *prop;
+
+ prop = xmlGetProp (node,(const xmlChar *) "button");
+ if (prop)
+ {
+ if (strcmp ((char *) prop, "true") == 0)
+ {
+ info->canvasbutton = TRUE;
+ }
+ else if (strcmp ((char *) prop, "false") == 0)
+ {
+ info->canvasbutton = FALSE;
+ }
+ else
+ {
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "bad button spec %s", prop);
+ xmlFree (prop);
+ return FALSE;
+ }
+ xmlFree (prop);
+ }
+ return TRUE;
+}
+
+static gboolean
+parse_gtkbutton (xmlNodePtr node,
+ GreeterItemInfo *info,
+ GError **error)
+{
+ char *translated_text;
+ gint translation_score = 1000;
+ xmlNodePtr child;
+ int i;
+
+ child = node->children;
+
+ while (child)
+ {
+ if (strcmp ((char *) child->name, "pos") == 0)
+ {
+ if G_UNLIKELY (!parse_pos (child, info, error))
+ return FALSE;
+ }
+ else if (child->type == XML_ELEMENT_NODE &&
+ strcmp ((char *) child->name, "stock") == 0)
+ {
+ if G_UNLIKELY (!parse_stock (child, info, &translated_text, &translation_score, error))
+ return FALSE;
+ }
+
+ child = child->next;
+ }
+
+ if (translated_text == NULL)
+ {
+ g_set_error (error,
+ GREETER_PARSER_ERROR,
+ GREETER_PARSER_ERROR_BAD_SPEC,
+ "A label must specify the text attribute");
+ return FALSE;
+ }
+
+ /* FIXME: evil hack to use internally translated strings */
+ if (translation_score == 999 &&
+ ! ve_string_empty (translated_text))
+ {
+ char *foo = g_strdup (_(translated_text));
+ g_free (translated_text);
+ translated_text = foo;
+ }
+
+ info->data.text.orig_text = translated_text;
+
+ return TRUE;
+}
+
static gboolean
parse_show (xmlNodePtr node,
GreeterItemInfo *info,
@@ -1031,162 +1244,6 @@ parse_translated_text (xmlNodePtr node,
return TRUE;
}
-/* We pass the same arguments as to translated text, since we'll override it
- * with translation score */
-static gboolean
-parse_stock (xmlNodePtr node,
- GreeterItemInfo *info,
- char **translated_text,
- gint *translation_score,
- GError **error)
-{
- xmlChar *prop;
-
- prop = xmlGetProp (node,(const xmlChar *) "type");
- if (prop)
- {
- if (g_ascii_strcasecmp ((char *) prop, "language") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Language"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "session") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Session"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "system") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Actions"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "disconnect") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("D_isconnect"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "quit") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Quit"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "halt") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Shut _Down"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "suspend") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Sus_pend"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "reboot") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Restart"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "chooser") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Remote Login via _XDMCP"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "config") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Confi_gure"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "options") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Op_tions"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "caps-lock-warning") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Caps Lock is on."));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "timed-label") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("User %u will login in %t"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "welcome-label") == 0)
- {
- /* FIXME: hack */
- welcome_string_info = info;
-
- g_free (*translated_text);
- *translated_text = gdm_common_get_welcomemsg ();
- }
- /* FIXME: is this actually needed? */
- else if (g_ascii_strcasecmp ((char *) prop, "username-label") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("Username:"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "ok") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_OK"));
- }
- else if (g_ascii_strcasecmp ((char *) prop, "cancel") == 0)
- {
- g_free (*translated_text);
- *translated_text = g_strdup (_("_Cancel"));
- }
- else
- {
- g_set_error (error,
- GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Bad stock label type");
- xmlFree (prop);
- return FALSE;
- }
-
- /* This is the very very very best "translation" */
- *translation_score = -1;
-
- xmlFree (prop);
-
- return TRUE;
- }
- else
- {
- g_set_error (error,
- GREETER_PARSER_ERROR,
- GREETER_PARSER_ERROR_BAD_SPEC,
- "Stock type not specified");
- return FALSE;
- }
-}
-
-static void
-do_font_size_reduction (GreeterItemInfo *info)
-{
- double size_reduction = 1.0;
- int i;
-
- if (gdm_wm_screen.width <= 800 &&
- gdm_wm_screen.width > 640)
- size_reduction = PANGO_SCALE_SMALL;
- else if (gdm_wm_screen.width <= 640)
- size_reduction = PANGO_SCALE_X_SMALL;
-
- if (size_reduction < 0.99)
- {
- for (i = 0; i < GREETER_ITEM_STATE_MAX; i++)
- {
- if (info->data.text.fonts[i] != NULL)
- {
- int old_size = pango_font_description_get_size (info->data.text.fonts[i]);
- pango_font_description_set_size (info->data.text.fonts[i], old_size * size_reduction);
- }
- }
- }
-}
-
-
static gboolean
parse_label_pos_extras (xmlNodePtr node,
GreeterItemInfo *info,
@@ -1550,6 +1607,8 @@ parse_items (xmlNodePtr node,
item_type = GREETER_ITEM_TYPE_ENTRY;
else if (strcmp ((char *) type, "list") == 0)
item_type = GREETER_ITEM_TYPE_LIST;
+ else if (strcmp ((char *) type, "button") == 0)
+ item_type = GREETER_ITEM_TYPE_BUTTON;
else
{
g_set_error (error,
@@ -1563,12 +1622,12 @@ parse_items (xmlNodePtr node,
info = greeter_item_info_new (parent, item_type);
parse_id (child, info);
- if G_UNLIKELY ( ! parse_button (child, info, error))
+ if G_UNLIKELY ( ! parse_canvasbutton (child, info, error))
return FALSE;
if (button_stack != NULL)
info->my_button = button_stack->data;
- if (info->button)
+ if (info->canvasbutton)
button_stack = g_list_prepend (button_stack, info);
switch (item_type)
@@ -1591,6 +1650,9 @@ parse_items (xmlNodePtr node,
case GREETER_ITEM_TYPE_LIST:
res = parse_list (child, info, error);
break;
+ case GREETER_ITEM_TYPE_BUTTON:
+ res = parse_gtkbutton (child, info, error);
+ break;
default:
g_set_error (error,
GREETER_PARSER_ERROR,
@@ -1599,7 +1661,7 @@ parse_items (xmlNodePtr node,
res = FALSE;
}
- if (info->button)
+ if (info->canvasbutton)
button_stack = g_list_remove (button_stack, info);
if G_UNLIKELY (!res)
diff --git a/gui/greeter/themes/circles/circles.xml b/gui/greeter/themes/circles/circles.xml
index 1dc96c25..3f7dea8a 100644
--- a/gui/greeter/themes/circles/circles.xml
+++ b/gui/greeter/themes/circles/circles.xml
@@ -12,26 +12,10 @@
<item type="rect">
<normal color="#ffffff"/>
<pos x="0" y="4" width="100%" height="100%"/>
- <box orientation="horizontal" spacing="10" xpadding="10">
- <item type="rect" id="options_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 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos y="50%" anchor="w"/>
- <!-- Stock label for: _Options -->
- <stock type="options"/>
- </item>
- </box>
+ <box orientation="horizontal" spacing="10" xpadding="10" ypadding="10">
+ <item type="button" id="options_button" button="true">
+ <pos width="100" height="50"/>
+ <stock type="options"/>
</item>
</box>
</item>
@@ -100,33 +84,13 @@
</item>
</fixed>
</item>
- <item type="rect" id="ok_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _OK -->
- <stock type="ok"/>
- </item>
- </box>
+ <item type="button" id="ok_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="ok"/>
</item>
- <item type="rect" id="cancel_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _Cancel -->
- <stock type="cancel"/>
- </item>
- </box>
+ <item type="button" id="cancel_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="startover"/>
</item>
<item type="label" id="pam-message">
<pos anchor="n" x="50%"/>
diff --git a/gui/greeter/themes/happygnome-list/happygnome.xml b/gui/greeter/themes/happygnome-list/happygnome.xml
index 80fb7128..6babce46 100644
--- a/gui/greeter/themes/happygnome-list/happygnome.xml
+++ b/gui/greeter/themes/happygnome-list/happygnome.xml
@@ -12,26 +12,10 @@
<item type="rect">
<normal color="#ffffff"/>
<pos x="0" y="4" width="100%" height="100%"/>
- <box orientation="horizontal" spacing="10" xpadding="10">
- <item type="rect" id="options_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 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos y="50%" anchor="w"/>
- <!-- Stock label for: _Options -->
- <stock type="options"/>
- </item>
- </box>
+ <box orientation="horizontal" spacing="10" xpadding="10" ypadding="10">
+ <item type="button" id="options_button">
+ <pos width="100" height="50" />
+ <stock type="options"/>
</item>
</box>
</item>
@@ -111,33 +95,13 @@
</item>
</fixed>
</item>
- <item type="rect" id="ok_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _OK -->
- <stock type="ok"/>
- </item>
- </box>
+ <item type="button" id="ok_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="ok"/>
</item>
- <item type="rect" id="cancel_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _Cancel -->
- <stock type="cancel"/>
- </item>
- </box>
+ <item type="button" id="cancel_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="startover"/>
</item>
<item type="label" id="pam-message">
<pos anchor="n" x="50%"/>
diff --git a/gui/greeter/themes/happygnome/happygnome.xml b/gui/greeter/themes/happygnome/happygnome.xml
index 5eb87c8b..52618a8f 100644
--- a/gui/greeter/themes/happygnome/happygnome.xml
+++ b/gui/greeter/themes/happygnome/happygnome.xml
@@ -12,26 +12,10 @@
<item type="rect">
<normal color="#ffffff"/>
<pos x="0" y="4" width="100%" height="100%"/>
- <box orientation="horizontal" spacing="10" xpadding="10">
- <item type="rect" id="options_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 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos y="50%" anchor="w"/>
- <!-- Stock label for: _Options -->
- <stock type="options"/>
- </item>
- </box>
+ <box orientation="horizontal" spacing="10" xpadding="10" ypadding="10">
+ <item type="button" id="options_button">
+ <pos width="100" height="50" />
+ <stock type="options"/>
</item>
</box>
</item>
@@ -100,33 +84,13 @@
</item>
</fixed>
</item>
- <item type="rect" id="ok_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _OK -->
- <stock type="ok"/>
- </item>
- </box>
+ <item type="button" id="ok_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="ok"/>
</item>
- <item type="rect" id="cancel_button" button="true">
- <normal color="#ffffff"/>
- <pos anchor="n" x="50%" width="50%" height="20"/>
- <box orientation="vertical" spacing="10" xpadding="10">
- <item type="label">
- <normal color="#000000" font="Sans 12"/>
- <prelight color="#666666" font="Sans 12"/>
- <active color="#ff0000" font="Sans 12"/>
- <pos anchor="n" x="50%" height="24" width="50%"/>
- <!-- Stock label for: _Cancel -->
- <stock type="cancel"/>
- </item>
- </box>
+ <item type="button" id="cancel_button">
+ <pos anchor="n" x="50%" height="32" width="50%"/>
+ <stock type="startover"/>
</item>
<item type="label" id="pam-message">
<pos anchor="n" x="50%"/>