summaryrefslogtreecommitdiff
path: root/ui/gtk/profile_dlg.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-11-22 15:25:27 +0100
committerAnders Broman <a.broman58@gmail.com>2015-11-23 05:45:34 +0000
commit35e5523dd2d90b6a964961b2eaea1457495b4a78 (patch)
tree7efe62cd9efd566e7089839ea62f829cc5111c7a /ui/gtk/profile_dlg.c
parentc5fb402222be88e95e26793ffca9aa1c15c70732 (diff)
downloadwireshark-35e5523dd2d90b6a964961b2eaea1457495b4a78.tar.gz
Qt: Improved profiles popup menu
* Don’t add a global profile if having a personal copy. * Fetch profiles from _current_ profiles list. * Separate personal and global profiles. * Use bold and checked for the the current profile. * Fixed selection of the current profile in the manage profiles dialog. * Aligned GTK version with Qt version, removed the “New from Global” sub menu. Change-Id: I2326b39f7d04411000b3c014e3775284392c48c7 Ping-Bug: 11704 Reviewed-on: https://code.wireshark.org/review/12034 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/gtk/profile_dlg.c')
-rw-r--r--ui/gtk/profile_dlg.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/ui/gtk/profile_dlg.c b/ui/gtk/profile_dlg.c
index 7e03ddd8eb..a96658c6de 100644
--- a/ui/gtk/profile_dlg.c
+++ b/ui/gtk/profile_dlg.c
@@ -644,11 +644,11 @@ profile_show_popup_cb(GtkWidget *w _U_, GdkEvent *event, gpointer user_data _U_)
{
GdkEventButton *bevent = (GdkEventButton *)event;
const gchar *profile_name = get_profile_name();
+ gboolean separator_added = FALSE;
GList *fl_entry;
profile_def *profile;
GtkWidget *menu;
GtkWidget *menu_item;
- GtkWidget *sub_menu = NULL;
menu = gtk_menu_new();
@@ -679,7 +679,13 @@ profile_show_popup_cb(GtkWidget *w _U_, GdkEvent *event, gpointer user_data _U_)
while (fl_entry && fl_entry->data) {
profile = (profile_def *)fl_entry->data;
- if (!profile->is_global) {
+ if (!profile->is_global || !profile_exists(profile->name, FALSE)) {
+ if (profile->is_global && !separator_added) {
+ menu_item = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+ separator_added = TRUE;
+ }
menu_item = gtk_check_menu_item_new_with_label(profile->name);
if (strcmp(profile->name, profile_name)==0) {
/* Check current profile */
@@ -689,27 +695,6 @@ profile_show_popup_cb(GtkWidget *w _U_, GdkEvent *event, gpointer user_data _U_)
g_signal_connect(menu_item, "activate", G_CALLBACK(select_profile_cb), g_strdup(profile->name));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
gtk_widget_show(menu_item);
- } else {
- if (!sub_menu) {
- menu_item = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
-
- menu_item = gtk_menu_item_new_with_label("New from Global");
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
-
- sub_menu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), sub_menu);
- }
-
- menu_item = gtk_menu_item_new_with_label(profile->name);
- g_signal_connect(menu_item, "activate", G_CALLBACK(select_profile_cb), g_strdup(profile->name));
- if (profile_exists(profile->name, FALSE)) {
- gtk_widget_set_sensitive(menu_item, FALSE);
- }
- gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), menu_item);
- gtk_widget_show(menu_item);
}
fl_entry = g_list_next(fl_entry);
}