[network-manager-applet: 2/6] applet: simplify nma_icons_init()



commit bfef54b05d3e1a299366c971e2e804a744a3a7c5
Author: Pavel Šimerda <psimerda redhat com>
Date:   Tue Feb 17 15:28:22 2015 +0100

    applet: simplify nma_icons_init()

 src/applet.c |   10 ++++------
 src/applet.h |    2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index ee027a5..6753958 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -705,10 +705,11 @@ applet_new_menu_item_helper (NMConnection *connection,
 {
        NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
        GtkWidget *item = gtk_image_menu_item_new_with_label ("");
-       char *markup;
-       GtkWidget *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);
@@ -3332,7 +3333,6 @@ error:
 
 static void nma_icons_init (NMApplet *applet)
 {
-       GdkScreen *screen;
        gboolean path_appended;
 
        if (applet->icon_theme) {
@@ -3342,9 +3342,7 @@ static void nma_icons_init (NMApplet *applet)
                g_object_unref (G_OBJECT (applet->icon_theme));
        }
 
-       screen = gtk_status_icon_get_screen (applet->status_icon);
-       g_assert (screen);
-       applet->icon_theme = gtk_icon_theme_get_for_screen (screen);
+       applet->icon_theme = gtk_icon_theme_get_for_screen (gtk_status_icon_get_screen (applet->status_icon));
 
        /* If not done yet, append our search path */
        path_appended = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (applet->icon_theme),
diff --git a/src/applet.h b/src/applet.h
index cf729af..2862919 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -129,13 +129,13 @@ typedef struct
        GtkIconTheme *  icon_theme;
        GHashTable *    icon_cache;
        GdkPixbuf *             fallback_icon;
+       int             icon_size;
 
        /* Active status icon pixbufs */
        GdkPixbuf *             icon_layers[ICON_LAYER_MAX + 1];
 
        /* Direct UI elements */
        GtkStatusIcon * status_icon;
-       int             icon_size;
 
        GtkWidget *             menu;
        GtkWidget *             context_menu;


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