summaryrefslogtreecommitdiff
path: root/window_main.c
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-12-23 01:50:43 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2009-12-23 01:50:43 +0100
commitaecce87bc3bf771ef9e920c07c42b8a3e57e26e9 (patch)
tree99338f3b32a7fa9c4e26238a46b7a79104923ba0 /window_main.c
parent0ccb0f910cf0a19b577685c0f1598b97d3d825cb (diff)
Added som directory adding stuff.
Diffstat (limited to 'window_main.c')
-rw-r--r--window_main.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/window_main.c b/window_main.c
index 47c70ec..96a596b 100644
--- a/window_main.c
+++ b/window_main.c
@@ -6,6 +6,7 @@
#include "walls_ui.h"
#include "db.h"
#include "walls_model.h"
+#include "wallpapers.h"
GdkPixbuf *orig_pixbuf = NULL;
gint last_width = 0,
@@ -106,7 +107,7 @@ static void resize_pixbuf() {
gtk_widget_set_size_request(GTK_WIDGET(image), width, height);
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);
- gdk_pixbuf_unref(pb);
+ g_object_unref(pb);
}
void on_window_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) {
@@ -135,7 +136,7 @@ static void load_pixbuf(struct wallpaper_t *wall) {
gdouble scalex, scaley, width_ratio, height_ratio, max_ratio;
if(orig_pixbuf)
- gdk_pixbuf_unref(orig_pixbuf);
+ g_object_unref(orig_pixbuf);
orig_pixbuf = gdk_pixbuf_new_from_file(wall->filepath, &error);
if(!orig_pixbuf) {
g_warning("%s", error->message);
@@ -159,6 +160,18 @@ void on_filetree_selection_changed(GtkTreeSelection *treeselection, gpointer use
}
}
+void on_add_dir_action_activate(GtkAction *action, gpointer user_data) {
+ GtkWidget *dialog;
+
+ dialog = gtk_file_chooser_dialog_new("Choose Directory", NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, "_Select");
+ if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+ char *directory;
+ directory = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ add_dir_recursive(directory, 0);
+ }
+ gtk_widget_destroy(dialog);
+}
+
int gui_main(int argc, char **argv) {
GtkWidget *window;
GtkWidget *filetree;