From: Eric Wertz Date: Tue, 26 Dec 2017 13:53:57 +0000 (-0500) Subject: Added icon scaling and respect of NoDisplay option on desktop files X-Git-Url: https://ericdwertz.com/git/?a=commitdiff_plain;h=15ff18cfb519e280f80d39fd182ae01109ac4850;p=ericlaunch.git Added icon scaling and respect of NoDisplay option on desktop files --- diff --git a/main.c b/main.c index b88a901..e0ee7fd 100755 --- 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 );