Author: kelnos
Date: 2006-12-02 05:41:00 +0000 (Sat, 02 Dec 2006)
New Revision: 24033

Added:
   xfce4-volume-manager/trunk/DESIGN
   xfce4-volume-manager/trunk/Makefile.am
   xfce4-volume-manager/trunk/autogen.sh
   xfce4-volume-manager/trunk/configure.ac.in
   xfce4-volume-manager/trunk/po/
   xfce4-volume-manager/trunk/po/LINGUAS
   xfce4-volume-manager/trunk/src/
   xfce4-volume-manager/trunk/src/Makefile.am
   xfce4-volume-manager/trunk/src/main.c
   xfce4-volume-manager/trunk/src/xfce-volume-action-selection-dialog.h
   xfce4-volume-manager/trunk/src/xfce-volume-action.c
   xfce4-volume-manager/trunk/src/xfce-volume-action.h
   xfce4-volume-manager/trunk/src/xfce-volume-manager.c
   xfce4-volume-manager/trunk/src/xfce-volume-manager.h
   xfce4-volume-manager/trunk/src/xfce-volume.c
   xfce4-volume-manager/trunk/src/xfce-volume.h
   xfce4-volume-manager/trunk/tools/
   xfce4-volume-manager/trunk/tools/show-vol-types.c
Log:
initial import of totally incomplete xfce4-volume-manager sources.  don't
bother checking this out; it doesn't do anything or even compile yet.


Added: xfce4-volume-manager/trunk/DESIGN
===================================================================
--- xfce4-volume-manager/trunk/DESIGN                           (rev 0)
+++ xfce4-volume-manager/trunk/DESIGN   2006-12-02 05:41:00 UTC (rev 24033)
@@ -0,0 +1,70 @@
+/* this is just rough-crap pseudo-code, and subject to change, cuz i really
+ * haven't decided how configurable i want this thing to be. */
+
+enum XfceVolumeStatus {
+    XFCE_VOLUME_STATUS_NOT_PRESENT = 0,
+    XFCE_VOLUME_STATUS_PRESENT_NOT_MOUNTED,
+    XFCE_VOLUME_STATUS_PRESENT_MOUNTED,
+};
+
+enum XfceVolumeActionType {
+    XFCE_VOLUME_ACTION_NONE = 0,
+    XFCE_VOLUME_ACTION_MOUNT_ONLY,
+    XFCE_VOLUME_ACTION_OPEN_FILEMANAGER,
+    XFCE_VOLUME_ACTION_RUN_PROGRAM,
+    XFCE_VOLUME_ACTION_RUN_PROGRAM_WITH_ARGS,
+    XFCE_VOLUME_ACTION_RUN_MIME_HANDLER,
+};
+
+class XfceVolumeActionSelectionDialog {
+    GtkDialog *new(GtkWindow *parent,
+                   XfceVolume *volume);
+    
+    XfceVolumeAction *run();
+};
+
+class XfceVolumeAction {
+    property readonly constructonly XfceVolumeActionType action_type;
+    property readonly constructonly gchar **action_args;
+    
+    XfceVolumeAction *new_for_volume(XfceVolume *volume);
+    XfceVolumeAction *new_for_type(XfceVolumeActionType action_type,
+                                   const gchar **action_args);
+    XfceVolumeAction *new_full(XfceVolume *volume,
+                               XfceVolumeActionType action_type,
+                               const gchar **action_args);
+    
+    gboolean activate();
+};
+
+class XfceVolume {
+    property readonly XfceVolumeAction *action;
+    property readonly XfceVolumeStatus status;
+    
+    signal status_changed;
+    
+    XfceVolume *new(ThunarVfsVolume *volume);
+    
+    XfceVolumeAction *get_action();
+    
+    XfceVolumeStatus get_status();
+    
+    gboolean mount(GtkWidget *parent);
+    gboolean unmount(GtkWidget *parent);
+    gboolean eject(GtkWidget *parent);
+    
+    const gchar *get_display_name();
+    const gchar *get_mount_point();
+    const gchar *get_uuid();
+};
+
+class XfceVolumeManager {
+    property gboolean auto_mount;
+    
+    XfceVolumeManager *get_default();
+    
+    void set_auto_mount(gboolean auto_mount);
+    gboolean get_auto_mount();
+    
+    GList *get_volumes();  /* list of (XfceVolume *) */
+};

Added: xfce4-volume-manager/trunk/Makefile.am
===================================================================
--- xfce4-volume-manager/trunk/Makefile.am                              (rev 0)
+++ xfce4-volume-manager/trunk/Makefile.am      2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1,27 @@
[EMAIL PROTECTED]@
+
+SUBDIRS = \
+       po \
+       src
+
+EXTRA_DIST = \
+       TODO \
+       intltool-extract.in \
+       intltool-merge.in \
+       intltool-update.in
+
+DISTCLEANFILES = \
+       intltool-extract \
+       intltool-merge \
+       intltool-update
+
+AUTOMAKE_OPTIONS = \
+       1.8 \
+       dist-bzip2
+
+distclean-local:
+       -rm -rf *.cache *~
+
+rpm: dist
+       rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
+       @rm -f $(PACKAGE)-$(VERSION).tar.gz

Added: xfce4-volume-manager/trunk/autogen.sh
===================================================================
--- xfce4-volume-manager/trunk/autogen.sh                               (rev 0)
+++ xfce4-volume-manager/trunk/autogen.sh       2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# $Id: autogen.sh 21844 2006-05-25 20:33:38Z kelnos $
+#
+# Copyright (c) 2002-2005
+#         The Xfce development team. All rights reserved.
+#
+# Written for Xfce by Benedikt Meurer <[EMAIL PROTECTED]>.
+#
+
+echo "This app currently does not compile.  Even if it did compile, it 
requires"
+echo "a patch to thunar-vfs to work properly that is not yet even in SVN yet."
+echo "So, if you think you still want to play with this, feel free to remove"
+echo "the 'exit 1' line from autogen.sh, but be aware that I'm not answering"
+echo "questions or taking bug reports about it yet."
+exit 1
+
+(type xdt-autogen) >/dev/null 2>&1 || {
+  cat >&2 <<EOF
+autogen.sh: You don't seem to have the Xfce development tools installed on
+            your system, which are required to build this software.
+            Please install the xfce4-dev-tools package first, it is available
+            from http://www.xfce.org/.
+EOF
+  exit 1
+}
+
+# verify that po/LINGUAS is present
+(test -f po/LINGUAS) >/dev/null 2>&1 || {
+  cat >&2 <<EOF
+autogen.sh: The file po/LINGUAS could not be found. Please check your snapshot
+            or try to checkout again.
+EOF
+  exit 1
+}
+
+# substitute revision and linguas
+linguas=`sed -e '/^#/d' po/LINGUAS`
+revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}'`
+sed -e "s/@LINGUAS@/${linguas}/g" \
+    -e "s/@REVISION@/${revision}/g" \
+    < "configure.ac.in" > "configure.ac"
+
+exec xdt-autogen $@
+
+# vi:set ts=2 sw=2 et ai:


Property changes on: xfce4-volume-manager/trunk/autogen.sh
___________________________________________________________________
Name: svn:executable
   + 

Added: xfce4-volume-manager/trunk/configure.ac.in
===================================================================
--- xfce4-volume-manager/trunk/configure.ac.in                          (rev 0)
+++ xfce4-volume-manager/trunk/configure.ac.in  2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1,84 @@
+dnl configure.ac
+dnl
+dnl xfce4-volume-manager
+dnl
+
+dnl version info
+m4_define([xfce4_volume_manager_version], [4.5.0])
+
+dnl minimum required versions
+m4_define([gtk_minimum_version], [2.6.0])
+m4_define([xfce_minimum_version], [4.3.99.2])
+m4_define([exo_minimum_version], [0.3.1.12])
+m4_define([thunar_minimum_version], [0.5.0])
+m4_define([dbus_minimum_version], [0.34])
+m4_define([intltool_minimum_version], [0.31])
+m4_define([autoconf_minimum_version], [2.50])
+
+dnl init autoconf
+AC_INIT([xfce4-volume-manager], [xfce4_volume_manager_version],
+        [http://bugzilla.xfce.org/])
+AC_PREREQ([autoconf_minimum_version])
+
+dnl init automake
+XFCE4_VOLUME_MANAGER_VERSION=xfce4_volume_manager_version
+AM_INIT_AUTOMAKE()
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE
+
+dnl check for UNIX variants
+AC_AIX
+AC_ISC_POSIX
+AC_MINIX
+AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""])
+
+dnl check for basic programs
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL([intltool_minimum_version], [no-xml])
+
+dnl check for standard header files
+AC_HEADER_STDC
+AC_CHECK_HEADERS([errno.h fcntl.h signal.h \
+                  string.h sys/stat.h sys/types.h \
+                  unistd.h])
+AC_CHECK_FUNCS([mmap setsid])
+
+dnl Check for i18n support
+XDT_I18N([EMAIL PROTECTED]@])
+
+dnl Check for X11 installed
+XDT_CHECK_LIBX11_REQUIRE
+XDT_CHECK_LIBSM
+
+dnl required
+XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [gtk_minimum_version])
+XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [gtk_minimum_version])
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [gtk_minimum_version])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [xfce_minimum_version])
+dnl XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [xfce_minimum_version])
+XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [thunar_minimum_version])
+
+dnl xsltproc support (to generate html docs)
+AC_ARG_ENABLE([xsltproc],
+              [AC_HELP_STRING([--enable-xsltproc],
+                              [Use xsltproc to generate HTML documentation 
@<:@default=no@:>@])],
+                              , [enable_xsltproc=no])
+if test "x$enable_xsltproc" = "xyes"; then
+    AC_PATH_PROG([XSLTPROC], [xsltproc], [no])
+    if test "x$XSLTPROC" = "xno"; then
+        AC_MSG_FAILURE([*** xsltproc was requested, but not found.])
+    fi
+fi
+AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$enable_xsltproc" = "xyes"])
+
+dnl check for debugging support
+XDT_FEATURE_DEBUG
+
+AC_OUTPUT([
+Makefile
+po/Makefile.in
+src/Makefile
+xfce4-volume-manager.spec
+])

Added: xfce4-volume-manager/trunk/po/LINGUAS
===================================================================
--- xfce4-volume-manager/trunk/po/LINGUAS                               (rev 0)
+++ xfce4-volume-manager/trunk/po/LINGUAS       2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1 @@
+# set of available languages (in alphabetic order)

Added: xfce4-volume-manager/trunk/src/Makefile.am
===================================================================
--- xfce4-volume-manager/trunk/src/Makefile.am                          (rev 0)
+++ xfce4-volume-manager/trunk/src/Makefile.am  2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1,27 @@
+bin_PROGRAMS = xfce4-volume-manager
+
+xfce4_volume_manager_SOURCES = \
+       main.c \
+       xfce-volume-action.c \
+       xfce-volume-action.h \
+       xfce-volume-action-selection-dialog.c \
+       xfce-volume-action-selection-dalog.h \
+       xfce-volume.c \
+       xfce-volume.h \
+       xfce-volume-manager.c \
+       xfce-volume-manager.h
+
+xfce4_volume_manager_CFLAGS = \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -DDBUS_API_SUBJECT_TO_CHANGE \
+       -DEXO_API_SUBJECT_TO_CHANGE \
+       $(LIBXFCE4UTIL_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(THUNAR_VFS_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+xfce4_volume_manager_LIBADD = \
+       $(LIBXFCE4UTIL_LIBS) \
+       $(GTK_LIBS) \
+       $(THUNAR_VFS_LIBS) \
+       $(DBUS_LIBS)

Added: xfce4-volume-manager/trunk/src/main.c
===================================================================
--- xfce4-volume-manager/trunk/src/main.c                               (rev 0)
+++ xfce4-volume-manager/trunk/src/main.c       2006-12-02 05:41:00 UTC (rev 
24033)
@@ -0,0 +1,116 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <libxfce4util/libxfce4util.h>
+#include <gtk/gtk.h>
+
+#include "xfce-volume-manager.h"
+
+int
+main(int argc,
+     char **argv)
+{
+    XfceVolumeManager *volume_manager;
+    gboolean daemon_mode = TRUE;
+    gint i;
+    
+    for(i = 1; i < argc; ++i) {
+        if(!strcmp(argv[i], "--no-daemon"))
+            daemon_mode = FALSE;
+    }
+    
+    if(daemon_mode) {
+#ifdef HAVE_DAEMON
+        if(daemon(1, 0)) {
+            perror("daemon()");
+            exit(EXIT_FAILURE);
+        }
+#else        
+        switch(fork()) {
+            case -1:
+                perror("fork()");
+                exit(EXIT_FAILURE);
+            
+            case 0:
+                {
+                    int fd;
+
+# ifdef HAVE_SETSID
+                    setsid();
+# endif
+                    close(STDIN_FILENO);
+                    close(STDOUT_FILENO);
+                    close(STDERR_FILENO);
+                    fd = open("/dev/null", O_RDONLY);  /* stdin */
+                    if(fd == STDIN_FILENO) {
+                        dup(fd);  /* stdout */
+                        dup(fd);  /* stderr */
+                    } else
+                        close(fd);
+                }
+                break;
+            
+            default:
+                _exit(EXIT_SUCCESS);
+        }
+#endif
+    }
+    
+    xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
+    
+    gtk_init(&argc, &argv);
+    
+    volume_manager = xfce_volume_manager_get_default();
+    
+    gtk_main();
+    
+    g_object_unref(G_OBJECT(volume_manager));
+    
+    return EXIT_SUCCESS;
+}

Added: xfce4-volume-manager/trunk/src/xfce-volume-action-selection-dialog.h
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume-action-selection-dialog.h        
                        (rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume-action-selection-dialog.h        
2006-12-02 05:41:00 UTC (rev 24033)
@@ -0,0 +1,45 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_VOLUME_ACTION_SELECTION_DIALOG_H__
+#define __XFCE_VOLUME_ACTION_SELECTION_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+#include "xfce-volume.h"
+#include "xfce-volume-action.h"
+
+#define XFCE_TYPE_VOLUME_ACTION_SELECTION_DIALOG     
(xfce_volume_action_selection_dialog_get_type())
+#define XFCE_VOLUME_ACTION_SELECTION_DIALOG(obj)     
(G_TYPE_INSTANCE_CHECK_CAST((obj), XFCE_TYPE_VOLUME_ACTION_SELECTION_DIALOG, 
XfceVolumeActionSelectionDialog))
+#define XFCE_IS_VOLUME_ACTION_SELECTION_DIALOG(obj)  
(G_TYPE_INSTANCE_CHECK_TYPE((obj), XFCE_TYPE_VOLUME_ACTION_SELECTION_DIALOG))
+
+G_BEGIN_DECLS
+
+typedef struct _XfceVolumeActionSelectionDialog 
XfceVolumeActionSelectionDialog;
+
+GType xfce_volume_action_selection_dialog_get_type           () G_GNUC_CONST;
+
+GtkWidget *xfce_volume_action_selection_dialog_new           (GtkWindow 
*parent,
+                                                              XfceVolume 
*volume);
+
+XfceVolumeAction *xfce_volume_action_selection_dialog_run    
(XfceVolumeActionSelectionDialog *dialog);
+
+G_END_DECLS
+
+#endif  /* __XFCE_VOLUME_ACTION_SELECTION_DIALOG_H__ */

Added: xfce4-volume-manager/trunk/src/xfce-volume-action.c
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume-action.c                         
(rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume-action.c 2006-12-02 05:41:00 UTC 
(rev 24033)
@@ -0,0 +1,95 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+ 
+#include "xfce-volume-action.h"
+
+struct _XfceVolumeAction
+{
+    GObject parent;
+};
+
+typedef struct _XfceVolumeActionClass
+{
+    GObjectClass parent_class;
+} XfceVolumeActionClass;
+
+static void xfce_volume_action_class_init(XfceVolumeActionClass *klass);
+static void xfce_volume_action_init(XfceVolumeAction *volume_action);
+static void xfce_volume_action_finalize(GObject *obj);
+
+
+G_DEFINE_TYPE(XfceVolumeAction, xfce_volume_action, G_TYPE_OBJECT)
+
+
+static void
+xfce_volume_action_class_init(XfceVolumeActionClass *klass)
+{
+    
+}
+
+static void
+xfce_volume_action_init(XfceVolumeAction *volume_action)
+{
+    
+}
+
+static void
+xfce_volume_action_finalize(GObject *obj)
+{
+    
+}
+
+
+
+/*
+ * public API
+ */
+
+
+
+XfceVolumeAction *
+xfce_volume_action_new_for_volume(XfceVolume *volume)
+{
+    
+}
+
+XfceVolumeAction *
+xfce_volume_action_new_for_type(XfceVolumeActionType action_type,
+                                const gchar **action_args)
+{
+    
+}
+
+XfceVolumeAction *
+xfce_volume_action_new_full(XfceVolume *volume,
+                            XfceVolumeActionType action_type,
+                            const gchar **action_args)
+{
+    
+}
+
+gboolean
+xfce_volume_action_activate(XfceVolumeAction *volume_action)
+{
+    
+}

Added: xfce4-volume-manager/trunk/src/xfce-volume-action.h
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume-action.h                         
(rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume-action.h 2006-12-02 05:41:00 UTC 
(rev 24033)
@@ -0,0 +1,56 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_VOLUME_ACTION_H__
+#define __XFCE_VOLUME_ACTION_H__
+
+#include <glib-object.h>
+
+#define XFCE_TYPE_VOLUME_ACTION     (xfce_volume_action_get_type())
+#define XFCE_VOLUME_ACTION(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), 
XFCE_TYPE_VOLUME_ACTION, XfceVolumeAction))
+#define XFCE_IS_VOLUME_ACTION(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
XFCE_TYPE_VOLUME_ACTION))
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+    XFCE_VOLUME_ACTION_NONE = 0,
+    XFCE_VOLUME_ACTION_MOUNT_ONLY,
+    XFCE_VOLUME_ACTION_OPEN_FILEMANAGER,
+    XFCE_VOLUME_ACTION_RUN_PROGRAM,
+    XFCE_VOLUME_ACTION_RUN_PROGRAM_WITH_ARGS,
+    XFCE_VOLUME_ACTION_RUN_MIME_HANDLER,
+} XfceVolumeActionType;
+
+typedef struct _XfceVolumeAction XfceVolumeAction;
+
+GType xfce_volume_action_get_type                      () G_GNUC_CONST;
+
+XfceVolumeAction *xfce_volume_action_new_for_volume    (XfceVolume *volume);
+XfceVolumeAction *xfce_volume_action_new_for_type      (XfceVolumeActionType 
action_type,
+                                                        const gchar 
**action_args);
+XfceVolumeAction *xfce_volume_action_new_full          (XfceVolume *volume,
+                                                        XfceVolumeActionType 
action_type,
+                                                        const gchar 
**action_args);
+    
+gboolean xfce_volume_action_activate                   (XfceVolumeAction 
*volume_action);
+
+G_END_DECLS
+
+#endif  /* __XFCE_VOLUME_ACTION_H__ */

Added: xfce4-volume-manager/trunk/src/xfce-volume-manager.c
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume-manager.c                        
        (rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume-manager.c        2006-12-02 
05:41:00 UTC (rev 24033)
@@ -0,0 +1,157 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include "xfce-volume.h"
+#include "xfce-volume-manager.h"
+
+struct _XfceVolumeManager
+{
+    GObject parent;
+    
+    ThunarVfsVolumeManager *thunar_volmgr;
+    GList *volumes;
+    
+    gboolean auto_mount;
+};
+
+typedef struct _XfceVolumeManagerClass
+{
+    GObjectClass parent_class;
+} XfceVolumeMangerClass;
+
+
+static void xfce_volume_manager_class_init(XfceVolumeManagerClass *klass);
+static void xfce_volume_manager_init(XfceVolumeManager *volume_manager);
+static void xfce_volume_manager_finalize(GObject *obj);
+
+
+static void _xfce_volume_manager_refcnt_check(XfceVolume *volume);
+
+
+G_DEFINE_TYPE(XfceVolumeManager, xfce_volume_manager, G_TYPE_OBJECT)
+
+
+static void
+xfce_volume_manager_class_init(XfceVolumeManagerClass *klass)
+{
+    GObjectClass *object_class = (GObjectClass *)klass;
+    
+    object_class->finalize = xfce_volume_manager_finalize;
+}
+
+static void
+xfce_volume_manager_init(XfceVolumeManager *volume_manager)
+{
+    GList *tvolumes, *l;
+    ThunarVfsVolume *tvolume;
+    XfceVolume *volume;
+    
+    volume_manager->thunar_volmgr = thunar_vfs_volume_manager_get_default();
+    tvolumes = 
thunar_vfs_volume_manager_get_volumes(volume_manager->thunar_volmgr);
+    
+    for(l = tvolumes; l; l = l->next) {
+        tvolume = THUNAR_VFS_VOLUME(l->data);
+        
+        if(!thunar_vfs_volume_is_removable(tvolume))
+            continue;
+        
+        volume = xfce_volume_new(tvolume);
+        volume_manager->volumes = g_list_prepend(volume_manager->volumes, 
volume);
+    }
+    volume_manager->volumes = g_list_reverse(volume_manager->volumes);
+}
+
+static void
+xfce_volume_manager_finalize(GObject *obj)
+{
+    XfceVolumeManager *volume_manager = XFCE_VOLUME_MANAGER(obj);
+    
+    g_list_foreach(volume_manager->volumes, 
(GFunc)_xfce_volume_manager_refcnt_check, NULL);
+    g_list_foreach(volume_manager->volumes, (GFunc)g_object_unref);
+    g_list_free(volume_manager->volumes);
+    
+    g_object_unref(G_OBJECT(volume_manager->thunar_volmgr));
+    
+    G_OBJECT_CLASS(xfce_volume_manager_parent_class)->finalize(obj);
+}
+
+
+static void
+_xfce_volume_manager_refcnt_check(XfceVolume *volume)
+{
+    if(G_UNLIKELY(G_OBJECT(volume)->ref_count != 1)) {
+        g_warning("Attempt to finalize XfceVolumeManager while %d references 
to XfceVolume "
+                  "\"%s\" held.  This is probably a bug in the program.",
+                  G_OBJECT(volume)->ref_count,
+                  xfce_volume_get_display_name(volume));
+    }
+}
+
+
+
+/*
+ * public API
+ */
+
+
+XfceVolumeManager *
+xfce_volume_manager_get_default()
+{
+    return g_object_new(XFCE_TYPE_VOLUME_MANAGER, NULL);
+}
+
+void
+xfce_volume_manager_set_auto_mount(XfceVolumeManager *volume_manager,
+                                   gboolean auto_mount)
+{
+    g_return_if_fail(XFCE_IS_VOLUME_MANAGER(volume_manager));
+    
+    if(volume_manager->auto_mount == auto_mount)
+        return;
+    
+    volume_manager->auto_mount = auto_mount;
+    
+    /* FIXME: save setting */
+}
+
+gboolean
+xfce_volume_manager_get_auto_mount(XfceVolumeManager *volume_manager)
+{
+    g_return_val_if_fail(XFCE_IS_VOLUME_MANAGER(volume_manager), FALSE);
+    return volume_manager->auto_mount;
+}
+
+GList *
+xfce_volume_manager_get_volumes(XfceVolumeManager *volume_manager)
+{
+    GList *volumes;
+    
+    g_return_val_if_fail(XFCE_IS_VOLUME_MANAGER(volume_manager), NULL);
+    
+    volumes =  g_list_copy(volume_manager->volumes);
+    g_list_foreach(volumes, (GFunc)g_object_ref, NULL);
+    
+    return volumes;
+}

Added: xfce4-volume-manager/trunk/src/xfce-volume-manager.h
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume-manager.h                        
        (rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume-manager.h        2006-12-02 
05:41:00 UTC (rev 24033)
@@ -0,0 +1,45 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_VOLUME_MANAGER_H__
+#define __XFCE_VOLUME_MANAGER_H__
+
+#include <glib-object.h>
+
+#define XFCE_TYPE_VOLUME_MANAGER     (xfce_volume_manager_get_type())
+#define XFCE_VOLUME_MANAGER(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), 
XFCE_TYPE_VOLUME_MANAGER, XfceVolumeManager))
+#define XFCE_IS_VOLUME_MANAGER(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
XFCE_TYPE_VOLUME_MANAGER))
+
+G_BEGIN_DECLS
+
+typedef struct _XfceVolumeManager XfceVolumeManager;
+
+GType xfce_volume_manager_get_type                    () G_GNUC_CONST;
+
+XfceVolumeManager *xfce_volume_manager_get_default    ();
+
+void xfce_volume_manager_set_auto_mount               (XfceVolumeManager 
*volume_manager,
+                                                       gboolean auto_mount);
+gboolean xfce_volume_manager_get_auto_mount           (XfceVolumeManager 
*volume_manager);
+
+GList *xfce_volume_manager_get_volumes                (XfceVolumeManager 
*volume_manager);  /* list of (XfceVolume *) */
+
+G_END_DECLS
+
+#endif  /* __XFCE_VOLUME_MANAGER_H__ */

Added: xfce4-volume-manager/trunk/src/xfce-volume.c
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume.c                                
(rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume.c        2006-12-02 05:41:00 UTC 
(rev 24033)
@@ -0,0 +1,153 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include "xfce-volume.h"
+
+struct _XfceVolume
+{
+    GObject parent;
+    
+    ThunarVfsVolume *tvolume;
+};
+
+typedef struct _XfceVolumeClass
+{
+    GObjectClass parent_class;
+};
+
+static void xfce_volume_class_init(XfceVolumeClass *klass);
+static void xfce_volume_init(XfceVolume *volume);
+static void xfce_volume_finalize(GObject *obj);
+
+
+G_DEFINE_TYPE(XfceVolume, xfce_volume, G_TYPE_OBJECT)
+
+
+static void
+xfce_volume_class_init(XfceVolumeClass *klass)
+{
+    GObjectClass *object_class = (GObjectClass *)klass;
+    
+    object_class->finalize = xfce_volume_finalize;
+}
+
+static void
+xfce_volume_init(XfceVolume *volume)
+{
+    /* FIXME: connect signals */
+}
+
+static void
+xfce_volume_finalize(GObject *obj)
+{
+    XfceVolume *volume = XFCE_VOLUME(obj);
+    
+    g_object_unref(G_OBJECT(volume->tvolume));
+    
+    G_OBJECT_CLASS(xfce_volume_parent_class)->finalize(obj);
+}
+
+
+
+/*
+ * public API
+ */
+
+
+XfceVolume *
+xfce_volume_new(ThunarVfsVolume *volume)
+{
+    XfceVolume *xvolume;
+    
+    g_return_val_if_fail(THUNAR_VFS_IS_VOLUME(volume), NULL);
+    
+    xvolume = g_object_new(XFCE_TYPE_VOLUME, NULL);
+    
+    xvolume->tvolume = g_object_ref(G_OBJECT(volume));
+    
+    return xvolume;
+}
+
+GObject *
+xfce_volume_get_action(XfceVolume *volume)
+{
+    
+}
+
+XfceVolumeStatus
+xfce_volume_get_status(XfceVolume *volume)
+{
+    if(!thunar_vfs_volume_is_present(volume->tvolume))
+        return XFCE_VOLUME_STATUS_NOT_PRESENT;
+    else if(!thunar_vfs_volume_is_mounted(volume->tvolume))
+        return XFCE_VOLUME_STATUS_PRESENT_NOT_MOUNTED;
+    else
+        return XFCE_VOLUME_STATUS_PRESENT_MOUNTED;
+}
+
+gboolean
+xfce_volume_mount(XfceVolume *volume,
+                  GtkWidget *parent)
+{
+    return thunar_vfs_volume_mount(volume->tvolume, parent, NULL);
+}
+
+gboolean
+xfce_volume_unmount(XfceVolume *volume,
+                    GtkWidget *parent)
+{
+    return thunar_vfs_volume_unmount(volume->tvolume, parent, NULL);
+}
+
+gboolean
+xfce_volume_eject(XfceVolume *volume,
+                  GtkWidget *parent)
+{
+    thunar_vfs_volume_eject(volume->tvolume, parent, NULL);
+}
+
+const gchar *
+xfce_volume_get_display_name(XfceVolume *volume)
+{
+    return thunar_vfs_volume_get_name(volume->tvolume);
+}
+
+gchar *
+xfce_volume_get_mount_point(XfceVolume *volume)
+{
+    ThunarVfsPath *path = thunar_vfs_volume_get_mount_point(volume->tvolume);
+    gchar *mount_point = NULL;
+    
+    if(path)
+        mount_point = thunar_vfs_path_dup_string(path);
+    
+    return mount_point;    
+}
+
+const gchar *
+xfce_volume_get_uuid(XfceVolume *volume)
+{
+    /* FIXME: implementme */
+}

Added: xfce4-volume-manager/trunk/src/xfce-volume.h
===================================================================
--- xfce4-volume-manager/trunk/src/xfce-volume.h                                
(rev 0)
+++ xfce4-volume-manager/trunk/src/xfce-volume.h        2006-12-02 05:41:00 UTC 
(rev 24033)
@@ -0,0 +1,60 @@
+/*
+ *  xfce4-volume manager
+ *
+ *  Copyright (c) 2006 Brian Tarricone, <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License ONLY.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_VOLUME_H__
+#define __XFCE_VOLUME_H__
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#define XFCE_TYPE_VOLUME     (xfce_volume_get_type())
+#define XFCE_VOLUME(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), 
XFCE_TYPE_VOLUME, XfceVolume))
+#define XFCE_IS_VOLUME(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
XFCE_TYPE_VOLUME))
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+    XFCE_VOLUME_STATUS_NOT_PRESENT = 0,
+    XFCE_VOLUME_STATUS_PRESENT_NOT_MOUNTED,
+    XFCE_VOLUME_STATUS_PRESENT_MOUNTED,
+} XfceVolumeStatus;
+
+typedef struct _XfceVolume XfceVolume;
+
+GType xfce_volume_get_type                  () G_GNUC_CONST;
+
+XfceVolume *xfce_volume_new                 (ThunarVfsVolume *volume);
+
+GObject *xfce_volume_get_action             (XfceVolume *volume);  /* avoid 
fwd decl */
+XfceVolumeStatus xfce_volume_get_status     (XfceVolume *volume);
+
+gboolean xfce_volume_mount                  (XfceVolume *volume,
+                                             GtkWidget *parent);
+gboolean xfce_volume_unmount                (XfceVolume *volume,
+                                             GtkWidget *parent);
+gboolean xfce_volume_eject                  (XfceVolume *volume,
+                                             GtkWidget *parent);
+
+const gchar *xfce_volume_get_display_name   (XfceVolume *volume);
+gchar *xfce_volume_get_mount_point    (XfceVolume *volume);
+const gchar *xfce_volume_get_uuid           (XfceVolume *volume);
+
+G_END_DECLS
+
+#endif  /* __XFCE_VOLUME_H__ */

Added: xfce4-volume-manager/trunk/tools/show-vol-types.c
===================================================================
--- xfce4-volume-manager/trunk/tools/show-vol-types.c                           
(rev 0)
+++ xfce4-volume-manager/trunk/tools/show-vol-types.c   2006-12-02 05:41:00 UTC 
(rev 24033)
@@ -0,0 +1,46 @@
+/*
+ * I, Brian Tarricone <[EMAIL PROTECTED]> hereby release this vaguely-useful
+ * little code snippet into the public domain.  Written Nov 2006.
+ *
+ * To compile:
+ * cc -o show-vol-types show-vol-types.c `pkg-config thunar-vfs-1 --cflags 
--libs`
+ */
+
+#define EXO_API_SUBJECT_TO_CHANGE
+#include <thunar-vfs/thunar-vfs.h>
+
+int
+main(int argc,
+     char **argv)
+{
+    ThunarVfsVolumeManager *vmanager;
+    GList *volumes, *l;
+    ThunarVfsVolume *volume;
+    GEnumClass *eclass;
+    GEnumValue *eval;
+    
+    gtk_init(&argc, &argv);
+    thunar_vfs_init();
+    
+    g_return_val_if_fail(G_TYPE_IS_ENUM(THUNAR_VFS_TYPE_VFS_VOLUME_KIND), 1);
+    
+    eclass = g_type_class_ref(THUNAR_VFS_TYPE_VFS_VOLUME_KIND);
+    
+    vmanager = thunar_vfs_volume_manager_get_default();
+    
+    volumes = thunar_vfs_volume_manager_get_volumes(vmanager);
+    for(l = volumes; l; l = l->next) {
+        volume = THUNAR_VFS_VOLUME(l->data);
+        eval = g_enum_get_value(eclass,
+                                thunar_vfs_volume_get_kind(volume));
+        g_print("-> \"%s\" is %sremovable, %spresent, %smounted, %sejectable, 
of type %s\n",
+                thunar_vfs_volume_get_name(volume),
+                thunar_vfs_volume_is_removable(volume) ? "" : "not ",
+                thunar_vfs_volume_is_present(volume) ? "" : "not ",
+                thunar_vfs_volume_is_mounted(volume) ? "" : "not ",
+                thunar_vfs_volume_is_ejectable(volume) ? "" : "not ",
+                eval->value_name);
+    }
+    
+    return 0;
+}

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to