summaryrefslogtreecommitdiff
path: root/window_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'window_main.c')
-rw-r--r--window_main.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/window_main.c b/window_main.c
index 04209b9..95cfe7f 100644
--- a/window_main.c
+++ b/window_main.c
@@ -29,6 +29,8 @@ GtkWidget *window_hpane, *window_vpane;
GThread *add_thread = NULL,
*thumb_thread = NULL;
+gchar *cur_wall_msg = NULL;
+
guint image_context;
void on_foldtree_selection_changed(GtkTreeSelection *treeselection, gpointer user_data);
@@ -59,6 +61,15 @@ inline static void foldtree_init(GtkTreeView *foldtree) {
g_signal_connect(selection, "changed", G_CALLBACK(on_foldtree_selection_changed), foldtree);
}
+static void set_resize_msg(gdouble scale) {
+ gchar *msg;
+
+ gtk_statusbar_pop(statusbar, image_context);
+ msg = g_strdup_printf("%s (%d %%)", cur_wall_msg, (gint)(scale * 100.0));
+ gtk_statusbar_push(statusbar, image_context, msg);
+ g_free(msg);
+}
+
static void resize_pixbuf() {
GdkPixbuf *pb;
GdkWindow *window;
@@ -99,6 +110,8 @@ static void resize_pixbuf() {
gtk_widget_set_uposition(GTK_WIDGET(image), (width < win_width ? win_width / 2 - width / 2 : 0), (height < win_height ? win_height / 2 - height / 2 : 0));
gtk_image_set_from_pixbuf(image, pb);
g_object_unref(pb);
+
+ set_resize_msg((gdouble)width / (gdouble)img_width);
}
void on_window_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) {
@@ -119,13 +132,21 @@ void on_window_hpane_resized(GObject *gobject, GParamSpec *pspec, gpointer user_
}
}
+static void walls_set_window_title() {
+ gchar *msg;
+
+ msg = g_strdup_printf("walls - %s", cur_wall_msg);
+ gtk_window_set_title(GTK_WINDOW(window), msg);
+ g_free(msg);
+}
+
static void load_pixbuf(const gchar *filepath) {
GdkPixbuf *pb;
GError *error = NULL;
GdkWindow *window;
sqlite_uint64 wallid;
struct wallpaper_t *wall;
- gchar *msg, *base;
+ gchar *base;
if(orig_pixbuf)
g_object_unref(orig_pixbuf);
@@ -155,11 +176,12 @@ static void load_pixbuf(const gchar *filepath) {
if(cur_wall) {
base = g_path_get_basename(cur_wall->filepath);
- msg = g_strdup_printf("%s: %dx%d", base, cur_wall->width, cur_wall->height);
- gtk_statusbar_pop(statusbar, image_context);
- gtk_statusbar_push(statusbar, image_context, msg);
+ if(cur_wall_msg)
+ g_free(cur_wall_msg);
+ cur_wall_msg = g_strdup_printf("%s: %dx%d", base, cur_wall->width, cur_wall->height);
g_free(base);
- g_free(msg);
+
+ walls_set_window_title();
}
resize_pixbuf();