aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/e-folder-type-repository.c305
-rw-r--r--shell/e-folder-type-repository.h77
-rw-r--r--shell/e-storage-watcher.c188
-rw-r--r--shell/e-storage-watcher.h93
4 files changed, 0 insertions, 663 deletions
diff --git a/shell/e-folder-type-repository.c b/shell/e-folder-type-repository.c
deleted file mode 100644
index a1892657de..0000000000
--- a/shell/e-folder-type-repository.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-folder-type-repository.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * 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
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <gtk/gtktypeutils.h>
-
-#include "e-util/e-util.h"
-
-#include "e-shell-utils.h"
-
-#include "e-folder-type-repository.h"
-
-
-#define PARENT_TYPE GTK_TYPE_OBJECT
-static GtkObjectClass *parent_class = NULL;
-
-struct _FolderType {
- char *name;
- char *icon_name;
- char *control_id;
-
- /* The icon, standard (48x48) and mini (16x16) versions. */
- GdkPixbuf *icon_pixbuf;
- GdkPixbuf *mini_icon_pixbuf;
-};
-typedef struct _FolderType FolderType;
-
-struct _EFolderTypeRepositoryPrivate {
- GHashTable *name_to_type;
-};
-
-
-/* FIXME these are hardcoded for now. */
-
-#ifdef USING_OAF
-# define CALENDAR_CONTROL_ID "OAFIID:control:calendar:dd34ddae-25c6-486b-a8a8-3e8f0286b54c"
-# define CONTACTS_CONTROL_ID "OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49"
-# define MAIL_CONTROL_ID "OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45"
-#else
-# define CALENDAR_CONTROL_ID "control:calendar"
-# define CONTACTS_CONTROL_ID "control:addressbook"
-# define MAIL_CONTROL_ID "control:evolution-mail"
-#endif
-
-
-/* FolderType handling. */
-
-static FolderType *
-folder_type_new (const char *name,
- const char *icon_name,
- const char *control_id)
-{
- FolderType *new;
- char *icon_path;
-
- new = g_new (FolderType, 1);
-
- new->name = g_strdup (name);
- new->icon_name = g_strdup (icon_name);
- new->control_id = g_strdup (control_id);
-
- icon_path = e_shell_get_icon_path (icon_name, FALSE);
- if (icon_path == NULL)
- new->icon_pixbuf = NULL;
- else
- new->icon_pixbuf = gdk_pixbuf_new_from_file (icon_path);
-
- g_free (icon_path);
-
- icon_path = e_shell_get_icon_path (icon_name, TRUE);
- if (icon_path != NULL) {
- new->mini_icon_pixbuf = gdk_pixbuf_new_from_file (icon_path);
- } else {
- if (new->icon_pixbuf != NULL)
- new->mini_icon_pixbuf = gdk_pixbuf_ref (new->icon_pixbuf);
- else
- new->mini_icon_pixbuf = NULL;
- }
-
- g_free (icon_path);
-
- return new;
-}
-
-static void
-folder_type_free (FolderType *folder_type)
-{
- g_free (folder_type->name);
- g_free (folder_type->icon_name);
- g_free (folder_type->control_id);
-
- if (folder_type->icon_pixbuf != NULL)
- gdk_pixbuf_unref (folder_type->icon_pixbuf);
- if (folder_type->mini_icon_pixbuf != NULL)
- gdk_pixbuf_unref (folder_type->mini_icon_pixbuf);
-
- g_free (folder_type);
-}
-
-static const FolderType *
-get_folder_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name)
-{
- EFolderTypeRepositoryPrivate *priv;
-
- priv = folder_type_repository->priv;
-
- return g_hash_table_lookup (priv->name_to_type, type_name);
-}
-
-static gboolean
-add_folder_type (EFolderTypeRepository *folder_type_repository,
- const char *name,
- const char *icon_name,
- const char *control_id)
-{
- EFolderTypeRepositoryPrivate *priv;
- FolderType *folder_type;
-
- priv = folder_type_repository->priv;
-
- /* Make sure we don't add the same type twice. */
- if (get_folder_type (folder_type_repository, name) != NULL)
- return FALSE;
-
- folder_type = folder_type_new (name, icon_name, control_id);
- g_hash_table_insert (priv->name_to_type, folder_type->name, folder_type);
-
- return TRUE;
-}
-
-
-/* GtkObject methods. */
-
-static void
-hash_forall_free_folder_type (gpointer key,
- gpointer value,
- gpointer data)
-{
- FolderType *folder_type;
-
- folder_type = (FolderType *) value;
- folder_type_free (folder_type);
-}
-
-static void
-destroy (GtkObject *object)
-{
- EFolderTypeRepository *folder_type_repository;
- EFolderTypeRepositoryPrivate *priv;
-
- folder_type_repository = E_FOLDER_TYPE_REPOSITORY (object);
- priv = folder_type_repository->priv;
-
- g_hash_table_foreach (priv->name_to_type, hash_forall_free_folder_type, NULL);
- g_hash_table_destroy (priv->name_to_type);
-
- g_free (priv);
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (EFolderTypeRepositoryClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-}
-
-static void
-init (EFolderTypeRepository *folder_type_repository)
-{
- EFolderTypeRepositoryPrivate *priv;
-
- priv = g_new (EFolderTypeRepositoryPrivate, 1);
- priv->name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
-
- folder_type_repository->priv = priv;
-}
-
-
-void
-e_folder_type_repository_construct (EFolderTypeRepository *folder_type_repository)
-{
- g_return_if_fail (folder_type_repository != NULL);
- g_return_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository));
-
- GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (folder_type_repository), GTK_FLOATING);
-
- /* FIXME these are hardcoded for now. */
-
- add_folder_type (folder_type_repository,
- "mail", "evolution-inbox.png", MAIL_CONTROL_ID);
- add_folder_type (folder_type_repository,
- "calendar", "evolution-calendar.png", CALENDAR_CONTROL_ID);
- add_folder_type (folder_type_repository,
- "contacts", "evolution-contacts.png", CONTACTS_CONTROL_ID);
-}
-
-EFolderTypeRepository *
-e_folder_type_repository_new (void)
-{
- EFolderTypeRepository *new;
-
- new = gtk_type_new (e_folder_type_repository_get_type ());
-
- e_folder_type_repository_construct (new);
-
- return new;
-}
-
-
-const char *
-e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name)
-{
- const FolderType *folder_type;
-
- g_return_val_if_fail (folder_type_repository != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL);
- g_return_val_if_fail (type_name != NULL, NULL);
-
- folder_type = get_folder_type (folder_type_repository, type_name);
- if (folder_type == NULL) {
- g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name);
- return NULL;
- }
-
- return folder_type->icon_name;
-}
-
-GdkPixbuf *
-e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name,
- gboolean mini)
-{
- const FolderType *folder_type;
-
- g_return_val_if_fail (folder_type_repository != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL);
- g_return_val_if_fail (type_name != NULL, NULL);
-
- folder_type = get_folder_type (folder_type_repository, type_name);
- if (folder_type == NULL) {
- g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name);
- return NULL;
- }
-
- if (mini)
- return folder_type->mini_icon_pixbuf;
- else
- return folder_type->icon_pixbuf;
-}
-
-const char *
-e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name)
-{
- const FolderType *folder_type;
-
- g_return_val_if_fail (folder_type_repository != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER_TYPE_REPOSITORY (folder_type_repository), NULL);
- g_return_val_if_fail (type_name != NULL, NULL);
-
- folder_type = get_folder_type (folder_type_repository, type_name);
- if (folder_type == NULL) {
- g_warning ("%s: Unknown type -- %s", __FUNCTION__, type_name);
- return NULL;
- }
-
- return folder_type->control_id;
-}
-
-
-E_MAKE_TYPE (e_folder_type_repository, "EFolderTypeRepository", EFolderTypeRepository,
- class_init, init, PARENT_TYPE)
diff --git a/shell/e-folder-type-repository.h b/shell/e-folder-type-repository.h
deleted file mode 100644
index fe2b06eaf6..0000000000
--- a/shell/e-folder-type-repository.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-folder-type-repository.h
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * 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
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef _E_FOLDER_TYPE_REPOSITORY_H_
-#define _E_FOLDER_TYPE_REPOSITORY_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkobject.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_FOLDER_TYPE_REPOSITORY (e_folder_type_repository_get_type ())
-#define E_FOLDER_TYPE_REPOSITORY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY, EFolderTypeRepository))
-#define E_FOLDER_TYPE_REPOSITORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER_TYPE_REPOSITORY, EFolderTypeRepositoryClass))
-#define E_IS_FOLDER_TYPE_REPOSITORY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY))
-#define E_IS_FOLDER_TYPE_REPOSITORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_TYPE_REPOSITORY))
-
-
-typedef struct _EFolderTypeRepository EFolderTypeRepository;
-typedef struct _EFolderTypeRepositoryPrivate EFolderTypeRepositoryPrivate;
-typedef struct _EFolderTypeRepositoryClass EFolderTypeRepositoryClass;
-
-struct _EFolderTypeRepository {
- GtkObject parent;
-
- EFolderTypeRepositoryPrivate *priv;
-};
-
-struct _EFolderTypeRepositoryClass {
- GtkObjectClass parent_class;
-};
-
-
-GtkType e_folder_type_repository_get_type (void);
-void e_folder_type_repository_construct (EFolderTypeRepository *folder_type_repository);
-EFolderTypeRepository *e_folder_type_repository_new (void);
-
-GdkPixbuf *e_folder_type_repository_get_icon_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name,
- gboolean mini);
-const char *e_folder_type_repository_get_icon_name_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name);
-const char *e_folder_type_repository_get_control_id_for_type (EFolderTypeRepository *folder_type_repository,
- const char *type_name);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_FOLDER_TYPE_REPOSITORY_H_ */
diff --git a/shell/e-storage-watcher.c b/shell/e-storage-watcher.c
deleted file mode 100644
index 8312273d27..0000000000
--- a/shell/e-storage-watcher.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-storage-watcher.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * 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
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#include "e-util/e-util.h"
-
-#include "e-storage-watcher.h"
-
-
-#define PARENT_TYPE gtk_object_get_type ()
-static GtkObjectClass *parent_class = NULL;
-
-struct _EStorageWatcherPrivate {
- EStorage *storage;
- char *path;
-};
-
-
-enum {
- NEW_FOLDER,
- REMOVED_FOLDER,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EStorageWatcher *storage_watcher;
- EStorageWatcherPrivate *priv;
-
- storage_watcher = E_STORAGE_WATCHER (object);
- priv = storage_watcher->priv;
-
- g_free (priv->path);
- g_free (priv);
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* Initialization. */
-
-static void
-class_init (EStorageWatcherClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- signals[NEW_FOLDER] =
- gtk_signal_new ("new_folder",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EStorageWatcherClass, new_folder),
- gtk_marshal_NONE__POINTER_STRING_STRING,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING);
- signals[REMOVED_FOLDER] =
- gtk_signal_new ("removed_folder",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EStorageWatcherClass, removed_folder),
- gtk_marshal_NONE__POINTER_STRING_STRING,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EStorageWatcher *storage_watcher)
-{
- EStorageWatcherPrivate *priv;
-
- priv = g_new (EStorageWatcherPrivate, 1);
- priv->storage = NULL;
- priv->path = NULL;
-
- storage_watcher->priv = priv;
-}
-
-
-/* Initialization. */
-
-void
-e_storage_watcher_construct (EStorageWatcher *watcher,
- EStorage *storage,
- const char *path)
-{
- EStorageWatcherPrivate *priv;
-
- g_return_if_fail (watcher != NULL);
- g_return_if_fail (E_IS_STORAGE_WATCHER (watcher));
- g_return_if_fail (path != NULL);
-
- GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (watcher), GTK_FLOATING);
-
- priv = watcher->priv;
-
- priv->storage = storage;
- priv->path = g_strdup (path);
-}
-
-EStorageWatcher *
-e_storage_watcher_new (EStorage *storage,
- const char *path)
-{
- EStorageWatcher *watcher;
-
- g_return_val_if_fail (path != NULL, NULL);
-
- watcher = gtk_type_new (e_storage_watcher_get_type ());
-
- e_storage_watcher_construct (watcher, storage, path);
-
- return watcher;
-}
-
-
-const char *
-e_storage_watcher_get_path (EStorageWatcher *storage_watcher)
-{
- g_return_val_if_fail (storage_watcher != NULL, NULL);
- g_return_val_if_fail (E_IS_STORAGE_WATCHER (storage_watcher), NULL);
-
- return storage_watcher->priv->path;
-}
-
-
-void
-e_storage_watcher_emit_new_folder (EStorageWatcher *storage_watcher,
- const char *name)
-{
- g_return_if_fail (storage_watcher != NULL);
- g_return_if_fail (E_IS_STORAGE_WATCHER (storage_watcher));
- g_return_if_fail (name != NULL);
-
- gtk_signal_emit (GTK_OBJECT (storage_watcher), signals[NEW_FOLDER], name);
-}
-
-void
-e_storage_watcher_emit_removed_folder (EStorageWatcher *storage_watcher,
- const char *name)
-{
- g_return_if_fail (storage_watcher != NULL);
- g_return_if_fail (E_IS_STORAGE_WATCHER (storage_watcher));
- g_return_if_fail (name != NULL);
-
- gtk_signal_emit (GTK_OBJECT (storage_watcher), signals[REMOVED_FOLDER], name);
-}
-
-
-E_MAKE_TYPE (e_storage_watcher, "EStorageWatcher", EStorageWatcher, class_init, init, PARENT_TYPE)
diff --git a/shell/e-storage-watcher.h b/shell/e-storage-watcher.h
deleted file mode 100644
index 26c6edffaf..0000000000
--- a/shell/e-storage-watcher.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-storage-watcher.h
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * 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
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef _E_STORAGE_WATCHER_H_
-#define _E_STORAGE_WATCHER_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkobject.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_STORAGE_WATCHER (e_storage_watcher_get_type ())
-#define E_STORAGE_WATCHER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE_WATCHER, EStorageWatcher))
-#define E_STORAGE_WATCHER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE_WATCHER, EStorageWatcherClass))
-#define E_IS_STORAGE_WATCHER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE_WATCHER))
-#define E_IS_STORAGE_WATCHER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE_WATCHER))
-
-
-typedef struct _EStorageWatcher EStorageWatcher;
-typedef struct _EStorageWatcherPrivate EStorageWatcherPrivate;
-typedef struct _EStorageWatcherClass EStorageWatcherClass;
-
-#include "e-storage.h"
-
-struct _EStorageWatcher {
- GtkObject parent;
-
- EStorageWatcherPrivate *priv;
-};
-
-struct _EStorageWatcherClass
-{
- GtkObjectClass parent_class;
-
- /* Signals. */
-
- void (* new_folder) (EStorageWatcher *storage_watcher,
- EStorage *storage,
- const char *path,
- const char *name);
-
- void (* removed_folder) (EStorageWatcher *storage_watcher,
- EStorage *storage,
- const char *path,
- const char *name);
-};
-
-
-GtkType e_storage_watcher_get_type (void);
-void e_storage_watcher_construct (EStorageWatcher *watcher,
- EStorage *storage,
- const char *path);
-EStorageWatcher *e_storage_watcher_new (EStorage *storage,
- const char *path);
-
-const char *e_storage_watcher_get_path (EStorageWatcher *storage_watcher);
-
-void e_storage_watcher_emit_new_folder (EStorageWatcher *storage_watcher,
- const char *name);
-void e_storage_watcher_emit_removed_folder (EStorageWatcher *storage_watcher,
- const char *name);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_STORAGE_WATCHER_H__ */