aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-21 20:35:45 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-21 20:35:45 +0800
commit6d0925a6632ab79046b1d59b74d88f3b5bc39eae (patch)
treeb4f488786c5cf5395421be6a3605b287985e760b
parent3b1d26f1fd1107ed5196c8fb48dd40bbf888cda4 (diff)
downloadgsoc2013-epiphany-6d0925a6632ab79046b1d59b74d88f3b5bc39eae.tar.gz
gsoc2013-epiphany-6d0925a6632ab79046b1d59b74d88f3b5bc39eae.tar.zst
gsoc2013-epiphany-6d0925a6632ab79046b1d59b74d88f3b5bc39eae.zip
Remove fs autocompletion, we are a browser after all
2003-01-21 Marco Pesenti Gritti <marco@it.gnome.org> * lib/Makefile.am: * lib/ephy-filesystem-autocompletion.c: * lib/ephy-filesystem-autocompletion.h: Remove fs autocompletion, we are a browser after all
-rw-r--r--ChangeLog8
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/ephy-filesystem-autocompletion.c339
-rw-r--r--lib/ephy-filesystem-autocompletion.h70
4 files changed, 8 insertions, 411 deletions
diff --git a/ChangeLog b/ChangeLog
index 3083f8d0d..05b7fd58b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2003-01-21 Marco Pesenti Gritti <marco@it.gnome.org>
+ * lib/Makefile.am:
+ * lib/ephy-filesystem-autocompletion.c:
+ * lib/ephy-filesystem-autocompletion.h:
+
+ Remove fs autocompletion, we are a browser after all
+
+2003-01-21 Marco Pesenti Gritti <marco@it.gnome.org>
+
* embed/mozilla/BaseProtocolContentHandler.cpp:
* embed/mozilla/StartHereProtocolHandler.cpp:
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7d324f0e9..d32f31364 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -29,8 +29,6 @@ libephy_la_SOURCES = \
ephy-dnd.h \
ephy-file-helpers.c \
ephy-file-helpers.h \
- ephy-filesystem-autocompletion.c \
- ephy-filesystem-autocompletion.h \
ephy-glade.c \
ephy-glade.h \
ephy-gobject-misc.h \
diff --git a/lib/ephy-filesystem-autocompletion.c b/lib/ephy-filesystem-autocompletion.c
deleted file mode 100644
index b1f340a4c..000000000
--- a/lib/ephy-filesystem-autocompletion.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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, 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ephy-autocompletion-source.h"
-#include "ephy-filesystem-autocompletion.h"
-#include "ephy-gobject-misc.h"
-#include "ephy-debug.h"
-
-#include <string.h>
-#include <libgnomevfs/gnome-vfs-async-ops.h>
-
-/**
- * Private data
- */
-struct _EphyFilesystemAutocompletionPrivate {
- gchar *current_dir;
- gchar *base_dir;
- GnomeVFSURI *base_dir_uri;
- gchar *basic_key;
- gchar *basic_key_dir;
- GSList *files;
-
- guint score;
- GnomeVFSAsyncHandle *load_handle;
-};
-
-/**
- * Private functions, only availble from this file
- */
-static void ephy_filesystem_autocompletion_class_init (EphyFilesystemAutocompletionClass *klass);
-static void ephy_filesystem_autocompletion_init (EphyFilesystemAutocompletion *as);
-static void ephy_filesystem_autocompletion_finalize_impl (GObject *o);
-static void ephy_filesystem_autocompletion_autocompletion_source_init (EphyAutocompletionSourceIface *iface);
-static void ephy_filesystem_autocompletion_autocompletion_source_foreach (EphyAutocompletionSource *source,
- const gchar *current_text,
- EphyAutocompletionSourceForeachFunc func,
- gpointer data);
-void ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
- const gchar *basic_key);
-static void ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (EphyFilesystemAutocompletion *gh);
-static void ephy_filesystem_autocompletion_set_current_dir (EphyFilesystemAutocompletion *fa, const gchar *d);
-
-
-static gpointer g_object_class;
-
-/**
- * FilesystemAutocompletion object
- */
-MAKE_GET_TYPE_IFACE (ephy_filesystem_autocompletion, "EphyFilesystemAutocompletion", EphyFilesystemAutocompletion,
- ephy_filesystem_autocompletion_class_init, ephy_filesystem_autocompletion_init, G_TYPE_OBJECT,
- ephy_filesystem_autocompletion_autocompletion_source_init, EPHY_TYPE_AUTOCOMPLETION_SOURCE);
-
-static void
-ephy_filesystem_autocompletion_autocompletion_source_init (EphyAutocompletionSourceIface *iface)
-{
- iface->foreach = ephy_filesystem_autocompletion_autocompletion_source_foreach;
- iface->set_basic_key = ephy_filesystem_autocompletion_autocompletion_source_set_basic_key;
-}
-
-static void
-ephy_filesystem_autocompletion_class_init (EphyFilesystemAutocompletionClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = ephy_filesystem_autocompletion_finalize_impl;
-
- g_object_class = g_type_class_peek_parent (klass);
-}
-
-static void
-ephy_filesystem_autocompletion_init (EphyFilesystemAutocompletion *e)
-{
- EphyFilesystemAutocompletionPrivate *p = g_new0 (EphyFilesystemAutocompletionPrivate, 1);
- e->priv = p;
-
- p->score = G_MAXINT / 2;
- p->base_dir = g_strdup ("");
-}
-
-static void
-ephy_filesystem_autocompletion_finalize_impl (GObject *o)
-{
- EphyFilesystemAutocompletion *as = GUL_FILESYSTEM_AUTOCOMPLETION (o);
- EphyFilesystemAutocompletionPrivate *p = as->priv;
-
- LOG ("Finalize")
-
- g_free (p->basic_key);
- g_free (p->basic_key_dir);
- g_free (p->current_dir);
- g_free (p->base_dir);
- if (p->base_dir_uri)
- {
- gnome_vfs_uri_unref (p->base_dir_uri);
- }
-
- g_free (p);
-
- G_OBJECT_CLASS (g_object_class)->finalize (o);
-}
-
-EphyFilesystemAutocompletion *
-ephy_filesystem_autocompletion_new (void)
-{
- EphyFilesystemAutocompletion *ret = g_object_new (GUL_TYPE_FILESYSTEM_AUTOCOMPLETION, NULL);
- return ret;
-}
-
-
-static gchar *
-gfa_get_nearest_dir (const gchar *path)
-{
- gchar *ret;
- const gchar *lastslash = rindex (path, '/');
-
- if (lastslash)
- {
- if (!strcmp (path, "file://"))
- {
- /* without this, gnome-vfs does not recognize it as a dir */
- ret = g_strdup ("file:///");
- }
- else
- {
- ret = g_strndup (path, lastslash - path + 1);
- }
- }
- else
- {
- ret = g_strdup ("");
- }
-
- return ret;
-}
-
-static void
-ephy_filesystem_autocompletion_autocompletion_source_foreach (EphyAutocompletionSource *source,
- const gchar *basic_key,
- EphyAutocompletionSourceForeachFunc func,
- gpointer data)
-{
- EphyFilesystemAutocompletion *fa = GUL_FILESYSTEM_AUTOCOMPLETION (source);
- EphyFilesystemAutocompletionPrivate *p = fa->priv;
- GSList *li;
-
- ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (source, basic_key);
-
- for (li = p->files; li; li = li->next)
- {
- func (source, li->data, li->data, li->data, FALSE, FALSE, p->score, data);
- }
-
-}
-
-static void
-ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (EphyFilesystemAutocompletion *fa)
-{
- g_signal_emit_by_name (fa, "data-changed");
-}
-
-static void
-gfa_load_directory_cb (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- GList *list,
- guint entries_read,
- gpointer callback_data)
-{
- EphyFilesystemAutocompletion *fa = callback_data;
- EphyFilesystemAutocompletionPrivate *p = fa->priv;
- GList *li;
- gchar *cd;
-
- g_return_if_fail (p->load_handle == handle);
-
- LOG ("entries_read == %d", entries_read)
-
- if (entries_read <= 0)
- {
- return;
- }
-
- if (p->basic_key_dir[strlen (p->basic_key_dir) - 1] == G_DIR_SEPARATOR
- || p->basic_key_dir[0] == '\0')
- {
- cd = g_strdup (p->basic_key_dir);
- }
- else
- {
- cd = g_strconcat (p->basic_key_dir, G_DIR_SEPARATOR_S, NULL);
- }
-
- for (li = list; li; li = li->next)
- {
- GnomeVFSFileInfo *i = li->data;
- if (!(i->name[0] == '.'
- && (i->name[1] == '\0'
- || (i->name[1] == '.'
- && i->name[2] == '\0'))))
- {
- gchar *f = g_strconcat (cd, i->name, NULL);
- p->files = g_slist_prepend (p->files, f);
-
- LOG ("+ %s", f)
- }
- }
-
- g_free (cd);
-
- ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (fa);
-}
-
-static void
-ephy_filesystem_autocompletion_set_current_dir (EphyFilesystemAutocompletion *fa, const gchar *d)
-{
- EphyFilesystemAutocompletionPrivate *p = fa->priv;
- GnomeVFSURI *cd_uri;
-
- if (p->base_dir_uri)
- {
- cd_uri = gnome_vfs_uri_append_path (p->base_dir_uri, d);
- }
- else
- {
- cd_uri = gnome_vfs_uri_new (d);
- }
-
- if (p->load_handle)
- {
- gnome_vfs_async_cancel (p->load_handle);
- p->load_handle = NULL;
- }
-
- if (p->files)
- {
- g_slist_foreach (p->files, (GFunc) g_free, NULL);
- g_slist_free (p->files);
- p->files = NULL;
-
- ephy_filesystem_autocompletion_emit_autocompletion_source_data_changed (fa);
- }
-
- if (!cd_uri)
- {
- LOG ("Can't load dir %s", d)
- return;
- }
-
- g_free (p->current_dir);
- p->current_dir = gnome_vfs_uri_to_string (cd_uri, GNOME_VFS_URI_HIDE_NONE);
-
- LOG ("Loading dir: %s", p->current_dir)
-
- gnome_vfs_async_load_directory_uri (&p->load_handle,
- cd_uri,
- GNOME_VFS_FILE_INFO_DEFAULT,
- 100,
- 0,
- gfa_load_directory_cb,
- fa);
-
- gnome_vfs_uri_unref (cd_uri);
-}
-
-void
-ephy_filesystem_autocompletion_autocompletion_source_set_basic_key (EphyAutocompletionSource *source,
- const gchar *basic_key)
-{
- EphyFilesystemAutocompletion *fa = GUL_FILESYSTEM_AUTOCOMPLETION (source);
- EphyFilesystemAutocompletionPrivate *p = fa->priv;
- gchar *new_basic_key_dir;
-
- if (p->basic_key && !strcmp (p->basic_key, basic_key))
- {
- return;
- }
-
- g_free (p->basic_key);
- p->basic_key = g_strdup (basic_key);
-
- new_basic_key_dir = gfa_get_nearest_dir (basic_key);
- if (p->basic_key_dir && !strcmp (p->basic_key_dir, new_basic_key_dir))
- {
- g_free (new_basic_key_dir);
- }
- else
- {
- g_free (p->basic_key_dir);
- p->basic_key_dir = new_basic_key_dir;
- ephy_filesystem_autocompletion_set_current_dir (fa, p->basic_key_dir);
- }
-}
-
-void
-ephy_filesystem_autocompletion_set_base_dir (EphyFilesystemAutocompletion *fa, const gchar *d)
-{
- EphyFilesystemAutocompletionPrivate *p = fa->priv;
-
- g_free (p->base_dir);
- p->base_dir = g_strdup (d);
-
- if (p->base_dir_uri)
- {
- gnome_vfs_uri_unref (p->base_dir_uri);
- }
-
- if (p->base_dir[0])
- {
- p->base_dir_uri = gnome_vfs_uri_new (p->base_dir);
- }
- else
- {
- p->base_dir_uri = NULL;
- }
-
- if (p->base_dir_uri)
- {
- gchar *t = gnome_vfs_uri_to_string (p->base_dir_uri, GNOME_VFS_URI_HIDE_NONE);
- LOG ("base_dir: %s", t)
- g_free (t);
- }
-}
-
diff --git a/lib/ephy-filesystem-autocompletion.h b/lib/ephy-filesystem-autocompletion.h
deleted file mode 100644
index ec047282f..000000000
--- a/lib/ephy-filesystem-autocompletion.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2002 Ricardo Fernández Pascual
- *
- * 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, 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.
- */
-
-#ifndef EPHY_FILESYSTEM_AUTOCOMPLETION_H
-#define EPHY_FILESYSTEM_AUTOCOMPLETION_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* object forward declarations */
-
-typedef struct _EphyFilesystemAutocompletion EphyFilesystemAutocompletion;
-typedef struct _EphyFilesystemAutocompletionClass EphyFilesystemAutocompletionClass;
-typedef struct _EphyFilesystemAutocompletionPrivate EphyFilesystemAutocompletionPrivate;
-
-/**
- * FilesystemAutocompletion object
- */
-
-#define GUL_TYPE_FILESYSTEM_AUTOCOMPLETION (ephy_filesystem_autocompletion_get_type())
-#define GUL_FILESYSTEM_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_CAST((object), \
- GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
- EphyFilesystemAutocompletion))
-#define GUL_FILESYSTEM_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
- GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
- EphyFilesystemAutocompletionClass))
-#define GUL_IS_FILESYSTEM_AUTOCOMPLETION(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), \
- GUL_TYPE_FILESYSTEM_AUTOCOMPLETION))
-#define GUL_IS_FILESYSTEM_AUTOCOMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
- GUL_TYPE_FILESYSTEM_AUTOCOMPLETION))
-#define GUL_FILESYSTEM_AUTOCOMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
- GUL_TYPE_FILESYSTEM_AUTOCOMPLETION,\
- EphyFilesystemAutocompletionClass))
-
-struct _EphyFilesystemAutocompletionClass
-{
- GObjectClass parent_class;
-
-};
-
-struct _EphyFilesystemAutocompletion
-{
- GObject parent_object;
- EphyFilesystemAutocompletionPrivate *priv;
-};
-
-GType ephy_filesystem_autocompletion_get_type (void);
-EphyFilesystemAutocompletion * ephy_filesystem_autocompletion_new (void);
-void ephy_filesystem_autocompletion_set_base_dir (EphyFilesystemAutocompletion *fa,
- const gchar *d);
-
-G_END_DECLS
-
-#endif