[network-manager-applet] applet: remove pos from applet_menu_item_add_complex_separator_helper()



commit 995b6800661948c4f6760641effdee924f40c440
Author: Pavel Šimerda <psimerda redhat com>
Date:   Tue Nov 25 15:29:38 2014 +0100

    applet: remove pos from applet_menu_item_add_complex_separator_helper()
    
    Remove a redundant parameter that was allways set to -1 by the caller
    and the related code.

 src/applet-device-bond.c       |    2 +-
 src/applet-device-bridge.c     |    2 +-
 src/applet-device-broadband.c  |    2 +-
 src/applet-device-bt.c         |    2 +-
 src/applet-device-cdma.c       |    2 +-
 src/applet-device-ethernet.c   |    2 +-
 src/applet-device-gsm.c        |    2 +-
 src/applet-device-infiniband.c |    2 +-
 src/applet-device-team.c       |    2 +-
 src/applet-device-vlan.c       |    2 +-
 src/applet-device-wifi.c       |    2 +-
 src/applet-device-wimax.c      |    2 +-
 src/applet.c                   |    9 ++-------
 src/applet.h                   |    3 +--
 14 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/src/applet-device-bond.c b/src/applet-device-bond.c
index eab1a38..d47715d 100644
--- a/src/applet-device-bond.c
+++ b/src/applet-device-bond.c
@@ -73,7 +73,7 @@ bond_add_menu_item (NMDevice *device,
 
        if (!device || !nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-bridge.c b/src/applet-device-bridge.c
index 688e342..78bed30 100644
--- a/src/applet-device-bridge.c
+++ b/src/applet-device-bridge.c
@@ -73,7 +73,7 @@ bridge_add_menu_item (NMDevice *device,
 
        if (!device || !nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 2300c0d..856c5fe 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -767,7 +767,7 @@ add_menu_item (NMDevice *device,
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections)) {
                        for (iter = connections; iter; iter = g_slist_next (iter)) {
diff --git a/src/applet-device-bt.c b/src/applet-device-bt.c
index cf2f364..6f34c79 100644
--- a/src/applet-device-bt.c
+++ b/src/applet-device-bt.c
@@ -87,7 +87,7 @@ bt_add_menu_item (NMDevice *device,
        if (!nma_menu_device_check_unusable (device)) {
                /* Add menu items for existing bluetooth connections for this device */
                if (g_slist_length (connections)) {
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
                        applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
                }
        }
diff --git a/src/applet-device-cdma.c b/src/applet-device-cdma.c
index 995bfcd..af54091 100644
--- a/src/applet-device-cdma.c
+++ b/src/applet-device-cdma.c
@@ -298,7 +298,7 @@ cdma_add_menu_item (NMDevice *device,
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections)) {
                        for (iter = connections; iter; iter = g_slist_next (iter)) {
diff --git a/src/applet-device-ethernet.c b/src/applet-device-ethernet.c
index 7d1ef6a..7c37079 100644
--- a/src/applet-device-ethernet.c
+++ b/src/applet-device-ethernet.c
@@ -128,7 +128,7 @@ ethernet_add_menu_item (NMDevice *device,
 
        if (!nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index fd5e9dc..6a943ed 100644
--- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c
@@ -354,7 +354,7 @@ gsm_add_menu_item (NMDevice *device,
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections)) {
                        for (iter = connections; iter; iter = g_slist_next (iter)) {
diff --git a/src/applet-device-infiniband.c b/src/applet-device-infiniband.c
index 0a57fa5..fdf0c8b 100644
--- a/src/applet-device-infiniband.c
+++ b/src/applet-device-infiniband.c
@@ -124,7 +124,7 @@ infiniband_add_menu_item (NMDevice *device,
 
        if (!nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-team.c b/src/applet-device-team.c
index 3b11920..2986876 100644
--- a/src/applet-device-team.c
+++ b/src/applet-device-team.c
@@ -69,7 +69,7 @@ team_add_menu_item (NMDevice *device,
 
        if (!device || !nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-vlan.c b/src/applet-device-vlan.c
index 9bbe6b9..81d097f 100644
--- a/src/applet-device-vlan.c
+++ b/src/applet-device-vlan.c
@@ -187,7 +187,7 @@ vlan_add_menu_item (NMDevice *device,
 
        if (!device || !nma_menu_device_check_unusable (device)) {
                if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
-                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+                       applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (connections))
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 1060a73..e85a71e 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -833,7 +833,7 @@ wifi_add_menu_item (NMDevice *device,
                GSList *topmenu_items = NULL;
                guint32 num_for_toplevel = 5;
 
-               applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+               applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                if (g_slist_length (menu_items) == (num_for_toplevel + 1))
                        num_for_toplevel++;
diff --git a/src/applet-device-wimax.c b/src/applet-device-wimax.c
index 8780011..d724c14 100644
--- a/src/applet-device-wimax.c
+++ b/src/applet-device-wimax.c
@@ -273,7 +273,7 @@ wimax_add_menu_item (NMDevice *device,
        }
 
        if (g_slist_length (sorted)) {
-               applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
+               applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"));
 
                /* And add menu items for each NSP */
                for (iter = sorted; iter; iter = g_slist_next (iter)) {
diff --git a/src/applet.c b/src/applet.c
index a1304c1..8848822 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -698,8 +698,7 @@ applet_menu_item_activate_helper (NMDevice *device,
 void
 applet_menu_item_add_complex_separator_helper (GtkWidget *menu,
                                                NMApplet *applet,
-                                               const gchar* label,
-                                               int pos)
+                                               const gchar* label)
 {
        GtkWidget *menu_item = gtk_image_menu_item_new ();
        GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -719,11 +718,7 @@ applet_menu_item_add_complex_separator_helper (GtkWidget *menu,
                      "child", box,
                      "sensitive", FALSE,
                      NULL);
-       if (pos < 0)
-               gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-       else
-               gtk_menu_shell_insert (GTK_MENU_SHELL (menu), menu_item, pos);
-       return;
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
 }
 
 GtkWidget *
diff --git a/src/applet.h b/src/applet.h
index 4ea3d86..323ad8a 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -264,8 +264,7 @@ void applet_menu_item_disconnect_helper (NMDevice *device,
 
 void applet_menu_item_add_complex_separator_helper (GtkWidget *menu,
                                                     NMApplet *applet,
-                                                    const gchar* label,
-                                                    int pos);
+                                                    const gchar* label);
 
 GtkWidget*
 applet_menu_item_create_device_item_helper (NMDevice *device,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]