[Xfce4-commits] [apps/xfce4-panel-profiles] 39/162: Name the toolbar widgets, toggle delete button based on permission to delete (LP: #1494846)

noreply at xfce.org noreply at xfce.org
Fri Jul 13 13:08:58 CEST 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-panel-profiles.

commit ea5f7e12eb7a76a3e3ccb83be30978451da1ad0c
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Sep 20 10:53:57 2015 -0400

    Name the toolbar widgets, toggle delete button based on permission to delete (LP: #1494846)
---
 xfpanel-switch/xfpanel-switch.glade | 13 +++++++------
 xfpanel-switch/xfpanel-switch.py    |  8 ++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/xfpanel-switch/xfpanel-switch.glade b/xfpanel-switch/xfpanel-switch.glade
index b859ee2..fad881f 100644
--- a/xfpanel-switch/xfpanel-switch.glade
+++ b/xfpanel-switch/xfpanel-switch.glade
@@ -64,11 +64,11 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="margin_start">12</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes"><b><big>Xfce Panel Switch</big></b>
 Backup and restore your panel configuration</property>
                         <property name="use_markup">True</property>
                         <property name="ellipsize">end</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="expand">True</property>
@@ -128,6 +128,7 @@ Backup and restore your panel configuration</property>
                         <property name="model">liststore1</property>
                         <property name="search_column">0</property>
                         <property name="tooltip_column">0</property>
+                        <signal name="cursor-changed" handler="on_saved_configurations_cursor_changed" swapped="no"/>
                         <child internal-child="selection">
                           <object class="GtkTreeSelection" id="treeview-selection1"/>
                         </child>
@@ -175,7 +176,7 @@ Backup and restore your panel configuration</property>
                     <property name="can_focus">False</property>
                     <property name="icon_size">2</property>
                     <child>
-                      <object class="GtkToolButton" id="toolbutton3">
+                      <object class="GtkToolButton" id="toolbar_apply">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Apply Configuration</property>
@@ -190,7 +191,7 @@ Backup and restore your panel configuration</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToolButton" id="toolbutton1">
+                      <object class="GtkToolButton" id="toolbar_save">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Save Configuration</property>
@@ -205,7 +206,7 @@ Backup and restore your panel configuration</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToolButton" id="toolbutton2">
+                      <object class="GtkToolButton" id="toolbar_delete">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Remove Configuration</property>
@@ -220,7 +221,7 @@ Backup and restore your panel configuration</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToolButton" id="toolbutton5">
+                      <object class="GtkToolButton" id="toolbar_export">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Export</property>
@@ -235,7 +236,7 @@ Backup and restore your panel configuration</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToolButton" id="toolbutton4">
+                      <object class="GtkToolButton" id="toolbar_import">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Import</property>
diff --git a/xfpanel-switch/xfpanel-switch.py b/xfpanel-switch/xfpanel-switch.py
index 6f01903..f3459dc 100644
--- a/xfpanel-switch/xfpanel-switch.py
+++ b/xfpanel-switch/xfpanel-switch.py
@@ -240,6 +240,14 @@ class XfpanelSwitch:
         self.delete_configuration(filename)
         model.remove(treeiter)
 
+    def on_saved_configurations_cursor_changed(self, widget):
+        filename = self.get_selected_filename()
+        delete = self.builder.get_object("toolbar_delete")
+        if os.access(filename, os.W_OK):
+            delete.set_sensitive(True)
+        else:
+            delete.set_sensitive(False)
+
     def on_window_destroy(self, *args):
         '''Exit the application when the window is closed.'''
         Gtk.main_quit()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list