Commit 26f7c8b1 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

new function, loads icons from a given directory - don't get too excited,

1999-12-19  Havoc Pennington  <hp@pobox.com>

	* src/file-manager/desktop-canvas.c
		(desktop_canvas_load_desktop_icons): new function, loads
icons
	from a given directory - don't get too excited, it doesn't yet
		_display_ any icons!

			* src/file-manager/desktop-canvas.h: Add directory
list field.

	* src/file-manager/Makefile.am (gnome_desktop_SOURCES): Add
		fm-directory-list.[hc]
			(libntl_file_manager_la_SOURCES): add fm_directory_list.[hc]

				* src/file-manager/fm-directory-list.h, fm-directory-list.c:
					New files, the non-GUI portion of a
directory listing. Handles
	loading the dir listing and the icons.
parent a3b4de8a
1999-12-19 Havoc Pennington <hp@pobox.com>
* src/file-manager/desktop-canvas.c
(desktop_canvas_load_desktop_icons): new function, loads icons
from a given directory - don't get too excited, it doesn't yet
_display_ any icons!
* src/file-manager/desktop-canvas.h: Add directory list field.
* src/file-manager/Makefile.am (gnome_desktop_SOURCES): Add
fm-directory-list.[hc]
(libntl_file_manager_la_SOURCES): add fm_directory_list.[hc]
* src/file-manager/fm-directory-list.h, fm-directory-list.c:
New files, the non-GUI portion of a directory listing. Handles
loading the dir listing and the icons.
1999-12-17 Maciej Stachowiak <mjs@eazel.com>
* src/ntl-window.c, src/ntl-window-msgs.c: Added up, reload, home,
......
......@@ -13,6 +13,8 @@ dfos_corba_srcs= \
GNOME_Desktop_FileOperationService-common.c
libntl_file_manager_la_SOURCES= \
fm-directory-list.h \
fm-directory-list.c \
fm-icon-cache.c \
fm-icon-cache.h \
desktop-canvas.c \
......@@ -44,6 +46,10 @@ gnome_desktop_SOURCES= \
desktop-menu.c \
desktop-window.c \
desktop-window.h \
fm-directory-list.h \
fm-directory-list.c \
fm-icon-cache.c \
fm-icon-cache.h \
gnome-desktop.c
gnome_desktop_LDADD=\
......
......@@ -95,6 +95,9 @@ desktop_canvas_init (DesktopCanvas *dcanvas)
/* the attachment holds a refcount and eventually destroys
the popup */
gnome_popup_menu_attach(dcanvas->popup, GTK_WIDGET(dcanvas), NULL);
dcanvas->desktop_dir_list = NULL;
dcanvas->entries_loaded_id = 0;
}
static void
......@@ -111,7 +114,15 @@ desktop_canvas_destroy (GtkObject *object)
gtk_idle_remove(canvas->background_update_idle);
canvas->background_update_idle = 0;
}
if (canvas->desktop_dir_list != NULL) {
gtk_object_unref(GTK_OBJECT(canvas->desktop_dir_list));
gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list),
canvas->entries_loaded_id);
canvas->desktop_dir_list = NULL;
canvas->entries_loaded_id = 0;
}
(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
}
......@@ -175,6 +186,49 @@ desktop_canvas_size_allocate(GtkWidget *widget,
allocation);
}
static void
entries_loaded_cb(FMDirectoryList *dlist,
GSList *entries,
gpointer data)
{
DesktopCanvas *canvas = data;
g_assert(canvas != NULL);
printf("loaded some entries\n");
}
void
desktop_canvas_load_desktop_icons(DesktopCanvas *canvas, const gchar *uri)
{
g_return_if_fail(canvas != NULL);
g_return_if_fail(DESKTOP_IS_CANVAS(canvas));
if (canvas->desktop_dir_list != NULL) {
gtk_object_unref(GTK_OBJECT(canvas->desktop_dir_list));
gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list),
canvas->entries_loaded_id);
canvas->desktop_dir_list = NULL;
canvas->entries_loaded_id = 0;
}
if (uri != NULL) {
canvas->desktop_dir_list = fm_directory_list_new();
gtk_object_ref(GTK_OBJECT(canvas->desktop_dir_list));
gtk_object_sink(GTK_OBJECT(canvas->desktop_dir_list));
canvas->entries_loaded_id =
gtk_signal_connect(GTK_OBJECT(canvas->desktop_dir_list),
"entries_loaded",
(GtkSignalFunc)entries_loaded_cb,
canvas);
fm_directory_list_load_uri(canvas->desktop_dir_list,
uri);
}
}
/*
* Background accessor functions
*/
......
......@@ -26,6 +26,7 @@
#include <libgnome/gnome-defs.h>
#include <libgnomeui/gnome-canvas.h>
#include "desktop-layout.h"
#include "fm-directory-list.h"
BEGIN_GNOME_DECLS
......@@ -91,6 +92,9 @@ struct _DesktopCanvas {
GtkWidget *popup;
DesktopLayout *layout;
FMDirectoryList *desktop_dir_list;
guint entries_loaded_id;
};
struct _DesktopCanvasClass {
......@@ -98,11 +102,14 @@ struct _DesktopCanvasClass {
};
/* Standard Gtk function */
GtkType desktop_canvas_get_type (void);
/* Standard Gtk functions */
GtkWidget *desktop_canvas_new (void);
GtkType desktop_canvas_get_type (void);
GtkWidget *desktop_canvas_new (void);
/* Desktop stuff */
void desktop_canvas_load_desktop_icons (DesktopCanvas *canvas,
const gchar *uri);
/* The get/set functions here are not tied to our IDL interface or to
GConf; these get/set functions are purely to update this "view"
......
......@@ -35,7 +35,7 @@ void fm_icon_cache_set_theme (FMIconCache *fmic,
GdkPixbuf * fm_icon_cache_get_icon (FMIconCache *fmic,
const GnomeVFSFileInfo *info);
FMIconCache*fm_get_current_icon_cache (void);
FMIconCache* fm_get_current_icon_cache (void);
#endif
......
......@@ -28,6 +28,7 @@
#endif
#include <gnome.h>
#include <libgnorba/gnorba.h>
#include "desktop-window.h"
#include "desktop-canvas.h"
......@@ -44,11 +45,16 @@ main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *canvas;
CORBA_Environment ev;
(void)bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
(void)textdomain (PACKAGE);
CORBA_exception_init(&ev);
gnome_init ("gnome-desktop", VERSION, argc, argv);
gnome_CORBA_init ("gnome-desktop", VERSION, &argc, argv,
GNORBA_INIT_SERVER_FUNC, &ev);
gnome_vfs_init();
window = desktop_window_new();
canvas = desktop_canvas_new();
......@@ -56,6 +62,9 @@ main (int argc, char *argv[])
gtk_container_add(GTK_CONTAINER(window), canvas);
desktop_canvas_set_solid_background_color(DESKTOP_CANVAS(canvas), 0xFF0000);
desktop_canvas_load_desktop_icons(DESKTOP_CANVAS (canvas),
"file:/home/hp");
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(delete_event_cb), NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment