Applications: Categories column always use natural width
Ported from https://github.com/linuxmint/mintmenu/pull/227
This commit is contained in:
parent
7fa91f721e
commit
65c9c3e003
@ -265,7 +265,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<object class="GtkScrolledWindow" id="categoriesScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
|
@ -247,8 +247,13 @@ class pluginclass(object):
|
||||
self.favorites = []
|
||||
|
||||
self.content_holder.set_size_request(self.width, self.height)
|
||||
self.categoriesBox.set_size_request(self.width / 3, -1)
|
||||
self.applicationsBox.set_size_request(self.width / 2, -1)
|
||||
# Calculate applicationsBox width based on categoryBox width, but since
|
||||
# we won't have that until the menu has been shown go with an estimate
|
||||
self.applicationsBox.set_size_request(self.width - 155, -1)
|
||||
# Add margin for scrollbars to categoriesBox
|
||||
categoriesScrolledWindow = self.builder.get_object("categoriesScrolledWindow")
|
||||
scrollbar_width = categoriesScrolledWindow.get_vscrollbar().get_preferred_width()
|
||||
self.categoriesBox.set_margin_right(scrollbar_width.natural_width + 2)
|
||||
|
||||
self.buildingButtonList = False
|
||||
self.stopBuildingButtonList = False
|
||||
@ -327,8 +332,7 @@ class pluginclass(object):
|
||||
def changePluginSize(self, settings, key, args):
|
||||
if key == "width":
|
||||
self.width = settings.get_int(key)
|
||||
self.categoriesBox.set_size_request(self.width / 3, -1)
|
||||
self.applicationsBox.set_size_request(self.width / 2, -1)
|
||||
self.applicationsBox.set_size_request(self.width - self.categoriesBox.get_preferred_width().natural_width, -1)
|
||||
|
||||
elif key == "height":
|
||||
self.heigth = settings.get_int(key)
|
||||
|
@ -101,12 +101,13 @@ GObject.type_register(IconManager)
|
||||
|
||||
class easyButton(Gtk.Button):
|
||||
|
||||
def __init__(self, iconName, iconSize, labels = None, buttonWidth = -1, buttonHeight = -1):
|
||||
def __init__(self, iconName, iconSize, labels=None, buttonWidth=-1, buttonHeight=-1, ellipsis=True):
|
||||
GObject.GObject.__init__(self)
|
||||
self.connections = []
|
||||
self.iconName = iconName
|
||||
self.iconSize = iconSize
|
||||
self.showIcon = True
|
||||
self.ellipsis = ellipsis
|
||||
|
||||
self.set_relief(Gtk.ReliefStyle.NONE)
|
||||
self.set_size_request(buttonWidth, buttonHeight)
|
||||
@ -170,6 +171,7 @@ class easyButton(Gtk.Button):
|
||||
labelStyle.insert(attr)
|
||||
label.set_attributes(labelStyle)
|
||||
|
||||
if self.ellipsis:
|
||||
label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||
label.set_alignment(0.0, 1.0)
|
||||
label.set_max_width_chars(0)
|
||||
@ -521,7 +523,7 @@ class FavApplicationLauncher(ApplicationLauncher):
|
||||
class CategoryButton(easyButton):
|
||||
|
||||
def __init__(self, iconName, iconSize, labels , f):
|
||||
easyButton.__init__(self, iconName, iconSize, labels)
|
||||
easyButton.__init__(self, iconName, iconSize, labels, ellipsis=False)
|
||||
self.filter = f
|
||||
|
||||
iconManager = IconManager()
|
||||
|
Loading…
Reference in New Issue
Block a user