Skip to content
Snippets Groups Projects
make-indicator-applet 2.1 KiB
Newer Older
Ruben Rodriguez's avatar
Ruben Rodriguez committed
#!/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
#

VERSION=3
COMPONENT=main
Ruben Rodriguez's avatar
Ruben Rodriguez committed

. ./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

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


Ruben Rodriguez's avatar
Ruben Rodriguez committed
changelog "Fixes LP:965953"

compile