indicator-applet-scroll-arrows.patch 1.43 KB
Newer Older
Ruben Rodriguez's avatar
Ruben Rodriguez committed
1 2 3 4 5
# Fixes https://bugs.launchpad.net/indicator-applet/+bug/965953

diff --git indicator-applet/src/applet-main.c indicator-applet/src/applet-main.c
--- indicator-applet/src/applet-main.c
+++ indicator-applet/src/applet-main.c
6
@@ -362,6 +362,24 @@ accessible_desc_update (IndicatorObject 
Ruben Rodriguez's avatar
Ruben Rodriguez committed
7 8 9 10 11 12 13
   return;
 }
 
+static gboolean
+do_menu_reposition(gpointer menu)
+{
+  gtk_widget_set_size_request(menu, -1, -1);
14 15
+  gtk_menu_reposition(menu);
+  g_timeout_add(20, (GSourceFunc) gtk_menu_reposition, (gpointer) menu);
Ruben Rodriguez's avatar
Ruben Rodriguez committed
16 17 18 19 20 21
+  g_timeout_add(20, (GSourceFunc) gtk_menu_reposition, (gpointer) menu);
+  return 0;
+}
+
+static void
+on_menuitem_show (GtkMenuItem *menuitem, gpointer menu)
22
+{ 
Ruben Rodriguez's avatar
Ruben Rodriguez committed
23
+  gtk_widget_set_size_request(menu, -1, 500);
24
+  gtk_menu_reposition(menu);
Ruben Rodriguez's avatar
Ruben Rodriguez committed
25 26 27 28 29 30
+  g_idle_add((GSourceFunc) do_menu_reposition, (gpointer) menu);
+}
+
 static void
 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
 {
31
@@ -435,6 +450,11 @@ entry_added (IndicatorObject * io, Indic
Ruben Rodriguez's avatar
Ruben Rodriguez committed
32 33 34 35
 
   if (entry->menu != NULL) {
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
+    g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(on_menuitem_show), entry->menu);
36 37 38 39
+    gtk_menu_set_reserve_toggle_size(entry->menu, TRUE);
+    gtk_widget_set_size_request(entry->menu, -1, -1);
+    gtk_widget_set_size_request(entry->menu, -1, 500);
+    gtk_menu_reposition(entry->menu);
Ruben Rodriguez's avatar
Ruben Rodriguez committed
40 41 42
   }
 
   place_in_menu(menubar, menuitem, io, entry);