From aecce87bc3bf771ef9e920c07c42b8a3e57e26e9 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 23 Dec 2009 01:50:43 +0100 Subject: Added som directory adding stuff. --- window_main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'window_main.c') 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; -- cgit v1.2.3