diff options
author | Dan Williams <dcbw@redhat.com> | 2017-07-31 11:47:50 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2018-01-09 10:33:51 -0600 |
commit | 33b8770c9a735051bd5f09f049901715e9f36bbf (patch) | |
tree | 37e2e1a6eac5c5e3afadd7e18be78781418b812e | |
parent | 28d0023c28504193c07bfe06d54cb79ee3212849 (diff) | |
download | network-manager-applet-33b8770c9a735051bd5f09f049901715e9f36bbf.tar.gz |
adsfasdfdcbw/applet-async-update
-rw-r--r-- | src/applet-device-broadband.c | 2 | ||||
-rw-r--r-- | src/applet.c | 25 | ||||
-rw-r--r-- | src/applet.h | 8 | ||||
-rw-r--r-- | src/menu-utils.c | 29 | ||||
-rw-r--r-- | src/menu-utils.h | 43 |
5 files changed, 71 insertions, 36 deletions
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c index c6a4e5fd..3bc1771f 100644 --- a/src/applet-device-broadband.c +++ b/src/applet-device-broadband.c @@ -797,7 +797,7 @@ add_menu_item (NMDevice *device, NMConnection *connection = NM_CONNECTION (connections->pdata[i]); if (connection != active) { - item = applet_new_menu_item_helper (connection, NULL, FALSE); + item = nma_new_menu_item_helper (connection, NULL, FALSE); add_connection_item (device, connection, item, menu, applet); } } diff --git a/src/applet.c b/src/applet.c index 858d2fe6..340d442a 100644 --- a/src/applet.c +++ b/src/applet.c @@ -530,29 +530,6 @@ applet_menu_item_activate_helper (NMDevice *device, applet_item_activate_info_destroy (info); } -GtkWidget * -applet_new_menu_item_helper (NMConnection *connection, - NMConnection *active, - gboolean add_active) -{ - GtkWidget *item = gtk_menu_item_new_with_label (""); - - if (add_active && (active == connection)) { - char *markup; - GtkWidget *label; - - /* Pure evil */ - label = gtk_bin_get_child (GTK_BIN (item)); - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - markup = g_markup_printf_escaped ("<b>%s</b>", nm_connection_get_id (connection)); - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free (markup); - } else - gtk_menu_item_set_label (GTK_MENU_ITEM (item), nm_connection_get_id (connection)); - - return item; -} - #define TITLE_TEXT_R ((double) 0x5e / 255.0 ) #define TITLE_TEXT_G ((double) 0x5e / 255.0 ) #define TITLE_TEXT_B ((double) 0x5e / 255.0 ) @@ -1529,7 +1506,7 @@ applet_add_connection_items (NMDevice *device, continue; } - item = applet_new_menu_item_helper (connection, active, (flag & NMA_ADD_ACTIVE)); + item = nma_new_menu_item_helper (connection, active, (flag & NMA_ADD_ACTIVE)); gtk_widget_set_sensitive (item, sensitive); gtk_widget_show_all (item); diff --git a/src/applet.h b/src/applet.h index cf7a21dc..3876db83 100644 --- a/src/applet.h +++ b/src/applet.h @@ -253,10 +253,6 @@ void applet_menu_item_activate_helper (NMDevice *device, void applet_menu_item_disconnect_helper (NMDevice *device, NMApplet *applet); -void applet_menu_item_add_complex_separator_helper (GtkWidget *menu, - NMApplet *applet, - const gchar* label); - GtkWidget* applet_menu_item_create_device_item_helper (NMDevice *device, NMApplet *applet, @@ -282,10 +278,6 @@ void applet_do_notify_with_pref (NMApplet *applet, const char *icon, const char *pref); -GtkWidget * applet_new_menu_item_helper (NMConnection *connection, - NMConnection *active, - gboolean add_active); - GdkPixbuf * nma_icon_check_and_load (const char *name, NMApplet *applet); diff --git a/src/menu-utils.c b/src/menu-utils.c index 38176c77..845b235d 100644 --- a/src/menu-utils.c +++ b/src/menu-utils.c @@ -46,9 +46,9 @@ nma_menu_add_text_item (GtkWidget *menu, char *text) } void -applet_menu_item_add_complex_separator_helper (GtkWidget *menu, - gboolean indicator_enabled, - const gchar *label) +nma_menu_item_add_complex_separator_helper (GtkWidget *menu, + gboolean indicator_enabled, + const gchar *label) { GtkWidget *menu_item, *box, *xlabel, *separator; @@ -82,3 +82,26 @@ applet_menu_item_add_complex_separator_helper (GtkWidget *menu, gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } + +GtkWidget * +nma_new_menu_item_helper (NMConnection *connection, + NMConnection *active, + gboolean add_active) +{ + GtkWidget *item = gtk_menu_item_new_with_label (""); + + if (add_active && (active == connection)) { + char *markup; + GtkWidget *label; + + /* Pure evil */ + label = gtk_bin_get_child (GTK_BIN (item)); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + markup = g_markup_printf_escaped ("<b>%s</b>", nm_connection_get_id (connection)); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (markup); + } else + gtk_menu_item_set_label (GTK_MENU_ITEM (item), nm_connection_get_id (connection)); + + return item; +} diff --git a/src/menu-utils.h b/src/menu-utils.h new file mode 100644 index 00000000..ce923b4e --- /dev/null +++ b/src/menu-utils.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * Dan Williams <dcbw@redhat.com> + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2011 - 2014 Red Hat, Inc. + */ + +#ifndef _MENU_UTILS_H_ +#define _MENU_UTILS_H_ + +#include <gtk/gtk.h> +#include <gdk/gdkx.h> + +#include <NetworkManager.h> + +void nma_menu_add_separator_item (GtkWidget *menu); + +void nma_menu_add_text_item (GtkWidget *menu, char *text); + +void nma_menu_item_add_complex_separator_helper (GtkWidget *menu, + gboolean indicator_enabled, + const gchar *label); + +GtkWidget *nma_new_menu_item_helper (NMConnection *connection, + NMConnection *active, + gboolean add_active); + +#endif /* _MENU_UTILS_H */ + |