[libwnck/wip/muktupavels/issue-142: 2/2] selector: restore width limit




commit 6583d04fefa09585bb591ab895dd720db865c687
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Oct 11 17:46:59 2022 +0300

    selector: restore width limit
    
    One more regression from c671d1e2f6d9.

 libwnck/selector.c                     | 4 ++++
 libwnck/wnck-image-menu-item-private.h | 3 +++
 libwnck/wnck-image-menu-item.c         | 7 +++++++
 3 files changed, 14 insertions(+)
---
diff --git a/libwnck/selector.c b/libwnck/selector.c
index 4cf61896..26fb5ba8 100644
--- a/libwnck/selector.c
+++ b/libwnck/selector.c
@@ -525,6 +525,8 @@ wnck_selector_drag_data_get (GtkWidget          *widget,
                          8, (guchar *)&xid, sizeof (gulong));
 }
 
+#define SELECTOR_MAX_WIDTH 50
+
 static GtkWidget *
 wnck_selector_item_new (WnckSelector *selector,
                         const gchar *label, WnckWindow *window)
@@ -535,6 +537,8 @@ wnck_selector_item_new (WnckSelector *selector,
   };
 
   item = wnck_image_menu_item_new_with_label (label);
+  _wnck_image_menu_item_set_max_chars (WNCK_IMAGE_MENU_ITEM (item),
+                                       SELECTOR_MAX_WIDTH);
 
   if (window != NULL)
     {
diff --git a/libwnck/wnck-image-menu-item-private.h b/libwnck/wnck-image-menu-item-private.h
index 265289db..e5a3288d 100644
--- a/libwnck/wnck-image-menu-item-private.h
+++ b/libwnck/wnck-image-menu-item-private.h
@@ -41,6 +41,9 @@ void       wnck_image_menu_item_make_label_bold            (WnckImageMenuItem *i
 
 void       wnck_image_menu_item_make_label_normal          (WnckImageMenuItem *item);
 
+void       _wnck_image_menu_item_set_max_chars             (WnckImageMenuItem *self,
+                                                            int                n_chars);
+
 G_END_DECLS
 
 #endif
diff --git a/libwnck/wnck-image-menu-item.c b/libwnck/wnck-image-menu-item.c
index 22bc3f08..3041ae64 100644
--- a/libwnck/wnck-image-menu-item.c
+++ b/libwnck/wnck-image-menu-item.c
@@ -237,3 +237,10 @@ wnck_image_menu_item_make_label_normal (WnckImageMenuItem *item)
 {
   _make_gtk_label_normal (GTK_LABEL (item->accel_label));
 }
+
+void
+_wnck_image_menu_item_set_max_chars (WnckImageMenuItem *self,
+                                     int                n_chars)
+{
+  gtk_label_set_max_width_chars (GTK_LABEL (self->accel_label), n_chars);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]