]> Eric's Git Repo - ericlaunch.git/commitdiff
Added icon scaling and respect of NoDisplay option on desktop files
authorEric Wertz <ericdwertz@gmail.com>
Tue, 26 Dec 2017 13:53:57 +0000 (08:53 -0500)
committerEric Wertz <ericdwertz@gmail.com>
Tue, 26 Dec 2017 13:53:57 +0000 (08:53 -0500)
main.c

diff --git a/main.c b/main.c
index b88a9015be6783575a031e26c1d233ad2aa760a4..e0ee7fdbea286e6286f6a70614e6cac8167f6862 100755 (executable)
--- a/main.c
+++ b/main.c
@@ -46,6 +46,7 @@ gboolean windowed;
 GdkPixbuf* get_app_icon(const char* name,int size)
 {
     GdkPixbuf* out;
+    int width, height;
        GtkIconTheme* theme=gtk_icon_theme_get_default();
        out = gtk_icon_theme_load_icon(theme,name,size,0,NULL);
     
@@ -57,6 +58,20 @@ GdkPixbuf* get_app_icon(const char* name,int size)
         out = gtk_icon_theme_load_icon( theme, "application-x-executable", size, 0, NULL );
     }
 
+    //Check/fix size
+    width = gdk_pixbuf_get_width( out );
+    height = gdk_pixbuf_get_height( out );
+
+    if (width != size || height != size) 
+    {
+        GdkPixbuf* temp = out;
+        out = gdk_pixbuf_scale_simple(temp,
+                                         size,
+                                         size,
+                                         GDK_INTERP_HYPER);
+        g_object_unref(temp);
+    }
+
     return out;
 }
 
@@ -372,6 +387,11 @@ void parse_desktop_entry(const char* name)
         return;
     }
 
+    if( g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL ) )
+    {
+        return;
+    }
+
     gchar* app_name = g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL );
     gchar* icon_name = g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL );
     gchar* exec = g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL );