[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Let's restart the code monkey!

Mike Massonnet noreply at xfce.org
Sat Jan 23 12:10:02 CET 2010


Updating branch refs/heads/aria2-xml-rpc
         to 6a91c2f85ff537bedc7ab55a39fbad38d0674996 (commit)
       from 2bf83f8b165a59832f8c44ff36b0e0302ff1fd33 (commit)

commit 6a91c2f85ff537bedc7ab55a39fbad38d0674996
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sat Jan 23 12:00:47 2010 +0100

    Let's restart the code monkey!
    
    Initial branch targetting aria2 with XML-RPC.

 ChangeLog             |    5 -
 NEWS                  |    6 +-
 README                |    6 +-
 autogen.sh            |   42 +-------
 configure.ac.in       |   52 +++-----
 eatmonkey.desktop.in  |    2 +-
 po/LINGUAS            |    2 -
 src/Makefile.am       |   58 +++++----
 src/downloadmanager.c |  318 -------------------------------------------------
 src/downloadmanager.h |   64 ----------
 src/main.c            |  202 -------------------------------
 src/statusicon.c      |  102 ----------------
 src/statusicon.h      |   55 ---------
 13 files changed, 61 insertions(+), 853 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 57bcf81..e69de29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +0,0 @@
-2008-09-06	Mike Massonnet <mmassonnet at xfce.org>
-Let's start the code monkey!  one commit = one banaan.
-
-	* */*: Initial source directory
-
diff --git a/NEWS b/NEWS
index 2beeb6c..c09a263 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
-    0.0.1 (2008-09-??)
+    0.1.0 (20xx-xx-xx)
+ 
+Works exclusively with aria2 and its XML-RPC interface.
 
-First release.
+    0.0.1 (2008-09-11
 
diff --git a/README b/README
index 760f491..7b807b5 100644
--- a/README
+++ b/README
@@ -2,8 +2,8 @@
 ===========
 
 Simple download manager for Xfce.  Eatmonkey will download all the URLs you pass
-to it and keep you informed with a status icon.  The program quits once there
-are no more URLs to download.
+to it and keep you informed with a status icon.  The download manager dialog
+lets you pause/resume add/delete downloads and tweak special download settings.
 
 
  Homepage
@@ -33,7 +33,7 @@ See the INSTALL file for more instructions.
  Report bugs
 -------------
 You can report bugs and feature requests on http://bugzilla.xfce.org/.
-Select the product “Xfce Goodies” and the component “eatmonkey”.
+Select the product “Eatmonkey”.
 
 Feature requests are always welcome.
 
diff --git a/autogen.sh b/autogen.sh
index 170897e..bde867b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,13 +1,6 @@
 #!/bin/sh
-#
-# $Id: autogen.sh 23241 2006-09-29 19:05:15Z kelnos $
-#
-# Copyright (c) 2002-2005
-#         The Xfce development team. All rights reserved.
-#
-# Written for Xfce by Benedikt Meurer <benny at xfce.org>.
-#
 
+export XDT_AUTOGEN_REQUIRED_VERSION="4.7.0"
 (type xdt-autogen) >/dev/null 2>&1 || {
   cat >&2 <<EOF
 autogen.sh: You don't seem to have the Xfce development tools installed on
@@ -17,37 +10,4 @@ autogen.sh: You don't seem to have the Xfce development tools installed on
 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
-}
-
-echo 'dnl *** This file is automatically generated from configure.ac.in ***' \
-	>configure.ac
-echo 'dnl *** DO NOT EDIT! ***' >>configure.ac
-echo >>configure.ac
-
-# substitute revision and linguas
-linguas=$(sed -e '/^#/d' po/LINGUAS)
-if [ -d .git/svn ]; then
-    revision=$(git svn find-rev trunk 2>/dev/null ||
-               git svn find-rev origin/trunk 2>/dev/null ||
-               git svn find-rev HEAD 2>/dev/null ||
-               git svn find-rev master 2>/dev/null)
-elif [ -d .svn ]; then
-    revision=$(LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}')
-else
-    revision=UNKNOWN
-fi
-sed -e "s/@LINGUAS@/${linguas}/g" \
-    -e "s/@REVISION@/${revision}/g" \
-    < "configure.ac.in" >> "configure.ac"
-
 xdt-autogen $@
-
-# vi:set ts=2 sw=2 et ai:
diff --git a/configure.ac.in b/configure.ac.in
index e225633..4635e91 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -2,25 +2,26 @@ dnl $Id$
 dnl
 dnl eatmonkey - A download managers for monkeys and Capuchins!
 dnl
-dnl 2008      Mike Massonnet <mmassonnet at xfce.org>
+dnl 2008-2009 Mike Massonnet <mmassonnet at xfce.org>
 dnl
 
 dnl ***************************
 dnl *** Version information ***
 dnl ***************************
 m4_define([project_version_major], [0])
-m4_define([project_version_minor], [0])
-m4_define([project_version_micro], [1])
-m4_define([project_version_build], [r at REVISION@])
-m4_define([project_version_tag], [svn]) # leave empty for release
-m4_define([project_version], [project_version_major().project_version_minor().project_version_micro()ifelse(project_version_tag(), [svn], [project_version_tag()-project_version_build()], [project_version_tag()])])
+m4_define([project_version_minor], [1])
+m4_define([project_version_micro], [0])
+m4_define([project_version_build], [@REVISION@])
+m4_define([project_version_tag], [git]) # leave empty for release
+m4_define([project_version], [project_version_major().project_version_minor().project_version_micro()ifelse(project_version_tag(), [git], [project_version_tag()-project_version_build()], [project_version_tag()])])
 
 dnl ***************************
 dnl *** Initialize autoconf ***
 dnl ***************************
-AC_COPYRIGHT([Copyright (c) 2008
+AC_COPYRIGHT([Copyright (c) 2008-2009
         The Xfce development team. All rights reserved.])
-AC_INIT([eatmonkey], [project_version], [http://bugzilla.xfce.org/], [eatmonkey])
+AC_INIT([Eatmonkey], [project_version], [http://bugzilla.xfce.org/], [eatmonkey],
+	[http://goodies.xfce.org/projects/applications/eatmonkey])
 AC_PREREQ([2.50])
 AC_CANONICAL_TARGET()
 AC_REVISION([project_version_build])
@@ -28,7 +29,7 @@ AC_REVISION([project_version_build])
 dnl ***************************
 dnl *** Initialize automake ***
 dnl ***************************
-AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
+AM_INIT_AUTOMAKE([1.11 dist-bzip2])
 AM_CONFIG_HEADER([config.h])
 AM_MAINTAINER_MODE()
 
@@ -36,7 +37,9 @@ dnl ********************************
 dnl *** Check for basic programs ***
 dnl ********************************
 AC_PROG_CC()
+AM_PROG_CC_C_O()
 AC_PROG_LD()
+AC_PROG_LIBTOOL()
 AC_PROG_INSTALL()
 AC_PROG_INTLTOOL()
 
@@ -45,42 +48,25 @@ dnl *** Check for standard headers ***
 dnl **********************************
 AC_HEADER_STDC()
 
-dnl 
-dnl *******************************
-dnl *** Check for X11 installed ***
-dnl *******************************
-XDT_CHECK_LIBX11_REQUIRE()
-
-dnl ******************************
-dnl *** Check for i18n support ***
-dnl ******************************
-XDT_I18N([@LINGUAS@])
-
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.16.0])
+XDT_CHECK_LIBX11_REQUIRE()
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([UNIQUE], [unique-1.0], [1.0.0])
-XDT_CHECK_PACKAGE([LIBNOTIFY], [libnotify], [0.4.4])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.4.0])
+XDT_CHECK_PACKAGE([LIBSOUP], [libsoup-2.4], [2.26])
+
+dnl ******************************
+dnl *** Check for i18n support ***
+dnl ******************************
+XDT_I18N([@LINGUAS@])
 
 dnl ***********************************
 dnl *** Check for debugging support ***
 dnl ***********************************
 XDT_FEATURE_DEBUG()
 
-dnl *********************************
-dnl *** Check for configure flags ***
-dnl *********************************
-#AC_ARG_ENABLE([funky-colors],
-#	      [AC_HELP_STRING([--enable-funky-colors], [Build with more funky colors])],
-#	      [enable_funkycolors=$enableval],
-#	      [enable_funkycolors=no])
-#if test "x$enable_funkycolors" = "xyes" ; then
-#	AC_DEFINE([MORE_FUNKY_COLOR_ON_SEARCH_ENTRY], [1], [""])
-#fi
-
 dnl ************************
 dnl *** Makefile outputs ***
 dnl ************************
diff --git a/eatmonkey.desktop.in b/eatmonkey.desktop.in
index 410a7b1..a2fbc62 100644
--- a/eatmonkey.desktop.in
+++ b/eatmonkey.desktop.in
@@ -3,7 +3,7 @@ Version=1.0
 _Name=Eatmonkey
 _Comment=Simple download manager for Xfce
 _GenericName=Download Manager
-Exec=eatmonkey
+Exec=eatmonkey --manager
 Icon=eatmonkey
 Terminal=false
 Type=Application
diff --git a/po/LINGUAS b/po/LINGUAS
deleted file mode 100644
index 1756fb5..0000000
--- a/po/LINGUAS
+++ /dev/null
@@ -1,2 +0,0 @@
-# set of available languages (in alphabetic order)
-
diff --git a/src/Makefile.am b/src/Makefile.am
index dfbf48f..99ce1e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,28 +1,36 @@
-bin_PROGRAMS = eatmonkey
-
-eatmonkey_SOURCES =							\
-	main.c								\
-	statusicon.c			statusicon.h			\
-	downloadmanager.c		downloadmanager.h
-
-eatmonkey_CFLAGS =							\
-	@GIO_CFLAGS@							\
-	@GTK_CFLAGS@							\
-	@UNIQUE_CFLAGS@							\
-	@LIBNOTIFY_CFLAGS@						\
-	@LIBXFCE4UTIL_CFLAGS@						\
-	-DDATADIR=\"$(datadir)\"					\
-	-DSRCDIR=\"$(top_srcdir)\"
+INCLUDES =								\
+ 	-I${top_srcdir}							\
+ 	-DDATADIR=\"$(datadir)\"					\
+ 	-DSRCDIR=\"$(top_srcdir)\"					\
+ 	-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"			\
+ 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
+ 	-DLOCALEDIR=\"$(localedir)\"
 
-eatmonkey_LDADD =							\
-	@GIO_LIBS@							\
-	@GTK_LIBS@							\
-	@UNIQUE_LIBS@							\
-	@LIBNOTIFY_LIBS@						\
-	@LIBXFCE4UTIL_LIBS@
+#           #
+# eatmonkey #
+#           #
 
-INCLUDES =								\
-	-I${top_srcdir}							\
-	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
-	-DLOCALEDIR=\"$(localedir)\"
+#bin_PROGRAMS = eatmonkey
+#
+#eatmonkey_VALAFLAGS =							\
+#	--thread							\
+#	--pkg=gtk+-2.0							\
+#	--pkg=unique-1.0						\
+#	--pkg=libsoup-2.4
+#
+#eatmonkey_SOURCES =							\
+#	main.vala							\
+#	eatxmlrpc.vala
+#
+#eatmonkey_CFLAGS =							\
+#	@GTK_CFLAGS@							\
+#	@UNIQUE_CFLAGS@							\
+#	@LIBXFCE4UTIL_CFLAGS@						\
+#	@LIBSOUP_CFLAGS@
+#
+#eatmonkey_LDADD =							\
+#	@GTK_LIBS@							\
+#	@UNIQUE_LIBS@							\
+#	@LIBXFCE4UTIL_LIBS@						\
+#	@LIBSOUP_LIBS@
 
diff --git a/src/downloadmanager.c b/src/downloadmanager.c
deleted file mode 100644
index 57ab59a..0000000
--- a/src/downloadmanager.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- *  Copyright (c) 2008 Mike Massonnet <mmassonnet at xfce.org>
- *
- *  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; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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 <glib.h>
-#include <gio/gio.h>
-#include <libnotify/notify.h>
-#include <libxfce4util/libxfce4util.h>
-
-#include "downloadmanager.h"
-
-G_DEFINE_TYPE (EatDm, eat_dm, G_TYPE_OBJECT)
-
-#define DM_GET_PRIVATE(o) \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((o), EAT_TYPE_DM, EatDmPrivate))
-
-static void             eat_dm_class_init             (EatDmClass *klass);
-static void             eat_dm_init                   (EatDm *dm);
-
-static void             cb_download_ready             (GObject *source_object,
-                                                       GAsyncResult *res,
-                                                       gpointer user_data);
-static void             cb_download_progress          (goffset current_num_bytes,
-                                                       goffset total_num_bytes,
-                                                       gpointer user_data);
-static void             cb_notification_close         (NotifyNotification *notification,
-                                                       gpointer user_data);
-static void             cb_hash_table_destroy_key     (gpointer user_data);
-static void             cb_hash_table_destroy_value   (gpointer user_data);
-
-
-
-enum
-{
-  DOWNLOADS_COMPLETED,
-  LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-
-typedef struct _Download Download;
-struct _Download
-{
-  NotifyNotification       *start_notification;
-  gchar                    *source;
-  gchar                    *destination;
-};
-
-struct _EatDmPrivate
-{
-  GHashTable               *downloads;
-  gchar                    *destination_dir;
-};
-
-
-
-static GObjectClass *parent_class = NULL;
-
-
-
-static void
-eat_dm_class_init (EatDmClass *klass)
-{
-  G_GNUC_UNUSED GObjectClass *gobject_class;
-
-  g_type_class_add_private (klass, sizeof (EatDmPrivate));
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_class = G_OBJECT_CLASS (klass);
-
-  signals[DOWNLOADS_COMPLETED] =
-    g_signal_new ("downloads-completed", G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_FIRST|G_SIGNAL_ACTION,
-                  G_STRUCT_OFFSET (EatDmClass, downloads_completed),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-}
-
-static void
-eat_dm_init (EatDm *dm)
-{
-  dm->priv = DM_GET_PRIVATE (dm);
-
-  dm->priv->downloads =
-    g_hash_table_new_full (g_str_hash, g_str_equal,
-                           (GDestroyNotify)cb_hash_table_destroy_key,
-                           (GDestroyNotify)cb_hash_table_destroy_value);
-
-  /* Init destination directory */
-  dm->priv->destination_dir = g_strdup ("/tmp/downloads");
-  if (g_mkdir_with_parents (dm->priv->destination_dir, 0755) == -1)
-    {
-      /* TODO bug the user to choose another directory */
-      g_warning ("The destination folder can't be created");
-    }
-
-}
-
-static void
-eat_dm_dispose (EatDm *dm)
-{
-  g_free (dm->priv->destination_dir);
-}
-
-
-
-EatDm *
-eat_dm_new ()
-{
-  return g_object_new (EAT_TYPE_DM,
-                       NULL);
-}
-
-void
-eat_dm_add_uris (EatDm *dm,
-                 const gchar **uris)
-{
-  gint i;
-  for (i = 0; NULL != uris[i]; i++)
-    eat_dm_add_uri (dm, uris[i]);
-}
-
-void
-eat_dm_add_uri (EatDm *dm,
-                const gchar *uri)
-{
-  GFile        *src;
-  GFile        *dst;
-  gchar        *key;
-  gchar        *filename;
-  gchar        *destination;
-  Download     *download;
-  GError       *error = NULL;
-
-  g_return_if_fail (G_UNLIKELY (NULL != uri));
-
-  if (G_UNLIKELY (NULL != g_hash_table_lookup (dm->priv->downloads, uri)))
-    {
-      /* TODO prevent the user that this file is being handled by the download
-       * manager */
-      return;
-    }
-
-  /* Set source file */
-  src = g_file_new_for_uri (uri);
-
-  /* Set destination file */
-  filename = g_file_get_basename (src);
-  /* NOTE for portability: filename can be the letter of the hard-drive on Windows */
-  if (filename[0] == '/')
-    {
-      g_free (filename);
-      filename = g_strdup ("index.html");
-    }
-  destination = g_build_filename (dm->priv->destination_dir, filename, NULL);
-  dst = g_file_new_for_path (destination);
-
-  /* Copy the file asynchronously */
-  g_file_copy_async (src, dst, G_FILE_COPY_NONE,
-                     G_PRIORITY_DEFAULT,
-                     NULL,
-                     (GFileProgressCallback)cb_download_progress, NULL,
-                     (GAsyncReadyCallback)cb_download_ready, dm);
-
-  /* Append a download entry to the download manager */
-  download = g_slice_new0 (Download);
-  download->start_notification = NULL;
-  if (notify_is_initted ())
-    {
-      download->start_notification =
-        notify_notification_new (_("Eatmonkey"),
-                                 _("Download started"),
-                                 GTK_STOCK_SAVE, NULL);
-      notify_notification_show (download->start_notification, NULL);
-      g_signal_connect (download->start_notification, "closed",
-                        G_CALLBACK (cb_notification_close), download);
-    }
-  download->source = g_strdup (uri);
-  download->destination = g_strdup (destination);
-
-  key = g_strdup (uri);
-  g_hash_table_insert (dm->priv->downloads, (gpointer)key, download);
-
-  /* Clean up */
-  g_free (filename);
-  g_free (destination);
-
-  g_debug ("download started");
-}
-
-void
-eat_dm_set_destination_dir (EatDm *dm,
-                            const gchar *destination_dir)
-{
-  g_return_if_fail (G_UNLIKELY (NULL != destination_dir));
-
-  g_free (dm->priv->destination_dir);
-  dm->priv->destination_dir = g_strdup (destination_dir);
-}
-
-
-
-static void
-cb_download_ready (GObject *source_object,
-                   GAsyncResult *res,
-                   gpointer user_data)
-{
-  gchar                *src;
-  EatDm                *dm = user_data;
-  Download             *download = NULL;
-  NotifyNotification   *complete_notification;
-  GError               *error = NULL;
-
-  g_return_if_fail (G_LIKELY (G_IS_FILE (source_object)));
-
-  src = g_file_get_uri (G_FILE (source_object));
-  download = g_hash_table_lookup (dm->priv->downloads, src);
-
-  if (notify_is_initted () && NULL != download->start_notification)
-    notify_notification_close (download->start_notification, NULL);
-
-  if (!g_file_copy_finish (G_FILE (source_object), res, &error))
-    {
-      switch (error->code)
-        {
-        case G_IO_ERROR_EXISTS:
-          /* TODO bug the user to rename the destination filename + add
-           * checkbox "Append automatically with a number and don't show this
-           * message again" */
-          /* XXX we probably wish to intercept this problem before we start the
-           * download, not sure how it is possible to effectively save the
-           * source after g_file_copy_finish() has been called */
-          g_debug ("The file already exists!");
-          break;
-        }
-    }
-  else
-    {
-      if (notify_is_initted ())
-        {
-          complete_notification =
-            notify_notification_new (_("Eatmonkey"),
-                                     _("The download is complete"),
-                                     GTK_STOCK_SAVE, NULL);
-          notify_notification_show (complete_notification, NULL);
-          g_signal_connect (complete_notification, "closed",
-                            G_CALLBACK (cb_notification_close), NULL);
-        }
-    }
-
-  /* Drop the download from the hash table */
-  g_hash_table_remove (dm->priv->downloads, src);
-  g_free (src);
-
-  if (g_hash_table_size (dm->priv->downloads) == 0)
-    g_signal_emit (dm, signals[DOWNLOADS_COMPLETED], 0);
-}
-
-static void
-cb_download_progress (goffset current_num_bytes,
-                      goffset total_num_bytes,
-                      gpointer user_data)
-{
-#ifdef DEBUG
-  g_debug ("Progress: %d/%d", current_num_bytes, total_num_bytes);
-#endif
-}
-
-static void
-cb_notification_close (NotifyNotification *notification,
-                       gpointer user_data)
-{
-  Download *download = user_data;
-
-  if (download != NULL)
-    download->start_notification = NULL;
-
-  g_object_unref (notification);
-}
-
-static void
-cb_hash_table_destroy_key (gpointer user_data)
-{
-  gchar *key = user_data;
-  g_free (key);
-}
-
-static void
-cb_hash_table_destroy_value (gpointer user_data)
-{
-  Download *download = user_data;
-  g_free (download->source);
-  g_free (download->destination);
-  g_slice_free (Download, download);
-}
-
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
deleted file mode 100644
index 2c7a9d2..0000000
--- a/src/downloadmanager.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Copyright (c) 2008 Mike Massonnet <mmassonnet at xfce.org>
- *
- *  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; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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 __EAT_DOWNLOAD_MANAGER_H__
-#define __EAT_DOWNLOAD_MANAGER_H__
-
-G_BEGIN_DECLS
-
-#define EAT_TYPE_DM                       (eat_dm_get_type())
-
-#define EAT_DM(obj)                       (G_TYPE_CHECK_INSTANCE_CAST ((obj), EAT_TYPE_DM, EatDm))
-#define EAT_DM_CLASS(klass)               (G_TYPE_CHECK_CLASS_CAST ((klass), EAT_TYPE_DM, EatDmClass))
-
-#define EAT_IS_DM(obj)                    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EAT_TYPE_DM))
-#define EAT_IS_DM_CLASS(klass)            (G_TYPE_CHECK_CLASS_TYPE ((klass), EAT_TYPE_DM))
-
-#define EAT_DM_GET_CLASS(obj)             (G_TYPE_INSTANCE_GET_CLASS ((obj), EAT_TYPE_DM, EatDmClass))
-
-typedef struct _EatDmClass                EatDmClass;
-typedef struct _EatDm                     EatDm;
-typedef struct _EatDmPrivate              EatDmPrivate;
-
-struct _EatDmClass
-{
-  GObjectClass                  parent_class;
-
-  void (*downloads_completed)  (EatDm *dm, gpointer user_data);
-};
-
-struct _EatDm
-{
-  GObject                       parent;
-
-  /* private */
-  EatDmPrivate                 *priv;
-};
-
-GType                           eat_dm_get_type                () G_GNUC_CONST;
-
-EatDm *                         eat_dm_new                     ();
-void                            eat_dm_add_uris                (EatDm *dm,
-                                                                const gchar **uris);
-void                            eat_dm_add_uri                 (EatDm *dm,
-                                                                const gchar *uri);
-
-G_END_DECLS
-
-#endif
-
diff --git a/src/main.c b/src/main.c
deleted file mode 100644
index 4b272d7..0000000
--- a/src/main.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *  Copyright (c) 2008 Mike Massonnet <mmassonnet at xfce.org>
- *
- *  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; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <unique/unique.h>
-#include <libnotify/notify.h>
-#include <libxfce4util/libxfce4util.h>
-
-#include "statusicon.h"
-#include "downloadmanager.h"
-
-
-
-static gboolean         check_is_embedded                      (GtkStatusIcon *status_icon);
-static UniqueResponse   cb_message_received                    (UniqueApp *app,
-                                                                UniqueCommand command,
-                                                                UniqueMessageData *message,
-                                                                guint time,
-                                                                gpointer user_data);
-
-
-
-/* Option entries */
-static gboolean opt_version = FALSE;
-static gchar **uris = NULL;
-static GOptionEntry option_entries[] =
-{
-    { "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, N_("Version information"), NULL },
-    { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris, N_("URIs"), NULL },
-    { NULL }
-};
-
-
-
-gint
-main (gint argc,
-      gchar *argv[])
-{
-  UniqueApp            *app;
-  UniqueMessageData    *message;
-  UniqueResponse        response;
-  GtkStatusIcon        *status_icon;
-  EatDm                *dm;
-  GError               *error = NULL;
-
-  xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
-
-  /* Init GTK+ */
-  if (!gtk_init_with_args (&argc, &argv, "[URIs]", option_entries, GETTEXT_PACKAGE, &error))
-    {
-      if (G_LIKELY (error))
-        {
-          /* Print error */
-          g_print ("%s: %s.\n", PACKAGE_NAME, error->message);
-          g_print ("Type '%s --help' for usage.", PACKAGE_NAME);
-          g_print ("\n");
-
-          /* Cleanup */
-          g_error_free (error);
-        }
-      else
-        g_error ("Unable to open display.");
-
-      return EXIT_FAILURE;
-    }
-
-  /* Print version information */
-  if (G_UNLIKELY (opt_version))
-    {
-      g_print ("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
-      return EXIT_SUCCESS;
-    }
-
-  /* Print short usage */
-  if (G_UNLIKELY (NULL == uris))
-    {
-      g_print ("No URIs specified.\n");
-      g_print ("Type '%s --help' for usage.", PACKAGE_NAME);
-      g_print ("\n");
-      return EXIT_FAILURE;
-    }
-
-  app = unique_app_new ("org.Xfce.Eatmonkey", NULL);
-
-  if (unique_app_is_running (app))
-    {
-      /* Send a message to the first instance */
-      message = unique_message_data_new ();
-      unique_message_data_set_uris (message, uris);
-      g_debug ("now sending the message");
-      response = unique_app_send_message (app, UNIQUE_OPEN, message);
-      g_debug ("and the response is: %d", response);
-
-      unique_message_data_free (message);
-      g_object_unref (app);
-
-      return (response == UNIQUE_RESPONSE_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
-    }
-
-  /* Init libnotify */
-  notify_init (PACKAGE_NAME);
-
-  /* Status icon */
-  status_icon = eat_statusicon_new ();
-  g_idle_add ((GSourceFunc)check_is_embedded, status_icon);
-
-  /* Download manager */
-  dm = eat_dm_new ();
-  eat_dm_add_uris (dm, uris);
-
-  /* Connect signals */
-  //g_signal_connect (dm, "downloads-completed",
-    //                G_CALLBACK (gtk_main_quit), NULL);
-  g_signal_connect (app, "message-received",
-                    G_CALLBACK (cb_message_received), dm);
-
-  /* Start */
-  gtk_main ();
-
-  /* Quit */
-  notify_uninit ();
-  g_object_unref (app);
-
-  return EXIT_SUCCESS;
-}
-
-static gboolean
-check_is_embedded (GtkStatusIcon *status_icon)
-{
-  GtkWidget *dialog;
-  GtkWidget *vbox;
-  GtkWidget *checkbox;
-
-  if (gtk_status_icon_is_embedded (status_icon))
-    return FALSE;
-
-  dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
-                                               _("<b>Eatmonkey</b>"));
-  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                            _("There seem to be no system tray running on your desktop."));
-  vbox = GTK_DIALOG (dialog)->vbox;
-
-  checkbox = gtk_check_button_new_with_mnemonic (_("_Don't show this message again"));
-  gtk_widget_show (checkbox);
-  gtk_container_add (GTK_CONTAINER (vbox), checkbox);
-
-  gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
-
-  return FALSE;
-}
-
-static UniqueResponse
-cb_message_received (UniqueApp *app,
-                     UniqueCommand command,
-                     UniqueMessageData *message,
-                     guint time,
-                     gpointer user_data)
-{
-  EatDm *dm = user_data;
-  gchar **uris;
-
-  g_return_val_if_fail (G_LIKELY (NULL != dm), UNIQUE_RESPONSE_FAIL);
-
-  switch (command)
-    {
-    case UNIQUE_OPEN:
-      uris = unique_message_data_get_uris (message);
-      eat_dm_add_uris (dm, uris);
-      g_strfreev (uris);
-      break;
-
-    default:
-      return UNIQUE_RESPONSE_FAIL;
-    }
-
-  return UNIQUE_RESPONSE_OK;
-}
-
diff --git a/src/statusicon.c b/src/statusicon.c
deleted file mode 100644
index 87325af..0000000
--- a/src/statusicon.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *  Copyright (c) 2008 Mike Massonnet <mmassonnet at xfce.org>
- *
- *  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; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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 <gtk/gtk.h>
-
-#include "statusicon.h"
-
-G_DEFINE_TYPE (EatStatusicon, eat_statusicon, GTK_TYPE_STATUS_ICON)
-
-#define STATUSICON_GET_PRIVATE(o) \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((o), EAT_TYPE_STATUSICON, EatStatusiconPrivate))
-
-
-
-static void             eat_statusicon_class_init              (EatStatusiconClass *klass);
-static void             eat_statusicon_init                    (EatStatusicon *statusicon);
-
-static void             cb_activate                            (GtkStatusIcon *status_icon,
-                                                                G_GNUC_UNUSED gpointer user_data);
-static void             cb_popup_menu                          (GtkStatusIcon *status_icon,
-                                                                guint button,
-                                                                guint activate_time,
-                                                                G_GNUC_UNUSED gpointer user_data);
-
-
-
-struct _EatStatusiconPrivate
-{
-};
-
-static GObjectClass *parent_class = NULL;
-
-
-
-static void
-eat_statusicon_class_init (EatStatusiconClass *klass)
-{
-  G_GNUC_UNUSED GObjectClass *object_class;
-
-  //g_type_class_add_private (klass, sizeof (EatStatusiconPrivate));
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  object_class = G_OBJECT_CLASS (klass);
-}
-
-static void
-eat_statusicon_init (EatStatusicon *statusicon)
-{
-  g_signal_connect (statusicon, "activate",
-                    G_CALLBACK (cb_activate), NULL);
-  g_signal_connect (statusicon, "popup-menu",
-                    G_CALLBACK (cb_popup_menu), NULL);
-}
-
-
-
-GtkStatusIcon *
-eat_statusicon_new ()
-{
-  return g_object_new (EAT_TYPE_STATUSICON,
-                       "stock", GTK_STOCK_SAVE,
-                       NULL);
-}
-
-
-
-static void
-cb_activate (GtkStatusIcon *status_icon,
-             G_GNUC_UNUSED gpointer user_data)
-{
-  g_message ("status icon activated");
-}
-
-static void
-cb_popup_menu (GtkStatusIcon *status_icon,
-               guint button,
-               guint activate_time,
-               G_GNUC_UNUSED gpointer user_data)
-{
-  g_message ("status icon pop up menu (%d %d)", button, activate_time);
-}
-
diff --git a/src/statusicon.h b/src/statusicon.h
deleted file mode 100644
index fb95dab..0000000
--- a/src/statusicon.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2008 Mike Massonnet <mmassonnet at xfce.org>
- *
- *  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; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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 __EAT_STATUSICON_H__
-#define __EAT_STATUSICON_H__
-
-G_BEGIN_DECLS
-
-#define EAT_TYPE_STATUSICON               (eat_statusicon_get_type())
-
-#define EAT_STATUSICON(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), EAT_TYPE_STATUSICON, EatStatusicon))
-#define EAT_STATUSICON_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), EAT_TYPE_STATUSICON, EatStatusiconClass))
-
-#define EAT_IS_STATUSICON(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EAT_TYPE_STATUSICON))
-#define EAT_IS_STATUSICON_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), EAT_TYPE_STATUSICON))
-
-#define EAT_STATUSICON_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), EAT_TYPE_STATUSICON, EatStatusiconClass))
-
-typedef struct _EatStatusiconClass        EatStatusiconClass;
-typedef struct _EatStatusicon             EatStatusicon;
-typedef struct _EatStatusiconPrivate      EatStatusiconPrivate;
-
-struct _EatStatusiconClass
-{
-  GtkStatusIconClass        parent_class;
-};
-
-struct _EatStatusicon
-{
-  GtkStatusIcon             parent;
-};
-
-GType                       eat_statusicon_get_type                    () G_GNUC_CONST;
-
-GtkStatusIcon *             eat_statusicon_new                         ();
-
-G_END_DECLS
-
-#endif
-



More information about the Xfce4-commits mailing list