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="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
<object class="GtkScrolledWindow" id="categoriesScrolledWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">never</property>
|
<property name="hscrollbar_policy">never</property>
|
||||||
|
@ -247,8 +247,13 @@ class pluginclass(object):
|
|||||||
self.favorites = []
|
self.favorites = []
|
||||||
|
|
||||||
self.content_holder.set_size_request(self.width, self.height)
|
self.content_holder.set_size_request(self.width, self.height)
|
||||||
self.categoriesBox.set_size_request(self.width / 3, -1)
|
# Calculate applicationsBox width based on categoryBox width, but since
|
||||||
self.applicationsBox.set_size_request(self.width / 2, -1)
|
# 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.buildingButtonList = False
|
||||||
self.stopBuildingButtonList = False
|
self.stopBuildingButtonList = False
|
||||||
@ -327,8 +332,7 @@ class pluginclass(object):
|
|||||||
def changePluginSize(self, settings, key, args):
|
def changePluginSize(self, settings, key, args):
|
||||||
if key == "width":
|
if key == "width":
|
||||||
self.width = settings.get_int(key)
|
self.width = settings.get_int(key)
|
||||||
self.categoriesBox.set_size_request(self.width / 3, -1)
|
self.applicationsBox.set_size_request(self.width - self.categoriesBox.get_preferred_width().natural_width, -1)
|
||||||
self.applicationsBox.set_size_request(self.width / 2, -1)
|
|
||||||
|
|
||||||
elif key == "height":
|
elif key == "height":
|
||||||
self.heigth = settings.get_int(key)
|
self.heigth = settings.get_int(key)
|
||||||
|
@ -101,12 +101,13 @@ GObject.type_register(IconManager)
|
|||||||
|
|
||||||
class easyButton(Gtk.Button):
|
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)
|
GObject.GObject.__init__(self)
|
||||||
self.connections = []
|
self.connections = []
|
||||||
self.iconName = iconName
|
self.iconName = iconName
|
||||||
self.iconSize = iconSize
|
self.iconSize = iconSize
|
||||||
self.showIcon = True
|
self.showIcon = True
|
||||||
|
self.ellipsis = ellipsis
|
||||||
|
|
||||||
self.set_relief(Gtk.ReliefStyle.NONE)
|
self.set_relief(Gtk.ReliefStyle.NONE)
|
||||||
self.set_size_request(buttonWidth, buttonHeight)
|
self.set_size_request(buttonWidth, buttonHeight)
|
||||||
@ -170,7 +171,8 @@ class easyButton(Gtk.Button):
|
|||||||
labelStyle.insert(attr)
|
labelStyle.insert(attr)
|
||||||
label.set_attributes(labelStyle)
|
label.set_attributes(labelStyle)
|
||||||
|
|
||||||
label.set_ellipsize(Pango.EllipsizeMode.END)
|
if self.ellipsis:
|
||||||
|
label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
label.set_alignment(0.0, 1.0)
|
label.set_alignment(0.0, 1.0)
|
||||||
label.set_max_width_chars(0)
|
label.set_max_width_chars(0)
|
||||||
label.show()
|
label.show()
|
||||||
@ -521,7 +523,7 @@ class FavApplicationLauncher(ApplicationLauncher):
|
|||||||
class CategoryButton(easyButton):
|
class CategoryButton(easyButton):
|
||||||
|
|
||||||
def __init__(self, iconName, iconSize, labels , f):
|
def __init__(self, iconName, iconSize, labels , f):
|
||||||
easyButton.__init__(self, iconName, iconSize, labels)
|
easyButton.__init__(self, iconName, iconSize, labels, ellipsis=False)
|
||||||
self.filter = f
|
self.filter = f
|
||||||
|
|
||||||
iconManager = IconManager()
|
iconManager = IconManager()
|
||||||
|
Loading…
Reference in New Issue
Block a user