summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-12-25 02:55:04 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2009-12-25 02:55:04 +0100
commitfb6417dcf2df2e5c09fa3a36640d10e563d0ae5b (patch)
treec82ec13c34c20950881ac98cd75fb6326938882a
parentba76e3af574a4e55d8bf2f1009f11481b7422a4d (diff)
parentf6e2ba790e189721549da70219a85f7cfa769742 (diff)
Merge ssh://ai/~/walls
-rw-r--r--thumbnails.c12
-rw-r--r--walls.ui1
-rw-r--r--walls_conf.c13
3 files changed, 22 insertions, 4 deletions
diff --git a/thumbnails.c b/thumbnails.c
index d669c99..e88c19d 100644
--- a/thumbnails.c
+++ b/thumbnails.c
@@ -37,7 +37,7 @@ GdkPixbuf *get_thumbnail(const gchar *filepath) {
gint win_width, win_height, img_width, img_height, width, height;
gdouble scalex, scaley, width_ratio, height_ratio, max_ratio;
GError *error = NULL;
- gchar *thumbname;
+ gchar *thumbname, *mtime, *width_s, *height_s;
thumbname = get_wall_thumb_name(filepath);
@@ -76,15 +76,23 @@ GdkPixbuf *get_thumbnail(const gchar *filepath) {
g_object_unref(pb);
error = NULL;
+ mtime = g_strdup_printf("%d", get_mtime(filepath));
+ width_s = g_strdup_printf("%d", img_width);
+ height_s = g_strdup_printf("%d", img_height);
if(!gdk_pixbuf_save(pb2, thumbname, "png", &error,
"tEXt::Thumb::URI", filepath,
- "tEXt::Thumb::MTime", get_mtime(filepath),
+ "tEXt::Thumb::MTime", mtime,
"tEXt::Software", "walls",
+ "tEXt::Thumb::Image::Width", width_s,
+ "tEXt::Thumb::Image::Height", height_s,
NULL)) {
g_warning("%s", error->message);
g_error_free(error);
}
+ g_free(mtime);
+ g_free(width_s);
+ g_free(height_s);
g_free(thumbname);
return pb2;
diff --git a/walls.ui b/walls.ui
index bc9a71e..ff166ca 100644
--- a/walls.ui
+++ b/walls.ui
@@ -134,6 +134,7 @@
<object class="GtkIconView" id="thumbview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="selection_mode">browse</property>
<property name="orientation">horizontal</property>
<signal name="selection_changed" handler="on_thumbview_selection_changed"/>
</object>
diff --git a/walls_conf.c b/walls_conf.c
index 7ef3a8d..9eb4fdc 100644
--- a/walls_conf.c
+++ b/walls_conf.c
@@ -1,9 +1,13 @@
+#include <unistd.h>
+
+#include <glib/gstdio.h>
#include "walls_conf.h"
GKeyFile *keyfile = NULL;
void conf_open() {
gchar *filename;
+ gchar *confdir;
GError *error = NULL;
keyfile = g_key_file_new();
@@ -13,9 +17,14 @@ void conf_open() {
}
filename = g_strdup_printf("%s/walls/config", g_get_user_config_dir());
+ confdir = g_path_get_dirname(filename);
+ if(g_access(confdir, F_OK) == -1) {
+ g_mkdir_with_parents(confdir, 0700);
+ }
+ g_free(confdir);
if(!g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) {
- g_warning("%s", error->message);
+ g_warning("Can't read config: %s", error->message);
g_error_free(error);
}
@@ -29,7 +38,7 @@ gint conf_get_int(const gchar *group_name, const gchar *key, gint _default) {
ret = g_key_file_get_integer(keyfile, group_name, key, &error);
if(ret == 0) {
- g_warning("%s", error->message);
+ g_warning("Can't get key from config: %s", error->message);
g_error_free(error);
return _default;
}