mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-28 15:20:49 +00:00
foreign-menu: Don't show empty foreign menu on secondary displays
When using ovirt://, the foreign menu will only be shown in the primary window after getting notified about OvirtForeignMenu::files (ie when it managed to fetch some ISO files to show in the foreign menu). However, for secondary windows, the foreign menu will be added to the window even if there are no files to show. This commit makes sure we destroy the window foreign menu whenever it would be empty.
This commit is contained in:
parent
f2967d0d88
commit
32d0ae09b8
@ -467,6 +467,9 @@ GtkWidget *ovirt_foreign_menu_get_gtk_menu(OvirtForeignMenu *foreign_menu)
|
||||
char *current_iso;
|
||||
|
||||
g_debug("Creating GtkMenu for foreign menu");
|
||||
if (foreign_menu->priv->iso_names == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
current_iso = ovirt_foreign_menu_get_current_iso_name(foreign_menu);
|
||||
gtk_menu = gtk_menu_new();
|
||||
for (it = foreign_menu->priv->iso_names; it != NULL; it = it->next) {
|
||||
|
||||
@ -757,7 +757,12 @@ ovirt_foreign_menu_update(RemoteViewer *app, VirtViewerWindow *win)
|
||||
}
|
||||
|
||||
submenu = ovirt_foreign_menu_get_gtk_menu(app->priv->ovirt_foreign_menu);
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
|
||||
if (submenu != NULL) {
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
|
||||
} else {
|
||||
/* No items to show, no point in showing the menu */
|
||||
g_object_set_data(G_OBJECT(win), "foreign-menu", NULL);
|
||||
}
|
||||
|
||||
gtk_widget_show_all(menu);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user