--- xfce4-panel-4.10.1/plugins/actions/actions.c.orig 2013-10-29 17:26:27.000000000 +0100
+++ xfce4-panel-4.10.1/plugins/actions/actions.c 2013-10-29 17:19:42.000000000 +0100
@@ -37,6 +37,7 @@
+#define DEFAULT_TITLE _("Session Menu")
#define DEFAULT_ICON_SIZE (16)
#define DEFAULT_TIMEOUT (30)
@@ -71,11 +72,22 @@
}
AppearanceType;
+typedef enum
+{
+ BUTTON_TITLE_TYPE_FULLNAME,
+ BUTTON_TITLE_TYPE_USERNAME,
+ BUTTON_TITLE_TYPE_USERID,
+ BUTTON_TITLE_TYPE_CUSTOM
+}
+ButtonTitleType;
+
enum
{
PROP_0,
PROP_ITEMS,
PROP_APPEARANCE,
+ PROP_BUTTON_TITLE,
+ PROP_CUSTOM_TITLE,
PROP_INVERT_ORIENTATION,
PROP_ASK_CONFIRMATION
};
@@ -98,6 +110,8 @@
XfcePanelPlugin __parent__;
AppearanceType type;
+ ButtonTitleType button_title;
+ gchar *custom_title;
GPtrArray *items;
GtkWidget *menu;
guint invert_orientation : 1;
@@ -255,6 +269,22 @@
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
+ PROP_BUTTON_TITLE,
+ g_param_spec_uint ("button-title",
+ NULL, NULL,
+ BUTTON_TITLE_TYPE_FULLNAME,
+ BUTTON_TITLE_TYPE_CUSTOM,
+ BUTTON_TITLE_TYPE_FULLNAME,
+ EXO_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_CUSTOM_TITLE,
+ g_param_spec_string ("custom-title",
+ NULL, NULL,
+ DEFAULT_TITLE,
+ EXO_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
PROP_INVERT_ORIENTATION,
g_param_spec_boolean ("invert-orientation",
NULL, NULL,
@@ -283,6 +313,7 @@
actions_plugin_init (ActionsPlugin *plugin)
{
plugin->type = APPEARANCE_TYPE_MENU;
+ plugin->button_title = BUTTON_TITLE_TYPE_FULLNAME;
plugin->invert_orientation = FALSE;
plugin->ask_confirmation = TRUE;
}
@@ -307,6 +338,15 @@
g_value_set_uint (value, plugin->type);
break;
+ case PROP_BUTTON_TITLE:
+ g_value_set_uint (value, plugin->button_title);
+ break;
+
+ case PROP_CUSTOM_TITLE:
+ g_value_set_string (value, plugin->custom_title == NULL ?
+ DEFAULT_TITLE : plugin->custom_title);
+ break;
+
case PROP_INVERT_ORIENTATION:
g_value_set_boolean (value, plugin->invert_orientation);
break;
@@ -345,6 +385,17 @@
actions_plugin_pack (plugin);
break;
+ case PROP_BUTTON_TITLE:
+ plugin->button_title = g_value_get_uint (value);
+ actions_plugin_pack (plugin);
+ break;
+
+ case PROP_CUSTOM_TITLE:
+ g_free (plugin->custom_title);
+ plugin->custom_title = g_value_dup_string (value);
+ actions_plugin_pack (plugin);
+ break;
+
case PROP_INVERT_ORIENTATION:
plugin->invert_orientation = g_value_get_boolean (value);
actions_plugin_pack (plugin);
@@ -370,6 +421,8 @@
{
{ "items", PANEL_PROPERTIES_TYPE_VALUE_ARRAY },
{ "appearance", G_TYPE_UINT },
+ { "button-title", G_TYPE_UINT },
+ { "custom-title", G_TYPE_STRING },
{ "invert-orientation", G_TYPE_BOOLEAN },
{ "ask-confirmation", G_TYPE_BOOLEAN },
{ NULL }
@@ -573,6 +626,9 @@
GObject *dialog;
GObject *object;
GObject *combo;
+ GObject *combo2;
+ GObject *label;
+ GObject *text;
ActionEntry *entry;
guint i;
const GValue *val;
@@ -604,6 +660,26 @@
exo_binding_new_with_negation (G_OBJECT (combo), "active",
G_OBJECT (object), "sensitive");
+ combo2 = gtk_builder_get_object (builder, "combo-title");
+ exo_mutual_binding_new (G_OBJECT (plugin), "button-title",
+ G_OBJECT (combo2), "active");
+ exo_binding_new (G_OBJECT (combo), "active",
+ G_OBJECT (combo2), "sensitive");
+
+ label = gtk_builder_get_object (builder, "label-title");
+ exo_binding_new (G_OBJECT (combo), "active",
+ G_OBJECT (label), "sensitive");
+
+ label = gtk_builder_get_object (builder, "label-cust-title");
+ exo_binding_new (G_OBJECT (combo), "active",
+ G_OBJECT (label), "sensitive");
+
+ text = gtk_builder_get_object (builder, "entry-cust-title");
+ exo_mutual_binding_new (G_OBJECT (plugin), "custom-title",
+ G_OBJECT (text), "text");
+ exo_binding_new (G_OBJECT (combo), "active",
+ G_OBJECT (text), "sensitive");
+
object = gtk_builder_get_object (builder, "confirmation-dialog");
exo_mutual_binding_new (G_OBJECT (plugin), "ask-confirmation",
G_OBJECT (object), "active");
@@ -1071,7 +1147,7 @@
GtkWidget *label;
GtkWidget *button;
GtkWidget *widget;
- const gchar *username;
+ const gchar *button_title;
GtkWidget *child;
GtkWidget *box;
guint i;
@@ -1131,16 +1207,41 @@
}
else
{
- /* get a decent username, not the glib defaults */
- username = g_get_real_name ();
- if (exo_str_is_empty (username)
- || strcmp (username, "Unknown") == 0)
- {
- username = g_get_user_name ();
- if (exo_str_is_empty (username)
- || strcmp (username, "somebody") == 0)
- username = _("John Doe");
- }
+ switch (plugin->button_title)
+ {
+ case BUTTON_TITLE_TYPE_FULLNAME:
+ /* get a decent username, not the glib defaults */
+ button_title = g_get_real_name ();
+ if (exo_str_is_empty (button_title)
+ || strcmp (button_title, "Unknown") == 0)
+ {
+ button_title = g_get_user_name ();
+ if (exo_str_is_empty (button_title)
+ || strcmp (button_title, "somebody") == 0)
+ button_title = _("John Doe");
+ }
+ break;
+
+ case BUTTON_TITLE_TYPE_USERNAME:
+ button_title = g_get_user_name ();
+ if (exo_str_is_empty (button_title))
+ button_title = "somebody";
+ break;
+
+ case BUTTON_TITLE_TYPE_USERID:
+ {
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", (unsigned)getuid());
+ button_title = buf;
+ }
+ break;
+
+ default:
+ case BUTTON_TITLE_TYPE_CUSTOM:
+ button_title = (plugin->custom_title == NULL?
+ DEFAULT_TITLE : plugin->custom_title);
+ break;
+ }
button = xfce_arrow_button_new (GTK_ARROW_NONE);
gtk_widget_set_name (button, "actions-button");
@@ -1151,7 +1252,7 @@
G_CALLBACK (actions_plugin_menu), plugin);
gtk_widget_show (button);
- label = gtk_label_new (username);
+ label = gtk_label_new (button_title);
gtk_container_add (GTK_CONTAINER (button), label);
mode = xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin));
gtk_label_set_angle (GTK_LABEL (label),
--- xfce4-panel-4.10.1/plugins/actions/actions-dialog.glade.orig 2013-10-29 17:26:27.000000000 +0100
+++ xfce4-panel-4.10.1/plugins/actions/actions-dialog.glade 2013-10-29 17:05:37.000000000 +0100
@@ -81,7 +81,7 @@
True
False
6
- 3
+ 5
2
12
6
@@ -99,6 +99,36 @@
+
+
+ GTK_FILL
+ 1
+ 2
+
+
+
+
+
+ GTK_FILL
+ 2
+ 3
+
+
+
2
- 1
- 2
+ 3
+ 4
@@ -132,6 +162,38 @@
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+ True
+ True
+ •
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
_Show confirmation dialog
True
@@ -144,8 +206,8 @@
2
- 2
- 3
+ 4
+ 5
@@ -283,4 +345,24 @@
+
+
+
+
+
+
+
+ Full Name
+
+
+ Username
+
+
+ User ID (numeric)
+
+
+ Custom
+
+
+