Fix popups, need to fix focus now

This commit is contained in:
Michael Webster 2013-03-07 17:27:50 -05:00
parent 48ad5ef388
commit 614764a7e8
3 changed files with 84 additions and 43 deletions

View File

@ -1,51 +1,43 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<object class="GtkUIManager" id="uimanager1">
<ui>
<popup name="applicationsMenu"/>
</ui>
</object>
<object class="GtkUIManager" id="uimanager2">
<ui>
<popup name="favoritesMenu"/>
</ui>
</object>
<object class="GtkUIManager" id="uimanager3">
<ui>
<popup name="favoritesMenuExtra"/>
</ui>
</object>
<!-- interface-requires gtk+ 2.6 --> <!-- interface-requires gtk+ 2.6 -->
<!-- interface-naming-policy toplevel-contextual --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="mainWindow"> <object class="GtkWindow" id="mainWindow">
<property name="width_request">169</property> <property name="width_request">169</property>
<property name="height_request">227</property> <property name="height_request">227</property>
<property name="can_focus">False</property>
<property name="window_position">mouse</property> <property name="window_position">mouse</property>
<property name="gravity">static</property> <property name="gravity">static</property>
<signal handler="on_window1_destroy" name="destroy"/> <signal name="destroy" handler="on_window1_destroy" swapped="no"/>
<child> <child>
<object class="GtkEventBox" id="Applications"> <object class="GtkEventBox" id="Applications">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkVBox" id="vbox4"> <object class="GtkVBox" id="vbox4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkNotebook" id="notebook2"> <object class="GtkNotebook" id="notebook2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_tabs">False</property> <property name="show_tabs">False</property>
<property name="show_border">False</property> <property name="show_border">False</property>
<property name="tab_border">14</property> <property name="tab_border">14</property>
<child> <child>
<object class="GtkVBox" id="vbox5"> <object class="GtkVBox" id="vbox5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child> <child>
<object class="GtkHBox" id="hbox8"> <object class="GtkHBox" id="hbox8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property> <property name="homogeneous">True</property>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="xpad">15</property> <property name="xpad">15</property>
<property name="ypad">10</property> <property name="ypad">10</property>
@ -53,6 +45,8 @@
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -62,10 +56,12 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<child> <child>
<object class="GtkAlignment" id="alignment3"> <object class="GtkAlignment" id="alignment3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property> <property name="xalign">1</property>
<property name="xscale">0</property> <property name="xscale">0</property>
<property name="yscale">0</property> <property name="yscale">0</property>
@ -73,24 +69,31 @@
<child> <child>
<object class="GtkHBox" id="hbox10"> <object class="GtkHBox" id="hbox10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="label7"> <object class="GtkLabel" id="label7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">All _Applications</property> <property name="label" translatable="yes">All _Applications</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkImage" id="image4"> <object class="GtkImage" id="image4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">5</property> <property name="xpad">5</property>
<property name="stock">gtk-go-forward</property> <property name="stock">gtk-go-forward</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -100,6 +103,8 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">5</property> <property name="padding">5</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">1</property> <property name="position">1</property>
@ -115,12 +120,14 @@
<child> <child>
<object class="GtkViewport" id="viewport2"> <object class="GtkViewport" id="viewport2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="resize_mode">queue</property> <property name="resize_mode">queue</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkTable" id="favoritesBox"> <object class="GtkTable" id="favoritesBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child> <child>
<placeholder/> <placeholder/>
@ -129,6 +136,8 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -140,13 +149,16 @@
<child> <child>
<object class="GtkVBox" id="vbox1"> <object class="GtkVBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkHBox" id="hbox3"> <object class="GtkHBox" id="hbox3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property> <property name="homogeneous">True</property>
<child> <child>
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="xpad">15</property> <property name="xpad">15</property>
<property name="ypad">10</property> <property name="ypad">10</property>
@ -154,6 +166,8 @@
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -163,10 +177,12 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<child> <child>
<object class="GtkAlignment" id="alignment2"> <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property> <property name="xalign">1</property>
<property name="xscale">0</property> <property name="xscale">0</property>
<property name="yscale">0</property> <property name="yscale">0</property>
@ -174,24 +190,31 @@
<child> <child>
<object class="GtkHBox" id="hbox4"> <object class="GtkHBox" id="hbox4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="label3"> <object class="GtkLabel" id="label3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Favorites</property> <property name="label" translatable="yes">_Favorites</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkImage" id="image3"> <object class="GtkImage" id="image3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">5</property> <property name="xpad">5</property>
<property name="stock">gtk-go-forward</property> <property name="stock">gtk-go-forward</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -201,6 +224,8 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">5</property> <property name="padding">5</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">1</property> <property name="position">1</property>
@ -216,6 +241,7 @@
<child> <child>
<object class="GtkHBox" id="hbox5"> <object class="GtkHBox" id="hbox5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property> <property name="visible">True</property>
@ -225,22 +251,27 @@
<child> <child>
<object class="GtkViewport" id="viewport1"> <object class="GtkViewport" id="viewport1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkVBox" id="categoriesBox"> <object class="GtkVBox" id="categoriesBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkVSeparator" id="vseparator1"> <object class="GtkVSeparator" id="vseparator1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</object> </object>
<packing> <packing>
@ -260,31 +291,42 @@
<child> <child>
<object class="GtkViewport" id="viewport3"> <object class="GtkViewport" id="viewport3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
<object class="GtkVBox" id="applicationsBox"> <object class="GtkVBox" id="applicationsBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="position">1</property>
</packing>
</child> </child>
<child type="tab"> <child type="tab">
<placeholder/> <placeholder/>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
@ -293,9 +335,11 @@
<property name="width_request">227</property> <property name="width_request">227</property>
<property name="height_request">30</property> <property name="height_request">30</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkLabel" id="searchLabel"> <object class="GtkLabel" id="searchLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;span weight="bold"&gt;Search:&lt;/span&gt;</property> <property name="label" translatable="yes">&lt;span weight="bold"&gt;Search:&lt;/span&gt;</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
@ -315,9 +359,15 @@
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="activates_default">True</property> <property name="activates_default">True</property>
<signal handler="on_entry1_changed" name="changed"/> <property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="on_entry1_changed" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -329,9 +379,10 @@
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<property name="focus_on_click">False</property> <property name="focus_on_click">False</property>
<signal handler="on_button17_clicked" name="clicked"/> <signal name="clicked" handler="on_button17_clicked" swapped="no"/>
<child> <child>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
<property name="visible">True</property> <property name="visible">True</property>
@ -363,13 +414,4 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkMenu" constructor="uimanager1" id="applicationsMenu"/>
<object class="GtkMenu" constructor="uimanager2" id="favoritesMenu">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</object>
<object class="GtkMenu" constructor="uimanager3" id="favoritesMenuExtra">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</object>
</interface> </interface>

View File

@ -873,7 +873,9 @@ class pluginclass( object ):
insertBefore = True insertBefore = True
if widget.type == "location": if widget.type == "location":
mTree = self.builder.get_object( "favoritesMenu" ) mTree = Gtk.Menu()
mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK |
Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK)
#i18n #i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop")) desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
@ -919,12 +921,14 @@ class pluginclass( object ):
mTree.show_all() mTree.show_all()
#mTree.popup( None, None, None, ev.button, ev.time ) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None)
# self.mintMenuWin.grab() # self.mintMenuWin.grab()
else: else:
mTree = self.builder.get_object( "favoritesMenuExtra" ) mTree = Gtk.Menu()
mTree.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK |
Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK)
#i18n #i18n
removeMenuItem = Gtk.MenuItem(_("Remove")) removeMenuItem = Gtk.MenuItem(_("Remove"))
insertSpaceMenuItem = Gtk.MenuItem(_("Insert space")) insertSpaceMenuItem = Gtk.MenuItem(_("Insert space"))
@ -937,14 +941,13 @@ class pluginclass( object ):
removeMenuItem.connect( "activate", self.onFavoritesRemove, widget ) removeMenuItem.connect( "activate", self.onFavoritesRemove, widget )
insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore ) insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore )
insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore ) insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore )
#mTree.popup( None, None, None, ev.button, ev.time )
gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
# self.mintMenuWin.grab() # self.mintMenuWin.grab()
return True return True
def menuPopup( self, widget, event ): def menuPopup( self, widget, event ):
if event.button == 3: if event.button == 3:
mTree = self.builder.get_object ( "applicationsMenu" ) mTree = Gtk.Menu()
#i18n #i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop")) desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
panelMenuItem = Gtk.MenuItem(_("Add to panel")) panelMenuItem = Gtk.MenuItem(_("Add to panel"))
@ -1003,13 +1006,10 @@ class pluginclass( object ):
mTree.connect( 'deactivate', self.onMenuPopupDeactivate) mTree.connect( 'deactivate', self.onMenuPopupDeactivate)
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, 0, 0) gtk.gtk_menu_popup(hash(mTree), None, None, None, None, 0, 0)
#mTree.popup( None, None, None, None, event.button, event.time )
print "sdfdfs"
return True
def onMenuPopupDeactivate( self, widget): def onMenuPopupDeactivate( self, widget):
print "what" pass
self.mintMenuWin.grab() #self.mintMenuWin.grab()
def searchPopup( self, widget=None, event=None ): def searchPopup( self, widget=None, event=None ):
menu = Gtk.Menu() menu = Gtk.Menu()
@ -1084,9 +1084,9 @@ class pluginclass( object ):
menu.append(menuItem) menu.append(menuItem)
menu.show_all() menu.show_all()
#menu.popup( None, None, self.pos_func, 3, 0)
gtk.gtk_menu_popup(hash(menu), None, None, None, None, 3, 0) gtk.gtk_menu_popup(hash(menu), None, None, None, None, 3, 0)
#menu.popup( None, None, None, 3, 0)
#menu.attach_to_widget(self.searchButton, None) #menu.attach_to_widget(self.searchButton, None)
#menu.reposition() #menu.reposition()
#menu.reposition() #menu.reposition()

View File

@ -259,7 +259,6 @@ class pluginclass( object ):
trashMenu.show_all() trashMenu.show_all()
emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget ) emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget )
gtk.gtk_menu_popup(hash(trashMenu), None, None, None, None, 3, 0) gtk.gtk_menu_popup(hash(trashMenu), None, None, None, None, 3, 0)
#trashMenu.popup( None, None, None, event.button, event.time )
#self.mintMenuWin.grab() #self.mintMenuWin.grab()
return True return True