[Xfce4-commits] <xfdesktop:master> Add xfconf property for add/remove workspace (Bug 4278, 7337)

Eric Koegel noreply at xfce.org
Thu Dec 12 17:42:02 CET 2013


Updating branch refs/heads/master
         to f12aa431c11f4aac2e9805f68e2f1d5b5424e079 (commit)
       from a83d43d32562c76754cbba3b5cbcabcd656c0081 (commit)

commit f12aa431c11f4aac2e9805f68e2f1d5b5424e079
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Thu Dec 12 17:48:55 2013 +0300

    Add xfconf property for add/remove workspace (Bug 4278, 7337)
    
    An xfconf property /windowlist-menu/show-add-remove-workspaces
    was added to allow the removal of the Add/Remove workspace buttons
    on the windowlist menu. This will allow administrators to remove
    those options when locking down xfconf properties for kiosk setups.
    Also this patch updates the README.xfconf file with all the recent
    xfconf property changes. It also revises the README.kiosk file
    since xfdesktop relies on xfconf to lock properties rather than
    the kioskrc file.

 doc/README.kiosk  |   58 +++++-------------------------------------
 doc/README.xfconf |   39 ++++++++++++++++++----------
 src/windowlist.c  |   73 ++++++++++++++++++++++++++++++-----------------------
 3 files changed, 72 insertions(+), 98 deletions(-)

diff --git a/doc/README.kiosk b/doc/README.kiosk
index b0a175b..51728ab 100644
--- a/doc/README.kiosk
+++ b/doc/README.kiosk
@@ -1,52 +1,6 @@
-Xfdesktop supports a 'kiosk mode' in which you can restrict the actions users
-are allowed to take.  You can do this by creating a file called
-'xfdesktop.kioskrc' in $sysconfdir/xdg/xfce4/kiosk/ (usually
-/etc/xdg/xfce4/kiosk/). A sample file might look like this:
-
---- begin xfdesktop.kioskrc ---
-UserMenu=%wheel
-CustomizeBackdrop=ALL
-CustomizeDesktopMenu=%wheel
-CustomizeWindowlist=NONE
-CustomizeDesktopIcons=brian
----  end xfdesktop.kioskrc  ---
-
-Additionally, the above can be added to $sysconfdir/xdg/xfce4/kiosk/kioskrc
-if you put it in a section called '[xfdesktop]', like so:
-
---- begin kioskrc ---
-[xfdesktop]
-UserMenu=%wheel
-CustomizeBackdrop=ALL
-CustomizeDesktopMenu=%wheel
-CustomizeWindowlist=NONE
-CustomizeDesktopIcons=brian
----  end kioskrc  ---
-
-Entries in $sysconfdir/xdg/xfce4/kiosk/kioskrc will override any entries in
-$sysconfdir/xdg/xfce4/kiosk/xfdesktop.kioskrc.
-
-Each entry can have a user name, a group name (prefixed with '%'), or one of
-the two special values 'ALL' or 'NONE'.  Lists of names should be
-comma-separated.
-
-Here's an explanation of the keys:
-
-UserMenu:  Whether or not to allow user modifications to the desktop menu.  If
-           not, xfdesktop will ignore the menu.xml file in
-           ~/.config/xfce4/desktop/ and use the system menu in
-           $sysconfdir/xdg/xfce4/desktop/menu.xml.
-
-CustomizeBackdrop: Whether or not to allow user modifications to the desktop
-           backdrop.  If not, the Backdrop settings panel will be greyed out.
-
-CustomizeDesktopMenu: Whether or not to allow user modifications to the desktop
-           menu.  This includes showing or hiding application icons, as well
-           as showing or hiding the menu itself.
-
-CustomizeWindowlist: Whether or not to allow user modifications to the window
-           list.  This includes showing or hiding window icons, as well as
-           showing or hiding the menu itself.
-
-CustomizeDesktopIcons: Whether or not to allow the user to enable or disable
-           the display of desktop icons, or change their style.
+Any xfconf property or channel can be locked down to prevent
+specific users or groups from making changes. See the
+README.xfconf for the list of properties xfdesktop supports.
+Additional kiosk information is available at:
+http://docs.xfce.org/xfce/xfconf/start
+http://git.xfce.org/xfce/xfconf/tree/docs/spec/perchannel-xml.txt
diff --git a/doc/README.xfconf b/doc/README.xfconf
index 74bf96e..a762688 100644
--- a/doc/README.xfconf
+++ b/doc/README.xfconf
@@ -3,46 +3,57 @@ hierarchical configuration system.  The channel name that xfdesktop uses
 is 'xfce4-desktop'.  Property names below should be referred to with each
 component separated by a slash ('/') character.  The data type of each
 property is listd after the name.
+The monitor settings are referred to by name where possible so that when
+the same monitor is plugged in again those settings apply to it.
 
-<manage-desktop>
-  <show-warning-off bool>
-  <show-warning-on bool>
-</manage-desktop>
 <backdrop>
+  <single-workspace-mode bool>
+  <single-workspace-number int>
   <screen0>
-    <xinerama-stretch bool>
     <monitor0>
-      <brightness int>
-      <color1 array:uint16,uint16,uint16>
-      <color2 array:uint16,uint16,uint16>
-      <color-style int>
-      <image-path string>
-      <image-style int>
-      <image-show bool>
+      <workspace0>
+        <backdrop-cycle-enable bool>
+        <backdrop-cycle-period int>
+        <backdrop-cycle-random-order bool>
+        <backdrop-cycle-timer int>
+        <color1 array:uint16,uint16,uint16>
+        <color2 array:uint16,uint16,uint16>
+        <color-style int>
+        <image-style int>
+        <last-image string>
+      </workspace0>
     </monitor0>
   </screen0>
 </backdrop>
 <windowlist-menu>
     <show bool>
+    <show-icons bool>
     <show-workspace-names bool>
     <show-sticky-once bool>
     <show-submenus bool>
+    <show-add-remove-workspaces bool>
 </windowlist>
 <desktop-menu>
     <show bool>
-    <show-menu-icons bool>
+    <show-icons bool>
 </desktop-menu>
 <desktop-icons>
     <style int>
     <use-custom-font-size bool>
-    <font-size uint>
+    <font-size double>
     <icon-size uint>
     <single-click bool>
     <show-thumbnails bool>
+    <show-tooltips bool>
+    <tooltip-size double>
     <file-icons>
         <show-filesystem bool>
         <show-home bool>
         <show-trash bool>
         <show-removable bool>
+        <show-device-removable bool>
+        <show-network-removable bool>
+        <show-unknown-removable bool>
+        <max-template-files int>
     </file-icons>
 </desktop-icons>
diff --git a/src/windowlist.c b/src/windowlist.c
index 195ef01..fd04573 100644
--- a/src/windowlist.c
+++ b/src/windowlist.c
@@ -50,6 +50,7 @@ static gboolean wl_show_icons = TRUE;
 static gboolean wl_show_ws_names = TRUE;
 static gboolean wl_submenus = FALSE;
 static gboolean wl_sticky_once = FALSE;
+static gboolean wl_add_remove_options = TRUE;
 
 static void
 set_num_workspaces(GtkWidget *w, gpointer data)
@@ -353,40 +354,42 @@ windowlist_populate(XfceDesktop *desktop,
     }
     
     pango_font_description_free(italic_font_desc);
+
+    if(wl_add_remove_options) {
+        /* 'add workspace' item */
+        if(wl_show_icons) {
+            img = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+            mi = gtk_image_menu_item_new_with_mnemonic(_("_Add Workspace"));
+            gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
+        } else
+            mi = gtk_menu_item_new_with_mnemonic(_("_Add Workspace"));
+        gtk_widget_show(mi);
+        gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+        g_signal_connect(G_OBJECT(mi), "activate",
+                G_CALLBACK(set_num_workspaces), GINT_TO_POINTER(nworkspaces+1));
     
-    /* 'add workspace' item */
-    if(wl_show_icons) {
-        img = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
-        mi = gtk_image_menu_item_new_with_mnemonic(_("_Add Workspace"));
-        gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
-    } else
-        mi = gtk_menu_item_new_with_mnemonic(_("_Add Workspace"));
-    gtk_widget_show(mi);
-    gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
-    g_signal_connect(G_OBJECT(mi), "activate",
-            G_CALLBACK(set_num_workspaces), GINT_TO_POINTER(nworkspaces+1));
-    
-    /* 'remove workspace' item */
-    if(!ws_name || atoi(ws_name) == nworkspaces)
-        rm_label = g_strdup_printf(_("_Remove Workspace %d"), nworkspaces);
-    else {
-        gchar *ws_name_esc = g_markup_escape_text(ws_name, strlen(ws_name));
-        rm_label = g_strdup_printf(_("_Remove Workspace '%s'"), ws_name_esc);
-        g_free(ws_name_esc);
+        /* 'remove workspace' item */
+        if(!ws_name || atoi(ws_name) == nworkspaces)
+            rm_label = g_strdup_printf(_("_Remove Workspace %d"), nworkspaces);
+        else {
+            gchar *ws_name_esc = g_markup_escape_text(ws_name, strlen(ws_name));
+            rm_label = g_strdup_printf(_("_Remove Workspace '%s'"), ws_name_esc);
+            g_free(ws_name_esc);
+        }
+        if(wl_show_icons) {
+            img = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
+            mi = gtk_image_menu_item_new_with_mnemonic(rm_label);
+            gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
+        } else
+            mi = gtk_menu_item_new_with_mnemonic(rm_label);
+        g_free(rm_label);
+        if(nworkspaces == 1)
+            gtk_widget_set_sensitive(mi, FALSE);
+        gtk_widget_show(mi);
+        gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+        g_signal_connect(G_OBJECT(mi), "activate",
+                G_CALLBACK(set_num_workspaces), GINT_TO_POINTER(nworkspaces-1));
     }
-    if(wl_show_icons) {
-        img = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
-        mi = gtk_image_menu_item_new_with_mnemonic(rm_label);
-        gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
-    } else
-        mi = gtk_menu_item_new_with_mnemonic(rm_label);
-    g_free(rm_label);
-    if(nworkspaces == 1)
-        gtk_widget_set_sensitive(mi, FALSE);
-    gtk_widget_show(mi);
-    gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
-    g_signal_connect(G_OBJECT(mi), "activate",
-            G_CALLBACK(set_num_workspaces), GINT_TO_POINTER(nworkspaces-1));
 }
 
 static void
@@ -405,6 +408,8 @@ windowlist_settings_changed(XfconfChannel *channel,
         wl_submenus = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : FALSE;
     else if(!strcmp(property, "/windowlist-menu/show-sticky-once"))
         wl_sticky_once = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : FALSE;
+    else if(!strcmp(property, "/windowlist-menu/show-add-remove-workspaces"))
+        wl_add_remove_options = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : TRUE;
 }
 
 void
@@ -431,6 +436,10 @@ windowlist_init(XfconfChannel *channel)
                                                  "/windowlist-menu/show-sticky-once",
                                                  FALSE);
 
+        wl_add_remove_options = xfconf_channel_get_bool(channel,
+                                                        "/windowlist-menu/show-add-remove-workspaces",
+                                                        TRUE);
+
         g_signal_connect(G_OBJECT(channel), "property-changed",
                          G_CALLBACK(windowlist_settings_changed), NULL);
     }


More information about the Xfce4-commits mailing list