aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-gtk.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-23 01:55:37 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-23 01:55:37 +0200
commiteed939f4c87c7016be8c3e913cdb1f620b29256f (patch)
tree20efc8eef1ad2e76be87833c0d0f4d45b507d43b /src/interface-gtk.cpp
parent3fd1a19477d88f572af9b7f9d0a4b73f90012a6b (diff)
downloadsciteco-eed939f4c87c7016be8c3e913cdb1f620b29256f.tar.gz
install PNG icon and use it to set GTK's window icon
* it is installed into the package's data dir. It is always installed, even for Curses builds. This means when packaging for Debian, the icon could be part of the "sciteco-common" package. If there will ever be more GTK-specific files that need to be installed, this will probably change and the icon will be installed for GTK builds only and become part of the "sciteco-gtk" Debian package. * if the icon could not be loaded, we fail silently. * will not work with windows builds. On Windows, we should just use the icon resource linked into the binary rather than loading the image from file.
Diffstat (limited to 'src/interface-gtk.cpp')
-rw-r--r--src/interface-gtk.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp
index e01a2eb..ebc7cb1 100644
--- a/src/interface-gtk.cpp
+++ b/src/interface-gtk.cpp
@@ -27,6 +27,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include "gtk-info-popup.h"
@@ -346,9 +347,22 @@ InterfaceGtk::widget_set_font(GtkWidget *widget, const gchar *font_name)
void
InterfaceGtk::event_loop_impl(void)
{
+ GdkPixbuf *icon;
GThread *thread;
/*
+ * Assign an icon to the window.
+ * If the file could not be found, we fail silently.
+ * On Windows, it may be better to load the icon compiled
+ * as a resource into the binary.
+ */
+ icon = gdk_pixbuf_new_from_file(SCITECODATADIR G_DIR_SEPARATOR_S
+ "sciteco-48.png",
+ NULL);
+ if (icon)
+ gtk_window_set_icon(GTK_WINDOW(window), icon);
+
+ /*
* When changing views, the new widget is not
* added immediately to avoid flickering in the GUI.
* It is only updated once per key press and only