Author: twatkins
Date: Sun Feb 17 05:41:50 2008
New Revision: 353
URL: http://svn.gnome.org/viewvc/alacarte?rev=353&view=rev

Log:
2008-02-16  Travis Watkins  <[EMAIL PROTECTED]>

        * Alacarte/MainWindow.py:
          - disable New Separator button when an item is not selected
            thanks to Mike Pechkin
          - hopefully fix problem with editing properties on menus without
            .directory files
          - make sure DnD operations are allowed allowed for the inside
            the alacarte window and not between instances of alacarte
          - update view on item theme change, thanks Jared Moore
        * Alacarte/Makefile.am:
          - install .py files to the correct location, thanks Todd Zullinger
        * Alacarte/MenuEditor.py:
          - make sure you can't move a menu into itself
            thanks Benjamin Gramlich
          - hopefully fix bug 486937 (which doesn't make sense)
        * alacarte.desktop.in.in:
          - disable StartupNotify as a poor man's fix for property windows
            going under the main application window


Modified:
   trunk/Alacarte/MainWindow.py
   trunk/Alacarte/Makefile.am
   trunk/Alacarte/MenuEditor.py
   trunk/ChangeLog
   trunk/alacarte.desktop.in.in
   trunk/alacarte.glade

Modified: trunk/Alacarte/MainWindow.py
==============================================================================
--- trunk/Alacarte/MainWindow.py        (original)
+++ trunk/Alacarte/MainWindow.py        Sun Feb 17 05:41:50 2008
@@ -61,6 +61,7 @@
                self.tree.get_widget('edit_properties').set_sensitive(False)
                self.tree.get_widget('move_up_button').set_sensitive(False)
                self.tree.get_widget('move_down_button').set_sensitive(False)
+               
self.tree.get_widget('new_separator_button').set_sensitive(False)
                accelgroup = gtk.AccelGroup()
                keyval, modifier = gtk.accelerator_parse('<Ctrl>Z')
                accelgroup.connect_group(keyval, modifier, gtk.ACCEL_VISIBLE, 
self.on_mainwindow_undo)
@@ -357,7 +358,15 @@
                        file_path = os.path.join(util.getUserItemPath(), 
item.get_desktop_file_id())
                        file_type = 'Item'
                elif item.get_type() == gmenu.TYPE_DIRECTORY:
-                       file_path = os.path.join(util.getUserDirectoryPath(), 
os.path.split(item.get_desktop_file_path())[1])
+                       if item.get_desktop_file_path() == None:
+                               file_path = 
util.getUniqueFileId('alacarte-made', '.directory')
+                               parser = util.DesktopParser(file_path, 
'Directory')
+                               parser.set('Name', item.get_name())
+                               parser.set('Comment', item.get_comment())
+                               parser.set('Icon', item.get_icon())
+                               parser.write(open(file_path))
+                       else:
+                               file_path = 
os.path.join(util.getUserDirectoryPath(), 
os.path.split(item.get_desktop_file_path())[1])
                        file_type = 'Menu'
 
                if not os.path.isfile(file_path):
@@ -382,6 +391,7 @@
                self.tree.get_widget('edit_properties').set_sensitive(False)
                self.tree.get_widget('move_up_button').set_sensitive(False)
                self.tree.get_widget('move_down_button').set_sensitive(False)
+               
self.tree.get_widget('new_separator_button').set_sensitive(False)
 
        def on_menu_tree_drag_data_get(self, treeview, context, selection, 
target_id, etime):
                menus, iter = treeview.get_selection().get_selected()
@@ -397,6 +407,8 @@
                                context.finish(False, False, etime)
                                return False
                        if selection.target in ('ALACARTE_ITEM_ROW', 
'ALACARTE_MENU_ROW'):
+                               if self.drag_data == None:
+                                       return False
                                item = self.drag_data
                                new_parent = menus[path][2]
                                treeview.get_selection().select_path(path)
@@ -408,6 +420,7 @@
                                else:
                                        context.finish(False, False, etime) 
                                context.finish(True, True, etime)
+               self.drag_data = None
 
        def on_item_tree_show_toggled(self, cell, path):
                item = self.item_store[path][3]
@@ -423,6 +436,7 @@
                items, iter = treeview.get_selection().get_selected()
                item = items[iter][3]
                self.tree.get_widget('edit_delete').set_sensitive(True)
+               self.tree.get_widget('new_separator_button').set_sensitive(True)
                if self.editor.canRevert(item):
                        
self.tree.get_widget('edit_revert_to_original').set_sensitive(True)
                else:
@@ -482,6 +496,8 @@
                        drop_info = treeview.get_dest_row_at_pos(x, y)
                        before = None
                        after = None
+                       if self.drag_data == None:
+                               return False
                        item = self.drag_data
                        if drop_info:
                                path, position = drop_info
@@ -531,6 +547,7 @@
                                self.editor.createItem(parent, 
parser.get('Icon'), parser.get('Name', self.editor.locale), 
parser.get('Comment', self.editor.locale), parser.get('Exec'), 
parser.get('Terminal'), before, after)
                        elif file_info.mime_type in 
('application/x-shellscript', 'application/x-executable'):
                                self.editor.createItem(parent, None, 
os.path.split(file_path)[1].strip(), None, file_path.replace('file://', 
'').strip(), False, before, after)
+               self.drag_data = None
 
        def on_item_tree_key_press_event(self, item_tree, event):
                if event.keyval == gtk.keysyms.Delete:
@@ -596,6 +613,9 @@
                        pass
                gobject.timeout_add(10, self.quit)
 
+       def on_style_set(self, *args):
+               self.loadUpdates()
+
        def quit(self):
                self.editor.quit()
                gtk.main_quit()         

Modified: trunk/Alacarte/Makefile.am
==============================================================================
--- trunk/Alacarte/Makefile.am  (original)
+++ trunk/Alacarte/Makefile.am  Sun Feb 17 05:41:50 2008
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-appdir = $(pyexecdir)/Alacarte
+appdir = $(pythondir)/Alacarte
 app_PYTHON = __init__.py MainWindow.py MenuEditor.py util.py
 nodist_app_PYTHON = config.py
 

Modified: trunk/Alacarte/MenuEditor.py
==============================================================================
--- trunk/Alacarte/MenuEditor.py        (original)
+++ trunk/Alacarte/MenuEditor.py        Sun Feb 17 05:41:50 2008
@@ -315,6 +315,11 @@
                        parent = parent.get_parent()
                        if parent == menu:
                                return False
+
+               #don't move a menu into itself
+               if new_parent == menu:
+                       return False
+
                #can't move between top-level menus
                if self.__getMenu(menu) != self.__getMenu(new_parent):
                        return False
@@ -374,6 +379,9 @@
        def revertMenu(self, menu):
                if not self.canRevert(menu):
                        return
+               #wtf happened here? oh well, just bail
+               if not menu.get_desktop_file_path():
+                       return
                self.__addUndo([menu,])
                file_id = os.path.split(menu.get_desktop_file_path())[1]
                path = os.path.join(util.getUserDirectoryPath(), file_id)

Modified: trunk/alacarte.desktop.in.in
==============================================================================
--- trunk/alacarte.desktop.in.in        (original)
+++ trunk/alacarte.desktop.in.in        Sun Feb 17 05:41:50 2008
@@ -5,7 +5,7 @@
 Exec=alacarte
 Terminal=false
 Type=Application
-StartupNotify=true
+StartupNotify=false
 Categories=GNOME;Settings;DesktopSettings;
 NotShowIn=KDE;
 Icon=alacarte

Modified: trunk/alacarte.glade
==============================================================================
--- trunk/alacarte.glade        (original)
+++ trunk/alacarte.glade        Sun Feb 17 05:41:50 2008
@@ -72,6 +72,7 @@
   <property name="has_separator">False</property>
   <signal name="close" handler="on_close_button_clicked" 
last_modification_time="Wed, 26 Apr 2006 18:46:45 GMT"/>
   <signal name="destroy" handler="on_close_button_clicked" 
last_modification_time="Fri, 28 Apr 2006 10:49:37 GMT"/>
+  <signal name="style-set" handler="on_style_set"/>
   <accelerator key="Escape" modifiers="0" signal="close"/>
 
   <child internal-child="vbox">
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to