diff options
Diffstat (limited to 'xdg-vfs-browser-demo')
-rw-r--r-- | xdg-vfs-browser-demo/.cvsignore | 27 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/AUTHORS | 1 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/COPYING | 18 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/ChangeLog | 7 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/INSTALL | 236 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/Makefile.am | 1 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/Makefile.cvs | 6 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/NEWS | 1 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/README | 1 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/configure.ac | 26 | ||||
-rwxr-xr-x | xdg-vfs-browser-demo/setpaths.sh | 8 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/src/.cvsignore | 8 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/src/Makefile.am | 8 | ||||
-rw-r--r-- | xdg-vfs-browser-demo/src/xdg_vfs_browser.c | 791 | ||||
-rwxr-xr-x | xdg-vfs-browser-demo/test.sh | 4 |
15 files changed, 0 insertions, 1143 deletions
diff --git a/xdg-vfs-browser-demo/.cvsignore b/xdg-vfs-browser-demo/.cvsignore deleted file mode 100644 index 6d3654f..0000000 --- a/xdg-vfs-browser-demo/.cvsignore +++ /dev/null @@ -1,27 +0,0 @@ -*.la -*.lo -*.o -ABOUT-NLS -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.h -config.h.in -config.log -config.status -configure -libtool -config.guess -config.sub -depcomp -install-sh -ltmain.sh -missing -stamp-h1 -.libs -.deps -.cdtproject -.project - diff --git a/xdg-vfs-browser-demo/AUTHORS b/xdg-vfs-browser-demo/AUTHORS deleted file mode 100644 index d76f6e9..0000000 --- a/xdg-vfs-browser-demo/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Norbert Frese (nf2@scheinwelt.at) 2006 diff --git a/xdg-vfs-browser-demo/COPYING b/xdg-vfs-browser-demo/COPYING deleted file mode 100644 index 1edf08c..0000000 --- a/xdg-vfs-browser-demo/COPYING +++ /dev/null @@ -1,18 +0,0 @@ -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. diff --git a/xdg-vfs-browser-demo/ChangeLog b/xdg-vfs-browser-demo/ChangeLog deleted file mode 100644 index ede0d5c..0000000 --- a/xdg-vfs-browser-demo/ChangeLog +++ /dev/null @@ -1,7 +0,0 @@ -2005-11-21 gettextize <bug-gnu-gettext@gnu.org> - - * Makefile.am (SUBDIRS): Add po. - (ACLOCAL_AMFLAGS): New variable. - (EXTRA_DIST): New variable. - * configure.ac (AC_OUTPUT): Add po/Makefile.in. - diff --git a/xdg-vfs-browser-demo/INSTALL b/xdg-vfs-browser-demo/INSTALL deleted file mode 100644 index 23e5f25..0000000 --- a/xdg-vfs-browser-demo/INSTALL +++ /dev/null @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/xdg-vfs-browser-demo/Makefile.am b/xdg-vfs-browser-demo/Makefile.am deleted file mode 100644 index af437a6..0000000 --- a/xdg-vfs-browser-demo/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src diff --git a/xdg-vfs-browser-demo/Makefile.cvs b/xdg-vfs-browser-demo/Makefile.cvs deleted file mode 100644 index 1e17bc9..0000000 --- a/xdg-vfs-browser-demo/Makefile.cvs +++ /dev/null @@ -1,6 +0,0 @@ -all: - @libtoolize - @aclocal - @autoheader - @automake --add-missing - @autoconf diff --git a/xdg-vfs-browser-demo/NEWS b/xdg-vfs-browser-demo/NEWS deleted file mode 100644 index 4af1832..0000000 --- a/xdg-vfs-browser-demo/NEWS +++ /dev/null @@ -1 +0,0 @@ -None
\ No newline at end of file diff --git a/xdg-vfs-browser-demo/README b/xdg-vfs-browser-demo/README deleted file mode 100644 index 6b1c21b..0000000 --- a/xdg-vfs-browser-demo/README +++ /dev/null @@ -1 +0,0 @@ -libxdg-vfs Sample filebrowser diff --git a/xdg-vfs-browser-demo/configure.ac b/xdg-vfs-browser-demo/configure.ac deleted file mode 100644 index 199badb..0000000 --- a/xdg-vfs-browser-demo/configure.ac +++ /dev/null @@ -1,26 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(src/xdg_vfs_browser.c) -dnl AM_CONFIG_HEADER(config.h) - -PACKAGE=xdg-vfs-browser-demo -VERSION=0.0.5 - -AM_INIT_AUTOMAKE($PACKAGE,$VERSION) - -AC_PROG_CC -AC_STDC_HEADERS -AC_PROG_INSTALL - -AC_ENABLE_SHARED(yes) -AC_PROG_LIBTOOL - -PKG_CHECK_MODULES(DEPS, gtk+-2.0 >= 2.2) - -AC_SUBST(DEPS_CFLAGS) -AC_SUBST(DEPS_LIBS) - -AC_OUTPUT([ -Makefile -src/Makefile -]) diff --git a/xdg-vfs-browser-demo/setpaths.sh b/xdg-vfs-browser-demo/setpaths.sh deleted file mode 100755 index a136657..0000000 --- a/xdg-vfs-browser-demo/setpaths.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - - -export PATH=/home/norbert/work/c/xdg-vfs-kde/src/:$PATH -export PATH=/home/norbert/work/c/xdg-vfs-gnome/src/:$PATH -export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - - diff --git a/xdg-vfs-browser-demo/src/.cvsignore b/xdg-vfs-browser-demo/src/.cvsignore deleted file mode 100644 index 26a73db..0000000 --- a/xdg-vfs-browser-demo/src/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.la -*.lo -*.o -.deps -.libs -Makefile -Makefile.in - diff --git a/xdg-vfs-browser-demo/src/Makefile.am b/xdg-vfs-browser-demo/src/Makefile.am deleted file mode 100644 index a5c1ae7..0000000 --- a/xdg-vfs-browser-demo/src/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = xdg_vfs_browser - -xdg_vfs_browser_SOURCES = xdg_vfs_browser.c -xdg_vfs_browser_LDADD = $(DEPS_LIBS) -lxdg_vfs_client - -AM_CFLAGS = $(DEPS_CFLAGS) - -noinst_HEADERS = diff --git a/xdg-vfs-browser-demo/src/xdg_vfs_browser.c b/xdg-vfs-browser-demo/src/xdg_vfs_browser.c deleted file mode 100644 index 4c9703a..0000000 --- a/xdg-vfs-browser-demo/src/xdg_vfs_browser.c +++ /dev/null @@ -1,791 +0,0 @@ -/* -# browser.c -# -# Copyright 2006, Norbert Frese -# -# LICENSE: -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -#---------------------------------------------*/ - -#include <string.h> - -#include <gtk/gtk.h> - -#include <xdg_vfs_client.h> - -enum -{ - ICON_COLUMN, - BASENAME_COLUMN, - SIZE_COLUMN, - MIMETYPE_COLUMN, - FILETYPE_COLUMN, - URI_COLUMN, - MOUNTPOINT_ID_COLUMN, - IS_MOUNTED_COLUMN, - N_COLUMNS -}; - -GtkWidget *window; -GtkTreeSelection *listselect; -GtkListStore *model; -GtkWidget *url_entry; - -guint status_bar_context_id; -GtkWidget* status_bar; - -XdgVfsSession * session; -char * system_uri; -char * current_uri=NULL; - -GtkIconTheme * iconTheme; - -static void initIconTheme(char * name) { - - iconTheme = gtk_icon_theme_new (); // gtk_icon_theme_get_default (); - - -/* gtk_icon_theme_prepend_search_path - (iconTheme, - "/usr/share/icons/crystalsvg/scalable"); */ - - gtk_icon_theme_set_custom_theme (iconTheme, - name); -/* gtk_icon_theme_set_custom_theme (iconTheme, - "gnome"); */ - - -/* - gchar ** themepath; - gint n_elements; - int i; - gtk_icon_theme_get_search_path (iconTheme, - &themepath, - &n_elements); - - for (i=0;i<n_elements;i++) - fprintf(stderr, "themepath=%s\n", themepath[i]); -*/ -} - - - -static void errorbox(int code) { - GtkWidget * dialog = gtk_message_dialog_new (GTK_WINDOW(window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "xdg-vfs error #%d: %s", - code, xdg_vfs_resultToString(code)); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (GTK_WIDGET(dialog)); - -} - -static void list_dir(const char * uri) -{ - XdgVfsResult r; - XdgVfsItemType type; - XdgVfsItem * item; - int i; - GtkTreeIter iter; - - char * message = g_strdup_printf ("listing %s ...", uri); - - gtk_statusbar_push(GTK_STATUSBAR(status_bar), status_bar_context_id, - message); - - g_free(message); - - while (gtk_events_pending ()) - gtk_main_iteration_do(FALSE); - - gtk_list_store_clear(model); // clear list - - while (gtk_events_pending ()) - gtk_main_iteration_do(FALSE); - - r = xdg_vfs_sess_cmd_listDirectory(session, uri); - - if (r) { - fprintf(stderr, "test 3 cmd problem=%d\n", r); - errorbox(r); - return; - } - - while ((r=xdg_vfs_sess_readItem(session, &type, - &item, NULL, NULL)) == XDGVFS_RESULT_CONTINUES) - { - switch(type) - { - case XDGVFS_ITEMTYPE_LS_HEAD: - { - XdgVfsSimpleHead * head = (XdgVfsSimpleHead*) item; - fprintf(stdout, "got ls header uri='%s'\n", head->uri); - break; - } - - case XDGVFS_ITEMTYPE_FILEINFO: - { - XdgVfsFileInfo * info = (XdgVfsFileInfo*) item; - // fprintf(stdout, "got fileinfo uri='%s'\n", info->uri); - GdkPixbuf* pixBuf; - if (info->iconname) - { - GError *gerror=NULL; - pixBuf = gtk_icon_theme_load_icon( - iconTheme, - info->iconname, - 24, - 0 /*GTK_ICON_LOOKUP_NO_SVG*/, - &gerror); - if (gerror) - { - fprintf (stderr, "Unable to load icon: %s\n", gerror->message); - g_error_free (gerror); - } - else - { - - - } - } - - gtk_list_store_append (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), - &iter, - ICON_COLUMN, pixBuf, - BASENAME_COLUMN, info->basename, - SIZE_COLUMN, info->size, - MIMETYPE_COLUMN, info->mimetype, - FILETYPE_COLUMN, info->filetype, - URI_COLUMN, info->uri, - MOUNTPOINT_ID_COLUMN, info->mountpoint_id, - IS_MOUNTED_COLUMN, info->is_mounted, - -1); - - break; - } - case XDGVFS_ITEMTYPE_NONE: - { - break; - } - default: - { - fprintf(stderr, "unexpected item - type=%d\n", type); - break; - } - } - xdg_vfs_item_unref(item); - } - fprintf(stderr, "list result=%d\n", r); - if (r) { errorbox(r);} - else { - gtk_entry_set_text(GTK_ENTRY(url_entry), uri); - - if (current_uri) - { - r = xdg_vfs_sess_cmd_removeMonitor(session, current_uri); - fprintf(stderr, "remove monitor result=%d\n", r); - } - //if (current_uri) free(current_uri); - current_uri = strdup(uri); - // if (r && r!= XDGVFS_ERRORCODE_NOT_FOUND) { errorbox(r);} - r = xdg_vfs_sess_cmd_monitorDir(session, uri); - fprintf(stderr, "monitor dir result=%d\n", r); - // if (r && r != XDGVFS_ERRORCODE_ALREADY_EXISTS) { errorbox(r);} - } - - - - gtk_statusbar_pop (GTK_STATUSBAR(status_bar), status_bar_context_id); - -/* - for (i = 0; i < 10; i++) { - gchar *msg = g_strdup_printf ("Message %s #%d", uri, i); - gtk_list_store_append (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), - &iter, - 0, msg, - 1, i, - -1); - g_free (msg); - } -*/ -} - -char * _mount_it(char * mountpoint_id) -{ - char * activation_uri=NULL; - - XdgVfsResult r; - - char * message = g_strdup_printf ("mounting %s", mountpoint_id); - - gtk_statusbar_push(GTK_STATUSBAR(status_bar), status_bar_context_id, - message); - - g_free(message); - - while (gtk_events_pending ()) - gtk_main_iteration_do(FALSE); - - r = xdg_vfs_sess_cmd_mount(session, mountpoint_id); - - if (r) { errorbox(r); return NULL;} - - XdgVfsItemType type=0; - XdgVfsItem * item=NULL; - int n = 5; - - while ((r=xdg_vfs_sess_readItem(session, &type, - &item, NULL, NULL)) == XDGVFS_RESULT_CONTINUES) - { - switch (type) - { - case XDGVFS_ITEMTYPE_NONE: - { - break; - } - case XDGVFS_ITEMTYPE_FILEINFO: - { - /* lists the volumes just mounted */ - XdgVfsFileInfo * info = (XdgVfsFileInfo*) item; - fprintf(stderr, "got activation uri=%s\n", info->uri); - if (!activation_uri) activation_uri = strdup(info->uri); - break; - } - default: - { - fprintf(stderr, "unexpected item - type=%d\n", type); - break; - } - } - xdg_vfs_item_unref(item); - } - if (r) { errorbox(r); activation_uri=NULL;} - fprintf(stderr, "mount result=%d\n", r); - gtk_statusbar_pop (GTK_STATUSBAR(status_bar), status_bar_context_id); - return activation_uri; -} - - -static void -tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) -{ - GtkTreeIter iter; - //GtkTreeModel *model; - gint filetype; - gchar *uri; - gchar *mountpoint_id; - gint is_mounted; - - GtkTreeModel * newTreeModel; - - if (gtk_tree_selection_get_selected (selection, &newTreeModel, &iter)) - { - model = (GtkListStore*)newTreeModel; - gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, FILETYPE_COLUMN, &filetype, -1); - gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, URI_COLUMN, &uri, -1); - gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, MOUNTPOINT_ID_COLUMN, &mountpoint_id, -1); - gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, IS_MOUNTED_COLUMN, &is_mounted, -1); - - printf ("You selected uri=%s\tfiletype=%d\tmntid=%s\tis_mounted=%d\n", uri, filetype, mountpoint_id, is_mounted); - - if (filetype==XDGVFS_FILE_TYPE_DIRECTORY) { - - list_dir(uri); - } - else if (filetype==XDGVFS_FILE_TYPE_VFSMOUNTPOINT) { - if (is_mounted) list_dir(uri); - else - { - char * activation_uri = _mount_it(mountpoint_id); - if (activation_uri) - { - list_dir(activation_uri); - free(activation_uri); - } - } - - } - - - g_free (uri); - } -} - - - -/* Create the list of "messages" */ -static GtkWidget *create_list( void ) -{ - - GtkWidget *scrolled_window; - GtkWidget *tree_view; - - GtkTreeIter iter; - /* GtkCellRenderer *cell0; - GtkCellRenderer *cell1; - GtkCellRenderer *cell2; - GtkTreeViewColumn *column0; - GtkTreeViewColumn *column1; - GtkTreeViewColumn *column2; */ - - GtkCellRenderer *normrenderer; - GtkTreeViewColumn *normcolumn; - - int i; - - /* Create a new scrolled window, with scrollbars only if needed */ - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - model = gtk_list_store_new ( - N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, - G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); - tree_view = gtk_tree_view_new (); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), - tree_view); - gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model)); - gtk_widget_show (tree_view); - - /* Add some messages to the window */ - /*for (i = 0; i < 10; i++) { - gchar *msg = g_strdup_printf ("Message #%d", i); - gtk_list_store_append (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), - &iter, - 0, msg, - 1, i, - -1); - g_free (msg); - }*/ - - GtkCellRenderer* pixbufrenderer = gtk_cell_renderer_pixbuf_new(); - normcolumn = gtk_tree_view_column_new_with_attributes ("", - pixbufrenderer, - "pixbuf", ICON_COLUMN, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normrenderer = gtk_cell_renderer_text_new (); - - normcolumn = gtk_tree_view_column_new_with_attributes ("Name", - normrenderer, - "text", BASENAME_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normcolumn = gtk_tree_view_column_new_with_attributes ("Size", - normrenderer, - "text", SIZE_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normcolumn = gtk_tree_view_column_new_with_attributes ("MimeType", - normrenderer, - "text", MIMETYPE_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normcolumn = gtk_tree_view_column_new_with_attributes ("Type", - normrenderer, - "text", FILETYPE_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normcolumn = gtk_tree_view_column_new_with_attributes ("URI", - normrenderer, - "text", URI_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - normcolumn = gtk_tree_view_column_new_with_attributes ("MntID", - normrenderer, - "text", MOUNTPOINT_ID_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - - normcolumn = gtk_tree_view_column_new_with_attributes ("mnted", - normrenderer, - "text", IS_MOUNTED_COLUMN, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), - GTK_TREE_VIEW_COLUMN (normcolumn)); - - - - listselect = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); - gtk_tree_selection_set_mode (listselect, GTK_SELECTION_SINGLE); - g_signal_connect (G_OBJECT (listselect), "changed", - G_CALLBACK (tree_selection_changed_cb), - NULL); - - - return scrolled_window; -} - -/* Add some text to our text widget - this is a callback that is invoked -when our window is realized. We could also force our window to be -realized with gtk_widget_realize, but it would have to be part of -a hierarchy first */ - -static void insert_text( GtkTextBuffer *buffer ) -{ - GtkTextIter iter; - - gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); - - gtk_text_buffer_insert (buffer, &iter, - "", -1); -} - -/* Create a scrolled text area that displays a "message" */ -static GtkWidget *create_text( void ) -{ - GtkWidget *scrolled_window; - GtkWidget *view; - GtkTextBuffer *buffer; - - view = gtk_text_view_new (); - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (scrolled_window), view); - insert_text (buffer); - - gtk_widget_show_all (scrolled_window); - - return scrolled_window; -} - - -static void button_root_callback( GtkWidget *widget, - gpointer data ) -{ - g_print ("%s was pressed\n", (char *) data); - - list_dir(system_uri); - -} - - -static void button_go_callback( GtkWidget *widget, - gpointer data ) -{ - g_print ("%s was pressed\n", (char *) data); - - list_dir(gtk_entry_get_text (GTK_ENTRY(url_entry))); - -} - - -int read_backend_infos() { - XdgVfsResult r; - XdgVfsItemType type; - XdgVfsItem * item; - - r = xdg_vfs_sess_cmd_backendInfo(session); - - if (r) { - fprintf(stderr, "backend-info cmd problem=%d\n", r); - return 1; - } - - while ((r=xdg_vfs_sess_readItem(session, &type, - &item, NULL, NULL)) == XDGVFS_RESULT_CONTINUES) - { - switch(type) - { - case XDGVFS_ITEMTYPE_BACKENDINFO: - { - XdgVfsBackendInfo * backendInfo = (XdgVfsBackendInfo*) item; - fprintf(stderr, "backend_id='%s' system_uri='%s' file_icon_theme='%s'\n", - backendInfo->backend_id, - backendInfo->system_uri, - backendInfo->file_icon_theme); - - initIconTheme(backendInfo->file_icon_theme); - system_uri = strdup(backendInfo->system_uri); - - } - case XDGVFS_ITEMTYPE_NONE: - { - break; - } - default: - { - fprintf(stderr, "unexpected item - type=%d\n", type); - break; - } - } - xdg_vfs_item_unref(item); - } - if (r) { errorbox(r); exit(1); } - fprintf(stderr, "backend-info result=%d\n", r); -} - -/* avoid recursion when getting dir-monitor events */ -gboolean _list_again(gpointer data) -{ - char * uri = (char*)data; - printf("dir changed event2: current_uri=%s; uri=%s\n", current_uri, uri); - if (current_uri && strcmp(current_uri, uri)==0) list_dir(uri); - g_free(uri); - return FALSE; -} - - -void myXdgVfsMonitorCallback(XdgVfsSession * sess, char * uri, void * user_data) -{ - printf("dir changed event: %s\n", uri); - //g_idle_add(_list_again,strdup(uri)); - g_timeout_add(700,_list_again,strdup(uri)); -} - - -gboolean myGIOFunc(GIOChannel *source, GIOCondition condition, gpointer data) -{ - XdgVfsResult r; - if(!xdg_vfs_sess_isBusy(session)) - { - XdgVfsItemType type=0; - XdgVfsItem * item=NULL; - - fprintf(stderr, "incoming event!\n"); - if ((r=xdg_vfs_sess_readItem(session, &type, - &item, NULL, NULL)) == XDGVFS_RESULT_OK) - { - switch (type) - { - case XDGVFS_ITEMTYPE_NONE: - { - break; - } - default: - { - fprintf(stderr, "unexpected item - type=%d\n", type); - break; - } - } - xdg_vfs_item_unref(item); - } - } - return TRUE; -} - - -int main( int argc, - char *argv[] ) -{ - XdgVfsResult r; - - GtkWidget *main_vbox; - GtkWidget *url_hbox; - - GtkWidget *root_button; - GtkWidget *go_button; - - GtkWidget *vpaned; - GtkWidget *list; - GtkWidget *text; - - gtk_init (&argc, &argv); - - if (argc!=2) { - fprintf(stderr,"usage: %s {gnome|kde|this}\n", argv[0]); - exit(1); - } - - r = xdg_vfs_sess_start(&session, argv[1]); - - if (r) { - fprintf(stderr, " session start problem=%d\n", r); - return 1; - } - - xdg_vfs_sess_set_monitor_callback(session, myXdgVfsMonitorCallback, NULL); - - read_backend_infos(); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "libxdg-vfs browser demo"); - g_signal_connect (G_OBJECT (window), "destroy", - G_CALLBACK (gtk_main_quit), NULL); - gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400); - - /* vbox */ - - main_vbox = gtk_vbox_new (FALSE, 0); - gtk_box_set_homogeneous(GTK_BOX(main_vbox),FALSE); - - gtk_container_add (GTK_CONTAINER (window), main_vbox); - gtk_widget_show (main_vbox); - - - /* create url box */ - - url_hbox = gtk_hbox_new (FALSE, 0); - gtk_box_set_homogeneous(GTK_BOX(url_hbox),FALSE); - - // gtk_container_add (GTK_CONTAINER (main_vbox), url_hbox); - - gtk_box_pack_start (GTK_BOX(main_vbox), - url_hbox, - FALSE, - FALSE, - 5); - gtk_widget_show (url_hbox); - - /* create root URI button */ - - root_button = gtk_button_new_with_label ("VFS Root"); - - /* Connect the "clicked" signal of the button to our callback */ - g_signal_connect (G_OBJECT (root_button), "clicked", - G_CALLBACK (button_root_callback), (gpointer) "root button"); - - gtk_widget_show (root_button); - - - gtk_box_pack_start (GTK_BOX(url_hbox), - root_button, - FALSE, - FALSE, - 5); - - - /* url entry */ - - url_entry = gtk_entry_new (); - gtk_entry_set_activates_default (GTK_ENTRY (url_entry), TRUE); - gtk_entry_set_max_length (GTK_ENTRY (url_entry), 100); - // gtk_container_add (GTK_CONTAINER (main_vbox), url_entry); - - gtk_box_pack_start (GTK_BOX(url_hbox), - url_entry, - TRUE, - TRUE, - 5); - - gtk_widget_show (url_entry); - - /* go button */ - - go_button = gtk_button_new_with_label ("Go"); - GTK_WIDGET_SET_FLAGS (go_button, GTK_CAN_DEFAULT); - - - /* Connect the "clicked" signal of the button to our callback */ - g_signal_connect (G_OBJECT (go_button), "clicked", - G_CALLBACK (button_go_callback), (gpointer) "go button"); - - gtk_widget_show (go_button); - - gtk_box_pack_start(GTK_BOX (url_hbox), - go_button, - FALSE, - FALSE, - 5); - gtk_widget_grab_default (go_button); - - - /* create a vpaned widget and add it to our toplevel window */ - - /* - vpaned = gtk_vpaned_new (); - gtk_container_add (GTK_CONTAINER (main_vbox), vpaned); - gtk_widget_show (vpaned); - - - list = create_list (); - gtk_paned_add1 (GTK_PANED (vpaned), list); - gtk_widget_show (list); - - text = create_text (); - gtk_paned_add2 (GTK_PANED (vpaned), text); - gtk_widget_show (text); - gtk_widget_show (window); - - - */ - list = create_list (); - gtk_container_add (GTK_CONTAINER (main_vbox), list); - gtk_widget_show (list); - - status_bar = gtk_statusbar_new(); - gtk_widget_show (status_bar); - //gtk_container_add (GTK_CONTAINER (main_vbox), status_bar); - - status_bar_context_id=gtk_statusbar_get_context_id (GTK_STATUSBAR(status_bar), - "xdg_vfs_browser"); - - gtk_box_pack_start(GTK_BOX (main_vbox), - status_bar, - FALSE, - FALSE, - 0); - - gtk_widget_show (window); - gtk_list_store_clear (model); - - current_uri = system_uri; - list_dir(system_uri); - - /* watch the incoming pipe (for change notifications) */ - - GIOChannel* iochannel = g_io_channel_unix_new(xdg_vfs_sess_getIncomingFiledescriptor(session)); - - g_io_add_watch(iochannel, - G_IO_IN, - myGIOFunc, - NULL); - - gtk_main (); - - xdg_vfs_sess_close(session); - - return 0; -} diff --git a/xdg-vfs-browser-demo/test.sh b/xdg-vfs-browser-demo/test.sh deleted file mode 100755 index 50ea250..0000000 --- a/xdg-vfs-browser-demo/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -src/xdg_vfs_gnome get ftp://web198@www.nfrese.net/ -echo res: $?
\ No newline at end of file |