Created
May 21, 2012 03:29
-
-
Save shellexy/2760441 to your computer and use it in GitHub Desktop.
修复 indicator 菜单 bug https://bugs.launchpad.net/indicator-applet/+bug/965953
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
@@ -362,6 +362,21 @@ accessible_desc_update (IndicatorObject | |
return; | |
} | |
+static gboolean | |
+do_menu_reposition(gpointer menu) | |
+{ | |
+ gtk_widget_set_size_request(menu, -1, -1); | |
+ g_timeout_add(20, (GSourceFunc) gtk_menu_reposition, (gpointer) menu); | |
+ return 0; | |
+} | |
+ | |
+static void | |
+on_menuitem_show (GtkMenuItem *menuitem, gpointer menu) | |
+{ | |
+ gtk_widget_set_size_request(menu, -1, 500); | |
+ g_idle_add((GSourceFunc) do_menu_reposition, (gpointer) menu); | |
+} | |
+ | |
static void | |
entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar) | |
{ | |
@@ -435,6 +450,7 @@ entry_added (IndicatorObject * io, Indic | |
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); | |
} | |
place_in_menu(menubar, menuitem, io, entry); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment