make-indicator-applet 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/sh
#
#    Copyright (C) 2008-2010  Rubén Rodríguez <ruben@trisquel.info>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#

20 21
VERSION=3
COMPONENT=main
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

. ./config

# Fixes https://bugs.launchpad.net/indicator-applet/+bug/965953

cat << EOF | patch -p1
--- indicator-applet-12.10.2+14.04.20140403/src/applet-main.c	2014-04-03 01:10:57.000000000 +0000
+++ indicator-applet-12.10.2+14.04.20140403.mod/src/applet-main.c	2014-05-20 21:34:34.856698376 +0000
@@ -364,6 +364,24 @@
   return;
 }
 
+static void
+do_menu_reposition(gpointer menu)
+{
+  gtk_widget_set_size_request(menu, 0,0);
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
+  gtk_menu_reposition(menu);
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
+}
+
+static void
+on_menuitem_show (GtkMenuItem *menuitem, gpointer menu)
+{
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL,NULL);
+  g_idle_add((GSourceFunc) do_menu_reposition, (gpointer) menu);
+}
+
 static GtkWidget*
 create_menuitem (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
 {
@@ -415,6 +433,7 @@
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
   }
 
+  g_signal_connect(G_OBJECT(entry->menu), "show", G_CALLBACK(on_menuitem_show), entry->menu); 
   place_in_menu(menubar, menuitem, io, entry);
 
   return menuitem;
EOF

65 66 67 68
# Show datetime in standard applet
sed '/datetime/,/}/d' -i src/applet-main.c


69 70 71 72
changelog "Fixes LP:965953"

compile