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>
<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-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="mainWindow">
<property name="width_request">169</property>
<property name="height_request">227</property>
<property name="can_focus">False</property>
<property name="window_position">mouse</property>
<property name="gravity">static</property>
<signal handler="on_window1_destroy" name="destroy"/>
<signal name="destroy" handler="on_window1_destroy" swapped="no"/>
<child>
<object class="GtkEventBox" id="Applications">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkNotebook" id="notebook2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<property name="tab_border">14</property>
<child>
<object class="GtkVBox" id="vbox5">
<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>
<child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">15</property>
<property name="ypad">10</property>
@ -53,6 +45,8 @@
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -62,10 +56,12 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
@ -73,24 +69,31 @@
<child>
<object class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">All _Applications</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">5</property>
<property name="stock">gtk-go-forward</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -100,6 +103,8 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="pack_type">end</property>
<property name="position">1</property>
@ -115,12 +120,14 @@
<child>
<object class="GtkViewport" id="viewport2">
<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="resize_mode">queue</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkTable" id="favoritesBox">
<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>
<child>
<placeholder/>
@ -129,6 +136,8 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -140,13 +149,16 @@
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">15</property>
<property name="ypad">10</property>
@ -154,6 +166,8 @@
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -163,10 +177,12 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
@ -174,24 +190,31 @@
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Favorites</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">5</property>
<property name="stock">gtk-go-forward</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -201,6 +224,8 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="pack_type">end</property>
<property name="position">1</property>
@ -216,6 +241,7 @@
<child>
<object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
@ -225,22 +251,27 @@
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkVBox" id="categoriesBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator1">
<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>
</object>
<packing>
@ -260,31 +291,42 @@
<child>
<object class="GtkViewport" id="viewport3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkVBox" id="applicationsBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@ -293,9 +335,11 @@
<property name="width_request">227</property>
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="searchLabel">
<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="use_markup">True</property>
</object>
@ -315,9 +359,15 @@
<property name="can_default">True</property>
<property name="has_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>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -329,9 +379,10 @@
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</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>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
@ -363,13 +414,4 @@
</object>
</child>
</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>

View File

@ -873,7 +873,9 @@ class pluginclass( object ):
insertBefore = True
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
desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
@ -919,12 +921,14 @@ class pluginclass( object ):
mTree.show_all()
#mTree.popup( None, None, None, ev.button, ev.time )
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None)
gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
# self.mintMenuWin.grab()
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
removeMenuItem = Gtk.MenuItem(_("Remove"))
insertSpaceMenuItem = Gtk.MenuItem(_("Insert space"))
@ -937,14 +941,13 @@ class pluginclass( object ):
removeMenuItem.connect( "activate", self.onFavoritesRemove, widget )
insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, 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)
# self.mintMenuWin.grab()
return True
def menuPopup( self, widget, event ):
if event.button == 3:
mTree = self.builder.get_object ( "applicationsMenu" )
mTree = Gtk.Menu()
#i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
panelMenuItem = Gtk.MenuItem(_("Add to panel"))
@ -1003,13 +1006,10 @@ class pluginclass( object ):
mTree.connect( 'deactivate', self.onMenuPopupDeactivate)
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):
print "what"
self.mintMenuWin.grab()
pass
#self.mintMenuWin.grab()
def searchPopup( self, widget=None, event=None ):
menu = Gtk.Menu()
@ -1084,9 +1084,9 @@ class pluginclass( object ):
menu.append(menuItem)
menu.show_all()
#menu.popup( None, None, self.pos_func, 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.reposition()
#menu.reposition()

View File

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