Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37750363
en ru br
Репозитории ALT

Группа :: Графические оболочки/Прочее
Пакет: tint2

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: tint2-alt-default_icon.patch
Скачать


diff --git tint2/CMakeLists.txt tint2/CMakeLists.txt
index 3b5a0f3..d2d46d2 100644
--- tint2/CMakeLists.txt
+++ tint2/CMakeLists.txt
@@ -11,6 +11,7 @@ pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
 pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
 pkg_check_modules( IMLIB2 REQUIRED imlib2>=1.4.2 )
 pkg_check_modules( SN libstartup-notification-1.0>=0.12 )
+pkg_check_modules( GTK gtk+-2.0 )
 find_library( RT_LIBRARY rt )
 
 if( NOT X11_FOUND OR NOT PANGOCAIRO_FOUND OR NOT PANGO_FOUND OR NOT CAIRO_FOUND OR NOT GLIB2_FOUND OR NOT GOBJECT2_FOUND OR NOT IMLIB2_FOUND )
@@ -33,6 +34,7 @@ include_directories( ${PROJECT_BINARY_DIR}
                      src/launcher
                      src/tooltip
                      src/util
+		     ${GTK_INCLUDE_DIRS}
                      ${X11_INCLUDE_DIRS}
                      ${PANGOCAIRO_INCLUDE_DIRS}
                      ${PANGO_INCLUDE_DIRS}
@@ -75,6 +77,10 @@ if( ENABLE_BATTERY )
   add_definitions( -DENABLE_BATTERY )
 endif( ENABLE_BATTERY )
 
+if (GTK_FOUND )
+    add_definitions( -DHAVE_GTK )
+endif( GTK_FOUND )
+
 set( MANDIR share/man CACHE PATH "Directory for man pages" )
 set( DATADIR share CACHE PATH "Directory for shared data" )
 set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
@@ -89,6 +95,7 @@ endif( ENABLE_TINT2CONF )
 add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_svnrev.sh" "\"${PROJECT_SOURCE_DIR}\"" )
 
 link_directories( ${X11_LIBRARY_DIRS}
+                  ${GTK_LIBRARY_DIRS}
                   ${PANGOCAIRO_LIBRARY_DIRS}
                   ${PANGO_LIBRARY_DIRS}
                   ${CAIRO_LIBRARY_DIRS}
@@ -98,6 +105,7 @@ link_directories( ${X11_LIBRARY_DIRS}
 		  ${SN_LIBRARY_DIRS} )
 add_executable(tint2 ${SOURCES})
 target_link_libraries( tint2 ${X11_LIBRARIES}
+                             ${GTK_LIBRARIES}
                              ${PANGOCAIRO_LIBRARIES}
                              ${PANGO_LIBRARIES}
                              ${CAIRO_LIBRARIES}
diff --git tint2/src/tint.c tint2/src/tint.c
index 4d9e6b8..72bee66 100644
--- tint2/src/tint.c
+++ tint2/src/tint.c
@@ -31,6 +31,10 @@
 #include <Imlib2.h>
 #include <signal.h>
 
+#ifdef HAVE_GTK
+#include <gtk/gtkicontheme.h>
+#endif
+
 #ifdef HAVE_SN
 #include <libsn/sn.h>
 #include <sys/wait.h>
@@ -177,6 +181,38 @@ static gint cmp_ptr(gconstpointer a, gconstpointer b) {
 
 #endif // HAVE_SN
 
+void load_default_icon() {
+#ifdef HAVE_GTK
+    GtkIconTheme *g_default_theme = gtk_icon_theme_get_default();
+    if(g_default_theme != NULL) {
+	GtkIconInfo *icon_info = gtk_icon_theme_lookup_icon(g_default_theme, "tint2", 0, 0);
+
+	if(icon_info != NULL) {
+	    gchar *path = gtk_icon_info_get_filename(icon_info);
+//	    g_free(icon_info);
+
+	    if(path != NULL)
+		default_icon = imlib_load_image(path);
+	    return;
+	}
+    }
+#endif
+
+    gchar *path;
+    const gchar * const *data_dirs;
+    data_dirs = g_get_system_data_dirs ();
+    int i;
+    for (i = 0; data_dirs[i] != NULL; i++)	{
+	path = g_build_filename(data_dirs[i], "tint2", "default_icon.png", NULL);
+	if (g_file_test (path, G_FILE_TEST_EXISTS)) {
+	    default_icon = imlib_load_image(path);
+	    g_free(path);
+	    return;
+	}
+	g_free(path);
+    }
+}
+
 void init_X11()
 {
 	server.dsp = XOpenDisplay (NULL);
@@ -216,16 +252,7 @@ void init_X11()
 	setlocale(LC_NUMERIC, "POSIX");
 	
 	// load default icon
-	gchar *path;
-	const gchar * const *data_dirs;
-	data_dirs = g_get_system_data_dirs ();
-	int i;
-	for (i = 0; data_dirs[i] != NULL; i++)	{
-		path = g_build_filename(data_dirs[i], "tint2", "default_icon.png", NULL);
-		if (g_file_test (path, G_FILE_TEST_EXISTS))
-			default_icon = imlib_load_image(path);
-		g_free(path);
-	}
+	load_default_icon();
 
 	// get monitor and desktop config
 	get_monitors();
@@ -1024,6 +1051,7 @@ int main (int argc, char *argv[])
 
 start:
 	init (argc, argv);
+	gtk_init(&argc, &argv);
 	init_X11();
 
 	i = 0;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin