diff --git a/gtk_appdata.c b/gtk_appdata.c
index e07b1f7..75f73f2 100644
--- a/gtk_appdata.c
+++ b/gtk_appdata.c
@@ -21,10 +21,12 @@ static void context_set_defaults (kwinst *app, char **argv)
#ifndef HAVEMSWIN
app->usrdatadir = g_strdup_printf ("%s/%s", g_get_user_data_dir(), CFGDIR);
app->sysdatadir = g_strdup (NIXSHARE);
+ app->imgdir = g_strdup_printf ("%s/%s", app->sysdatadir, IMGDIR);
#else
gchar *usrdata = get_posix_filename (g_get_user_data_dir());
app->usrdatadir = g_strdup_printf ("%s/%s", usrdata, CFGDIR);
app->sysdatadir = g_strdup (g_path_get_dirname(argv[0]));
+ app->imgdir = g_strdup_printf ("%s/%s", app->sysdatadir, IMGDIR);
g_free (usrdata);
#endif
#ifdef DEBUG
@@ -450,6 +452,7 @@ void context_destroy (kwinst *app)
if (app->exename) g_free (app->exename);
if (app->usrdatadir) g_free (app->usrdatadir);
if (app->sysdatadir) g_free (app->sysdatadir);
+ if (app->imgdir) g_free (app->imgdir);
if (app->fontname) g_free (app->fontname);
// if (app->appname) g_free (app->appname);
diff --git a/gtk_appdata.h b/gtk_appdata.h
index 0ed5bf9..b7bf733 100644
--- a/gtk_appdata.h
+++ b/gtk_appdata.h
@@ -48,7 +48,9 @@
#define CFGDIR "gtkwrite"
#define CFGFILE "gtkwrite.cfg"
#define IMGDIR "img"
-#define LOGOFILE "gtkwrite.png"
+#define LOGO "gtkwrite.png"
+#define ICON "gtkwrite.ico"
+
/* TODO: dynamically strip 'Program Files' from from app->exename
* and replace with progra~1 or progra~2 below to preserve correct
* logo display for 'protable' installs.
@@ -77,7 +79,7 @@ typedef struct {
const gchar *user; /* current username */
gchar *usrdatadir; /* user data dir */
gchar *sysdatadir; /* system data dir */
- gchar *logofile; /* logo file 128px */
+ gchar *imgdir; /* image directory */
GtkWidget *window; /* main window */
GtkWidget *view; /* text_view */
diff --git a/gtk_filemon.c b/gtk_filemon.c
index 196d041..f9f39c5 100644
--- a/gtk_filemon.c
+++ b/gtk_filemon.c
@@ -250,32 +250,3 @@ void file_monitor_unblock_changed (gpointer data)
g_signal_handler_unblock (app->filemon, app->mfp_handler);
}
-
-/*
-
- gchar *pn = g_file_get_parse_name (gfile);
-
- g_print ("added watch for '%s' (%s)\n", fn, pn);
-
- // from file_monitor_block_changed and file_monitor_unblock_changed
-
-// if (app->mfp_handler) {
-// g_signal_handler_disconnect (G_OBJECT(app->filemon), app->mfp_handler);
-// app->mfp_handler = 0;
-// }
- // file_monitor_cancel (app);
-
-// if (!app->mfp_handler) {
-// app->mfp_handler = g_signal_connect (G_OBJECT(app->filemon), "changed",
-// G_CALLBACK (file_monitor_on_changed), data);
-// }
- // file_monitor_add (app);
-
- // general scrps under block/unblock
-
-// g_file_monitor_emit_event (filemon, gfile, NULL,
-// G_FILE_MONITOR_EVENT_CHANGED);
-// g_file_monitor_emit_event (filemon, gfile, NULL,
-// G_FILE_MONITOR_EVENT_DELETED);
-
-*/
\ No newline at end of file
diff --git a/gtk_menu.c b/gtk_menu.c
index 1e69a67..793ccee 100644
--- a/gtk_menu.c
+++ b/gtk_menu.c
@@ -1351,28 +1351,6 @@ void menu_help_about_activate (GtkMenuItem *menuitem, kwinst *app)
* general window functions
*/
-gchar *get_logo_filename (kwinst *app)
-{
- /* check system_data_dir/IMGDIR/LOGOFILE first, e.g /usr/share */
- gchar *fn = g_strdup_printf ("%s/%s/%s", app->sysdatadir, IMGDIR, LOGOFILE);
- if (g_file_test (fn, G_FILE_TEST_EXISTS))
- return fn;
-
- if (fn)
- g_free (fn);
- fn = NULL;
-
- /* check user_data_dir/IMGDIR/LOGOFILE next (e.g, ~/.local/share */
- fn = g_strdup_printf ("%s/%s/%s", app->usrdatadir, IMGDIR, LOGOFILE);
- if (g_file_test (fn, G_FILE_TEST_EXISTS))
- return fn;
-
- if (fn)
- g_free (fn);
-
- return NULL;
-}
-
void help_about (kwinst *app)
{
gchar *buf, *logofn;
@@ -1390,7 +1368,9 @@ void help_about (kwinst *app)
static const gchar comments[] = APPSTR;
/* create pixbuf from logofn to pass to show_about_dialog */
- if ((logofn = get_logo_filename (app))) {
+// if ((logofn = get_logo_filename (app))) {
+ if ((logofn = g_strdup_printf ("%s/%s", app->imgdir, LOGO))) {
+ // g_print ("logofn : '%s'\n", logofn);
logo = create_pixbuf_from_file (logofn);
g_free (logofn);
}
diff --git a/gtk_windef.c b/gtk_windef.c
index dec9bb8..2c28450 100644
--- a/gtk_windef.c
+++ b/gtk_windef.c
@@ -26,6 +26,8 @@ GtkWidget *create_window (kwinst *app)
guint pleft;
guint pright;
+ gchar *iconfile; /* filename to loading icon */
+
/* create toplevel window */
if (!(app->window = gtk_window_new (GTK_WINDOW_TOPLEVEL))) {
err_dialog ("create_window() gtk_window_new failure.");
@@ -36,6 +38,12 @@ GtkWidget *create_window (kwinst *app)
gtk_window_set_default_size (GTK_WINDOW (app->window), app->winwidth, app->winheight);
// gtk_window_move (GTK_WINDOW (app->window), app->winrootx, app->winrooty);
+ /* create icon filename and set icon */
+ if ((iconfile = g_strdup_printf ("%s/%s", app->imgdir, ICON))) {
+ gtk_window_set_icon(GTK_WINDOW(app->window), create_pixbuf_from_file (iconfile));
+ g_free (iconfile);
+ }
+
/* create & attach accelerator group */
mainaccel = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (app->window), mainaccel);
diff --git a/img/gtkwrite.ico b/img/gtkwrite.ico
new file mode 100755
index 0000000..eab4199
Binary files /dev/null and b/img/gtkwrite.ico differ
diff --git a/styles/gtkwrite_light.xml b/styles/gtkwrite_light.xml
index aaa4e85..2eb4a12 100644
--- a/styles/gtkwrite_light.xml
+++ b/styles/gtkwrite_light.xml
@@ -31,7 +31,8 @@
-
+
+