summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com>2009-02-05 14:11:30 +0100
committerTomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com>2009-02-05 14:11:30 +0100
commit4e5430b282708b5748e1dc65d59d858ef6bd43ca (patch)
tree3076e5f06d88fa288c7a3f57578da573ef7e2067
parent3faae58d3ad5e3121067bca3ba0a0b122e74ae02 (diff)
downloadnautilus-gdu-4e5430b282708b5748e1dc65d59d858ef6bd43ca.tar.gz
nautilus-gdu-4e5430b282708b5748e1dc65d59d858ef6bd43ca.tar.xz
nautilus-gdu-4e5430b282708b5748e1dc65d59d858ef6bd43ca.zip
Boilerplate for standalone mode
-rw-r--r--.gitignore2
-rw-r--r--README6
-rw-r--r--TODO1
-rw-r--r--configure.in93
-rw-r--r--src/Makefile.am43
-rw-r--r--src/gnome-disk-utility-format.c43
-rw-r--r--src/nautilus-gdu-window.c3
-rw-r--r--src/nautilus-gdu-window.h1
-rw-r--r--src/nautilus-gnome-disk-utility.c (renamed from src/gnome-disk-utility.c)0
9 files changed, 160 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore
index e1ad8c5..e3f2d7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ mkinstalldirs
po/POTFILES
po/stamp-it
stamp-h1
+compile
+src/gnome-disk-utility-format
*/.deps/
*/.libs/
diff --git a/README b/README
index 9f5a27f..24447c2 100644
--- a/README
+++ b/README
@@ -1,2 +1,4 @@
-This is a set of disk utilities, available from a context menu over mountable drives.
-
+Nautilus-gdu is a simple extension for formatting disks, usb sticks and other media,
+available from Nautilus context menu. This extension is built on top.
+of the gnome-disk-utility library with DeviceKit-disks as a backend.
+Access to physical devices is controlled by PolicyKit.
diff --git a/TODO b/TODO
index 5640e12..04fc65d 100644
--- a/TODO
+++ b/TODO
@@ -23,6 +23,7 @@ DONE, NEEDS_TESTING - monitor device/presentable events like eject, umount etc.
- localization (transifex? -- ask hughsie)
- test multihead (need to ref screen of the source nautilus window)
- nautilus integration: be able to spawn the dialog from sidebar
+DONE - make standalone mode optional (configure --enable-standalone)
Ideas:
diff --git a/configure.in b/configure.in
index 3b4923d..1fc5f23 100644
--- a/configure.in
+++ b/configure.in
@@ -16,8 +16,16 @@ NAUTILUS_REQUIRED=2.24.0
GDU_REQUIRED=0.1
GDU_GTK_REQUIRED=0.1
+AC_C_CONST
+AC_ISC_POSIX
AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AM_DISABLE_STATIC
AM_PROG_LIBTOOL
+AM_PROG_CC_C_O
dnl Check for pkgconfig first
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
@@ -28,40 +36,86 @@ if test "x$HAVE_PKGCONFIG" = "xno"; then
AC_MSG_ERROR(you need to have pkgconfig installed !)
fi
-PKG_CHECK_MODULES(ALL, [
+PKG_CHECK_MODULES(CORE, [
glib-2.0 >= $GLIB_REQUIRED
gio-unix-2.0
gio-2.0
gtk+-2.0 >= $GTK_REQUIRED
libxml-2.0
- libnautilus-extension >= $NAUTILUS_REQUIRED
polkit
gdu >= $GDU_REQUIRED
gdu-gtk >= $GDU_GTK_REQUIRED
])
-
-dnl make GNOME_CFLAGS and GNOME_LIBS available
-AC_SUBST(ALL_CFLAGS)
-AC_SUBST(ALL_LIBS)
-
-dnl core libs
-CORE_MODULES="glib-2.0 gio-unix-2.0 gio-2.0 gtk+-2.0 libxml-2.0 libnautilus-extension gdu gdu-gtk"
-CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES`"
AC_SUBST(CORE_CFLAGS)
-CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES`"
AC_SUBST(CORE_LIBS)
+dnl core libs
+dnl CORE_MODULES="glib-2.0 gio-unix-2.0 gio-2.0 gtk+-2.0 libxml-2.0 libnautilus-extension gdu gdu-gtk"
+dnl CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES`"
+dnl AC_SUBST(CORE_CFLAGS)
+dnl CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES`"
+dnl AC_SUBST(CORE_LIBS)
+
DISABLE_DEPRECATED_CFLAGS=" -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED"
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
-dnl Get nautilus extensions directory
-NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
-AC_SUBST(NAUTILUS_EXTENSION_DIR)
-
dnl WARN_CFLAGS="-Wall -Werror"
WARN_CFLAGS="-Wall"
AC_SUBST(WARN_CFLAGS)
+
+
+
+
+
+
+dnl **************************************************
+dnl *** Enable nautilus extension? (default = yes) ***
+dnl **************************************************
+AC_ARG_ENABLE(nautilus, AC_HELP_STRING([--disable-nautilus], [disable nautilus extension]))
+msg_nautilus_extension=no
+NAUTILUS_LIBS=
+NAUTILUS_CFLAGS=
+NAUTILUS_EXTENSION_DIR=
+
+if test "x$enable_nautilus" != "xno"; then
+ PKG_CHECK_EXISTS(libnautilus-extension, msg_nautilus_extension=yes)
+
+ dnl Get nautilus extensions directory
+ NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
+
+ if test "x$msg_nautilus_extension" == "xyes"; then
+ PKG_CHECK_MODULES(NAUTILUS, libnautilus-extension >= $NAUTILUS_REQUIRED)
+ dnl -- not needed?
+ dnl AC_DEFINE(HAVE_NAUTILUS, 1, [Define to 1 if libnautilus-extension is available])
+ fi
+fi
+
+AC_SUBST(NAUTILUS_LIBS)
+AC_SUBST(NAUTILUS_CFLAGS)
+AC_SUBST(NAUTILUS_EXTENSION_DIR)
+
+AM_CONDITIONAL(ENABLE_NAUTILUS, [test "$msg_nautilus_extension" = "yes"])
+
+
+
+dnl **********************************************
+dnl *** Enable standalone mode? (default = no) ***
+dnl **********************************************
+AC_ARG_ENABLE(standalone,
+ AC_HELP_STRING([--enable-standalone], [build standalone mode (gnome-disk-utility-format)]),
+ msg_standalone_mode=$enableval,
+ msg_standalone_mode=no)
+STANDALONE_LIBS=
+STANDALONE_CFLAGS=
+AC_SUBST(STANDALONE_LIBS)
+AC_SUBST(STANDALONE_CFLAGS)
+
+AM_CONDITIONAL(ENABLE_STANDALONE, test "$msg_standalone_mode" = "yes")
+
+
+
+
dnl intltool stuff
AC_PROG_INTLTOOL(0.18)
dnl AM_WITH_NLS
@@ -77,3 +131,12 @@ AC_CONFIG_FILES([
po/Makefile.in
])
AC_OUTPUT
+
+echo
+echo "nautilus-gdu configuration summary:"
+echo "
+ Nautilus extension directory: $NAUTILUS_EXTENSION_DIR
+
+ build nautilus extension: $msg_nautilus_extension
+ build standalone mode: $msg_standalone_mode
+"
diff --git a/src/Makefile.am b/src/Makefile.am
index 45137c8..48a1e70 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,25 +1,46 @@
+NULL =
+
INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-GDU\" \
-DDATADIR=\"$(datadir)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir) \
-I$(top_builddir) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
- $(ALL_CFLAGS) \
+ $(CORE_CFLAGS) \
-DGDU_API_IS_SUBJECT_TO_CHANGE \
-DGDU_GTK_API_IS_SUBJECT_TO_CHANGE
-nautilus_extensiondir=$(NAUTILUS_EXTENSION_DIR)
+bin_PROGRAMS = \
+ $(NULL)
-nautilus_extension_LTLIBRARIES=libnautilus-gdu.la
+CORE_SOURCES = \
+ nautilus-gdu-window.c \
+ nautilus-gdu-window.h \
+ $(NULL)
-libnautilus_gdu_la_SOURCES = \
- nautilus-gdu.c \
- nautilus-gdu.h \
- gnome-disk-utility.c \
- nautilus-gdu-window.c \
- nautilus-gdu-window.h
+if ENABLE_NAUTILUS
+nautilus_extensiondir=$(NAUTILUS_EXTENSION_DIR)
+nautilus_extension_LTLIBRARIES=libnautilus-gdu.la
+
+libnautilus_gdu_la_SOURCES = \
+ $(CORE_SOURCES) \
+ nautilus-gnome-disk-utility.c \
+ nautilus-gdu.c \
+ nautilus-gdu.h \
+ $(NULL)
+libnautilus_gdu_la_CPPFLAGS = $(NAUTILUS_CFLAGS) -DG_LOG_DOMAIN=\"Nautilus-GDU\"
libnautilus_gdu_la_LDFLAGS = -module -avoid-version
-libnautilus_gdu_la_LIBADD = $(ALL_LIBS)
+libnautilus_gdu_la_LIBADD = $(CORE_LIBS) $(NAUTILUS_LIBS)
+endif
+
+if ENABLE_STANDALONE
+bin_PROGRAMS += gnome-disk-utility-format
+gnome_disk_utility_format_SOURCES = \
+ $(CORE_SOURCES) \
+ gnome-disk-utility-format.c \
+ $(NULL)
+gnome_disk_utility_format_CPPFLAGS = $(STANDALONE_CFLAGS) -DG_LOG_DOMAIN=\"GDU-Format\"
+gnome_disk_utility_format_LDADD = $(CORE_LIBS) $(STANDALONE_LIBS)
+endif
diff --git a/src/gnome-disk-utility-format.c b/src/gnome-disk-utility-format.c
new file mode 100644
index 0000000..753afa8
--- /dev/null
+++ b/src/gnome-disk-utility-format.c
@@ -0,0 +1,43 @@
+/*
+ * gnome-disk-utility-format.c
+ *
+ * Copyright (C) 2008-2009 Red Hat, Inc.
+ *
+ * This library 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; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Tomas Bzatek <tbzatek@redhat.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h> /* for GETTEXT_PACKAGE */
+#endif
+
+// #include "nautilus-gdu-window.h"
+
+#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+#include <gdu/gdu.h>
+
+
+
+int
+main (int argc, char *argv[])
+{
+
+ g_print ("Hello world!\n");
+
+ return 0;
+}
diff --git a/src/nautilus-gdu-window.c b/src/nautilus-gdu-window.c
index 91b004d..89e12af 100644
--- a/src/nautilus-gdu-window.c
+++ b/src/nautilus-gdu-window.c
@@ -25,9 +25,6 @@
#include <config.h> /* for GETTEXT_PACKAGE */
#endif
-#include "nautilus-gdu.h"
-#include "nautilus-gdu-window.h"
-
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
diff --git a/src/nautilus-gdu-window.h b/src/nautilus-gdu-window.h
index 76707f3..55e2cf1 100644
--- a/src/nautilus-gdu-window.h
+++ b/src/nautilus-gdu-window.h
@@ -24,7 +24,6 @@
#ifndef NAUTILUS_GDU_WINDOW_H
#define NAUTILUS_GDU_WINDOW_H
-#include <nautilus-gdu.h>
#include <gdu/gdu.h>
diff --git a/src/gnome-disk-utility.c b/src/nautilus-gnome-disk-utility.c
index c8ab203..c8ab203 100644
--- a/src/gnome-disk-utility.c
+++ b/src/nautilus-gnome-disk-utility.c