Changeset 6

Show
Ignore:
Timestamp:
11/07/06 16:54:16 (2 years ago)
Author:
inz
Message:

Use vfs loading for images, use hildon file chooser.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • maemo-blog/trunk/Makefile

    r2 r6  
    3535CFLAGS += $(WARNINGS) 
    3636 
     37maemo_blog_CFLAGS += $(shell if pkg-config hildon-fm --exists; then pkg-config hildon-fm --cflags; echo -DHILDON_FM; fi) 
     38maemo_blog_LIBS += $(shell if pkg-config hildon-fm --exists; then pkg-config hildon-fm --libs; fi) 
    3739maemo_blog_CFLAGS += $(shell if pkg-config hildon-libs --exists; then pkg-config hildon-libs --cflags; echo -DHILDON; else pkg-config gtk+-2.0 --cflags; fi) 
    3840maemo_blog_LDFLAGS += $(shell if pkg-config hildon-libs --exists; then pkg-config hildon-libs --libs; else pkg-config gtk+-2.0 --libs; fi) 
    3941maemo_blog_CFLAGS += $(shell if pkg-config gtksourceview-1.0 --exists; then pkg-config gtksourceview-1.0 --cflags; echo -DGTKSOURCEVIEW; fi) 
    4042maemo_blog_LDFLAGS += $(shell if pkg-config gtksourceview-1.0 --exists; then pkg-config gtksourceview-1.0 --libs; fi) 
     43maemo_blog_CFLAGS += $(shell if pkg-config libgnomevfsutil --exists; then pkg-config libgnomevfsutil --cflags; echo -DHAVE_VFS_UTIL; fi) 
     44maemo_blog_LDFLAGS += $(shell if pkg-config libgnomevfsutil --exists; then pkg-config libgnomevfsutil --libs; fi) 
     45maemo_blog_CFLAGS += $(shell if pkg-config libgnomeui-2.0 --exists; then pkg-config libgnomeui-2.0 --cflags; echo -DHAVE_VFS_UTIL; fi) 
     46maemo_blog_LDFLAGS += $(shell if pkg-config libgnomeui-2.0 --exists; then pkg-config libgnomeui-2.0 --libs; fi) 
    4147 
    4248maemo_blog_CFLAGS += `pkg-config gconf-2.0 gtk+-2.0 --cflags` \ 
  • maemo-blog/trunk/gui.c

    r2 r6  
    11#include <string.h> 
     2#ifdef HILDON_FM 
     3#include <hildon-widgets/hildon-file-chooser-dialog.h> 
     4#endif 
    25#ifdef HILDON 
    36#include <hildon-widgets/hildon-window.h> 
     
    811#include <gtksourceview/gtksourceview.h> 
    912#include <gtksourceview/gtksourcelanguagesmanager.h> 
     13#endif 
     14#ifdef HAVE_VFS_UTIL 
     15#include <libgnomeui/gnome-vfs-util.h> 
    1016#endif 
    1117#include "blog-plugin.h" 
     
    181187static void _img(GObject *object, GtkTextBuffer *text) 
    182188{ 
     189#ifdef HILDON_FM 
     190        GtkWidget *dialog = hildon_file_chooser_dialog_new("Open file...", 
     191                        GTK_WINDOW(gtk_widget_get_toplevel( 
     192                                        GTK_WIDGET(object))), 
     193                        GTK_FILE_CHOOSER_ACTION_OPEN); 
     194        gtk_dialog_add_buttons(GTK_DIALOG(dialog), 
     195                        "Ok", GTK_RESPONSE_OK, 
     196                        "Cancel", GTK_RESPONSE_CANCEL, 
     197                        NULL); 
     198#else 
    183199        GtkWidget *dialog = gtk_file_chooser_dialog_new("Open file...", 
    184200                        GTK_WINDOW(gtk_widget_get_toplevel( 
     
    188204                        "Cancel", GTK_RESPONSE_CANCEL, 
    189205                        NULL); 
     206#endif 
    190207 
    191208        gtk_widget_show_all(GTK_WIDGET(dialog)); 
    192209        if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { 
     210#ifdef HAVE_VFS_UTIL 
     211                gchar *file = gtk_file_chooser_get_uri( 
     212                                GTK_FILE_CHOOSER(dialog)); 
     213                GdkPixbuf *buf = gnome_gdk_pixbuf_new_from_uri(file); 
     214#else 
    193215                gchar *file = gtk_file_chooser_get_filename( 
    194216                                GTK_FILE_CHOOSER(dialog)); 
    195217                GdkPixbuf *buf = gdk_pixbuf_new_from_file(file, NULL); 
     218#endif 
    196219                gchar *sep = strrchr(file, '/'); 
    197220                GObject *source = g_object_get_data(G_OBJECT(text),