Skip to content

Commit

Permalink
recent: Fix button visuals and interaction
Browse files Browse the repository at this point in the history
* The viewport is now colored consistently with the other plugins
* The buttons will now have a relief on hover
* Icons should render sharply on HiDPI displays
  • Loading branch information
vkareh authored and flexiondotorg committed Aug 14, 2019
1 parent 891cab5 commit b945cd1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mate_menu/plugins/recent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def __init__(self, mateMenuWin, toggleButton):
self.recentBox = self.builder.get_object("RecentBox")
self.recentVBox = self.builder.get_object( "vbox1" )

self.itemstocolor = [ self.builder.get_object("viewport1"), self.builder.get_object("viewport2") ]

#Specify plugin width
self.width = 250

Expand All @@ -78,8 +80,6 @@ def __init__(self, mateMenuWin, toggleButton):
clr_btn.connect("clicked", self.clrmenu)
clr_btn.connect("motion-notify-event", self.onMotion)
clr_btn.connect("enter-notify-event", self.onEnter)
clr_btn.connect("focus-in-event", self.onFocusIn)
clr_btn.connect("focus-out-event", self.onFocusOut)

def wake (self) :
pass
Expand Down Expand Up @@ -167,7 +167,7 @@ def AddRecentBtn( self, Name, RecentImage ):

ButtonIcon = Gtk.Image()
ButtonIcon.set_size_request( 20, -1 )
ButtonIcon.set_from_pixbuf(RecentImage)
ButtonIcon.set_from_gicon(RecentImage, Gtk.IconSize.MENU)
Box1.add( ButtonIcon )

Label1 = Gtk.Label( DispName )
Expand All @@ -191,9 +191,11 @@ def onEnter(self, widget, event):
self.mouse_entered = True

def onFocusIn(self, widget, event):
widget.set_relief( Gtk.ReliefStyle.HALF )
widget.set_state_flags( Gtk.StateFlags.PRELIGHT, False )

def onFocusOut(self, widget, event):
widget.set_relief( Gtk.ReliefStyle.NONE )
widget.unset_state_flags( Gtk.StateFlags.PRELIGHT )

def callback(self, widget, filename=None):
Expand All @@ -218,14 +220,13 @@ def GetRecent(self, *args, **kargs):
FileString=[]
IconString=[]
RecentInfo=self.RecManagerInstance.get_items()
# print(RecentInfo[0].get_icon(Gtk.IconSize.MENU))
count=0
MaxEntries=self.numentries
if self.numentries == -1:
MaxEntries=len(RecentInfo)
for items in RecentInfo:
FileString.append(items.get_uri_display())
IconString.append(items.get_icon(Gtk.IconSize.MENU))
IconString.append(items.get_gicon())
count+=1
if count >= MaxEntries:
break
Expand Down

0 comments on commit b945cd1

Please sign in to comment.