[gedit] tab: remove standard icon from tab label



commit b3b10f7aef276b413f0399391164bc4dc2427069
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Sun Oct 13 00:46:27 2013 +0200

    tab: remove standard icon from tab label

 gedit/gedit-tab-label.c |   16 ++++++++++---
 gedit/gedit-tab.c       |   56 +----------------------------------------------
 2 files changed, 13 insertions(+), 59 deletions(-)
---
diff --git a/gedit/gedit-tab-label.c b/gedit/gedit-tab-label.c
index 22c446b..d44061f 100644
--- a/gedit/gedit-tab-label.c
+++ b/gedit/gedit-tab-label.c
@@ -175,12 +175,20 @@ sync_state (GeditTab      *tab,
                GdkPixbuf *pixbuf;
 
                pixbuf = _gedit_tab_get_icon (tab);
-               gtk_image_set_from_pixbuf (GTK_IMAGE (tab_label->priv->icon), pixbuf);
 
                if (pixbuf != NULL)
-                       g_object_unref (pixbuf);
-
-               gtk_widget_show (tab_label->priv->icon);
+               {
+                       gtk_image_set_from_pixbuf (GTK_IMAGE (tab_label->priv->icon),
+                                                  pixbuf);
+
+                       g_clear_object (&pixbuf);
+
+                       gtk_widget_show (tab_label->priv->icon);
+               }
+               else
+               {
+                       gtk_widget_hide (tab_label->priv->icon);
+               }
 
                gtk_spinner_stop (GTK_SPINNER (tab_label->priv->spinner));
                gtk_widget_hide (tab_label->priv->spinner);
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 2dce78c..12d2864 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2017,51 +2017,6 @@ get_stock_icon (GtkIconTheme *theme,
        return resize_icon (pixbuf, size);
 }
 
-static GdkPixbuf *
-get_icon (GtkIconTheme *theme,
-         GFile        *location,
-         gint          size)
-{
-       GdkPixbuf *pixbuf;
-       GtkIconInfo *icon_info;
-       GFileInfo *info;
-       GIcon *gicon;
-
-       if (location == NULL)
-               return get_stock_icon (theme, GTK_STOCK_FILE, size);
-
-       /* FIXME: Doing a sync stat is bad, this should be fixed */
-       info = g_file_query_info (location,
-                                 G_FILE_ATTRIBUTE_STANDARD_ICON,
-                                 G_FILE_QUERY_INFO_NONE,
-                                 NULL,
-                                 NULL);
-       if (info == NULL)
-               return get_stock_icon (theme, GTK_STOCK_FILE, size);
-
-       gicon = g_file_info_get_icon (info);
-
-       if (gicon == NULL)
-       {
-               g_object_unref (info);
-               return get_stock_icon (theme, GTK_STOCK_FILE, size);
-       }
-
-       icon_info = gtk_icon_theme_lookup_by_gicon (theme, gicon, size, 0);
-       g_object_unref (info);
-
-       if (icon_info == NULL)
-               return get_stock_icon (theme, GTK_STOCK_FILE, size);
-
-       pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
-       g_object_unref (icon_info);
-
-       if (pixbuf == NULL)
-               return get_stock_icon (theme, GTK_STOCK_FILE, size);
-
-       return resize_icon (pixbuf, size);
-}
-
 /* FIXME: add support for theme changed. I think it should be as easy as
    call g_object_notify (tab, "name") when the icon theme changes */
 GdkPixbuf *
@@ -2131,16 +2086,7 @@ _gedit_tab_get_icon (GeditTab *tab)
 
                default:
                {
-                       GFile *location;
-                       GeditDocument *doc;
-
-                       doc = gedit_tab_get_document (tab);
-
-                       location = gedit_document_get_location (doc);
-                       pixbuf = get_icon (theme, location, icon_size);
-
-                       if (location)
-                               g_object_unref (location);
+                       pixbuf = NULL;
                }
        }
 


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