initial
This commit is contained in:
104
plugins/filebrowser/Makefile.am
Executable file
104
plugins/filebrowser/Makefile.am
Executable file
@@ -0,0 +1,104 @@
|
||||
# filebrowser
|
||||
|
||||
plugindir = $(GEDIT_PLUGINS_LIBS_DIR)
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GEDIT_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
gedit-file-browser-enum-types.h \
|
||||
gedit-file-browser-enum-types.c \
|
||||
gedit-file-browser-marshal.h \
|
||||
gedit-file-browser-marshal.c
|
||||
|
||||
plugin_LTLIBRARIES = libfilebrowser.la
|
||||
|
||||
NOINST_H_FILES = \
|
||||
gedit-file-bookmarks-store.h \
|
||||
gedit-file-browser-store.h \
|
||||
gedit-file-browser-view.h \
|
||||
gedit-file-browser-widget.h \
|
||||
gedit-file-browser-error.h \
|
||||
gedit-file-browser-utils.h \
|
||||
gedit-file-browser-plugin.h \
|
||||
gedit-file-browser-messages.h
|
||||
|
||||
libfilebrowser_la_SOURCES = \
|
||||
$(BUILT_SOURCES) \
|
||||
gedit-file-bookmarks-store.c \
|
||||
gedit-file-browser-store.c \
|
||||
gedit-file-browser-view.c \
|
||||
gedit-file-browser-widget.c \
|
||||
gedit-file-browser-utils.c \
|
||||
gedit-file-browser-plugin.c \
|
||||
gedit-file-browser-messages.c \
|
||||
$(NOINST_H_FILES)
|
||||
|
||||
libfilebrowser_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libfilebrowser_la_LIBADD = $(GEDIT_LIBS)
|
||||
|
||||
# UI files (if you use ui for your plugin, list those files here)
|
||||
uidir = $(GEDIT_PLUGINS_DATA_DIR)/filebrowser
|
||||
ui_DATA = gedit-file-browser-widget-ui.xml
|
||||
|
||||
plugin_in_files = filebrowser.gedit-plugin.desktop.in
|
||||
|
||||
%.gedit-plugin: %.gedit-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
gedit-file-browser-enum-types.h: gedit-file-browser-enum-types.h.template $(NOINST_H_FILES) $(GLIB_MKENUMS)
|
||||
(cd $(srcdir) && $(GLIB_MKENUMS) --template gedit-file-browser-enum-types.h.template $(NOINST_H_FILES)) > $@
|
||||
|
||||
gedit-file-browser-enum-types.c: gedit-file-browser-enum-types.c.template gedit-file-browser-enum-register.c.template $(NOINST_H_FILES) $(GLIB_MKENUMS)
|
||||
$(AM_V_GEN) (cd $(srcdir) && \
|
||||
$(GLIB_MKENUMS) --template gedit-file-browser-enum-types.c.template $(NOINST_H_FILES) && \
|
||||
$(GLIB_MKENUMS) --template gedit-file-browser-enum-register.c.template $(NOINST_H_FILES)) > $@
|
||||
|
||||
gedit-file-browser-marshal.h: gedit-file-browser-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=gedit_file_browser_marshal > $@
|
||||
|
||||
gedit-file-browser-marshal.c: gedit-file-browser-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) echo "#include \"gedit-file-browser-marshal.h\"" > $@ && \
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=gedit_file_browser_marshal >> $@
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.gedit-plugin.desktop.in=.gedit-plugin)
|
||||
|
||||
schemasdir = $(MATECONF_SCHEMA_FILE_DIR)
|
||||
schemas_in_files = gedit-file-browser.schemas.in
|
||||
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
|
||||
@INTLTOOL_SCHEMAS_RULE@
|
||||
|
||||
if MATECONF_SCHEMAS_INSTALL
|
||||
install-data-local:
|
||||
if test -z "$(DESTDIR)" ; then \
|
||||
for p in $(schemas_DATA) ; do \
|
||||
MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/plugins/filebrowser/$$p ; \
|
||||
done \
|
||||
fi
|
||||
else
|
||||
install-data-local:
|
||||
endif
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(ui_DATA) \
|
||||
$(plugin_in_files) \
|
||||
$(schemas_in_files) \
|
||||
gedit-file-browser-enum-types.h.template \
|
||||
gedit-file-browser-enum-types.c.template \
|
||||
gedit-file-browser-enum-register.c.template \
|
||||
gedit-file-browser-marshal.list
|
||||
|
||||
CLEANFILES = \
|
||||
$(plugin_DATA) \
|
||||
$(schemas_DATA) \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
DISTCLEANFILES = \
|
||||
$(plugin_DATA) \
|
||||
$(schemas_DATA) \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
10
plugins/filebrowser/filebrowser.gedit-plugin.desktop.in
Executable file
10
plugins/filebrowser/filebrowser.gedit-plugin.desktop.in
Executable file
@@ -0,0 +1,10 @@
|
||||
[Gedit Plugin]
|
||||
Loader=C
|
||||
Module=filebrowser
|
||||
IAge=2
|
||||
_Name=File Browser Pane
|
||||
_Description=Easy file access from the side pane
|
||||
Icon=system-file-manager
|
||||
Authors=Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
Copyright=Copyright © 2006 Jesse van den Kieboom
|
||||
Website=http://www.gedit.org
|
879
plugins/filebrowser/gedit-file-bookmarks-store.c
Executable file
879
plugins/filebrowser/gedit-file-bookmarks-store.c
Executable file
@@ -0,0 +1,879 @@
|
||||
/*
|
||||
* gedit-file-bookmarks-store.c - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gedit/gedit-utils.h>
|
||||
#include <gedit/gedit-plugin.h>
|
||||
|
||||
#include "gedit-file-bookmarks-store.h"
|
||||
#include "gedit-file-browser-utils.h"
|
||||
|
||||
#define GEDIT_FILE_BOOKMARKS_STORE_GET_PRIVATE(object)( \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_FILE_BOOKMARKS_STORE, \
|
||||
GeditFileBookmarksStorePrivate))
|
||||
|
||||
struct _GeditFileBookmarksStorePrivate
|
||||
{
|
||||
GVolumeMonitor * volume_monitor;
|
||||
GFileMonitor * bookmarks_monitor;
|
||||
};
|
||||
|
||||
static void remove_node (GtkTreeModel * model,
|
||||
GtkTreeIter * iter);
|
||||
|
||||
static void on_fs_changed (GVolumeMonitor *monitor,
|
||||
GObject *object,
|
||||
GeditFileBookmarksStore *model);
|
||||
|
||||
static void on_bookmarks_file_changed (GFileMonitor * monitor,
|
||||
GFile * file,
|
||||
GFile * other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
GeditFileBookmarksStore * model);
|
||||
static gboolean find_with_flags (GtkTreeModel * model,
|
||||
GtkTreeIter * iter,
|
||||
gpointer obj,
|
||||
guint flags,
|
||||
guint notflags);
|
||||
|
||||
GEDIT_PLUGIN_DEFINE_TYPE(GeditFileBookmarksStore, gedit_file_bookmarks_store, GTK_TYPE_TREE_STORE)
|
||||
|
||||
static void
|
||||
gedit_file_bookmarks_store_dispose (GObject * object)
|
||||
{
|
||||
GeditFileBookmarksStore *obj = GEDIT_FILE_BOOKMARKS_STORE (object);
|
||||
|
||||
if (obj->priv->volume_monitor != NULL) {
|
||||
g_signal_handlers_disconnect_by_func (obj->priv->volume_monitor,
|
||||
on_fs_changed,
|
||||
obj);
|
||||
|
||||
g_object_unref (obj->priv->volume_monitor);
|
||||
obj->priv->volume_monitor = NULL;
|
||||
}
|
||||
|
||||
if (obj->priv->bookmarks_monitor != NULL) {
|
||||
g_object_unref (obj->priv->bookmarks_monitor);
|
||||
obj->priv->bookmarks_monitor = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gedit_file_bookmarks_store_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gedit_file_bookmarks_store_finalize (GObject * object)
|
||||
{
|
||||
G_OBJECT_CLASS (gedit_file_bookmarks_store_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gedit_file_bookmarks_store_class_init (GeditFileBookmarksStoreClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gedit_file_bookmarks_store_dispose;
|
||||
object_class->finalize = gedit_file_bookmarks_store_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GeditFileBookmarksStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gedit_file_bookmarks_store_init (GeditFileBookmarksStore * obj)
|
||||
{
|
||||
obj->priv = GEDIT_FILE_BOOKMARKS_STORE_GET_PRIVATE (obj);
|
||||
}
|
||||
|
||||
/* Private */
|
||||
static void
|
||||
add_node (GeditFileBookmarksStore *model,
|
||||
GdkPixbuf *pixbuf,
|
||||
const gchar *name,
|
||||
GObject *obj,
|
||||
guint flags,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeIter newiter;
|
||||
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &newiter, NULL);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &newiter,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_ICON, pixbuf,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME, name,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, obj,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, flags,
|
||||
-1);
|
||||
|
||||
if (iter != NULL)
|
||||
*iter = newiter;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_file (GeditFileBookmarksStore *model,
|
||||
GFile *file,
|
||||
const gchar *name,
|
||||
guint flags,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
gboolean native;
|
||||
gchar *newname;
|
||||
|
||||
native = g_file_is_native (file);
|
||||
|
||||
if (native && !g_file_query_exists (file, NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_HOME)
|
||||
pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-home", GTK_ICON_SIZE_MENU);
|
||||
else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP)
|
||||
pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("user-desktop", GTK_ICON_SIZE_MENU);
|
||||
else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT)
|
||||
pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("drive-harddisk", GTK_ICON_SIZE_MENU);
|
||||
|
||||
if (pixbuf == NULL) {
|
||||
/* getting the icon is a sync get_info call, so we just do it for local files */
|
||||
if (native) {
|
||||
pixbuf = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
|
||||
} else {
|
||||
pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("folder", GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
newname = gedit_file_browser_utils_file_basename (file);
|
||||
} else {
|
||||
newname = g_strdup (name);
|
||||
}
|
||||
|
||||
add_node (model, pixbuf, newname, G_OBJECT (file), flags, iter);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
g_free (newname);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
check_mount_separator (GeditFileBookmarksStore * model, guint flags,
|
||||
gboolean added)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean found;
|
||||
|
||||
found =
|
||||
find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
|
||||
flags |
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR, 0);
|
||||
|
||||
if (added && !found) {
|
||||
/* Add the separator */
|
||||
add_node (model, NULL, NULL, NULL,
|
||||
flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
|
||||
NULL);
|
||||
} else if (!added && found) {
|
||||
remove_node (GTK_TREE_MODEL (model), &iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_special_directories (GeditFileBookmarksStore * model)
|
||||
{
|
||||
gchar const *path;
|
||||
GFile * file;
|
||||
|
||||
path = g_get_home_dir ();
|
||||
if (path != NULL)
|
||||
{
|
||||
file = g_file_new_for_path (path);
|
||||
add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_HOME |
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
|
||||
if (path != NULL)
|
||||
{
|
||||
file = g_file_new_for_path (path);
|
||||
add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP |
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
path = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
|
||||
if (path != NULL)
|
||||
{
|
||||
file = g_file_new_for_path (path);
|
||||
add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS |
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
file = g_file_new_for_uri ("file:///");
|
||||
add_file (model, file, _("File System"), GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
check_mount_separator (model, GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
get_fs_properties (gpointer fs,
|
||||
gchar **name,
|
||||
GdkPixbuf **pixbuf,
|
||||
guint *flags)
|
||||
{
|
||||
GIcon *icon = NULL;
|
||||
|
||||
*flags = GEDIT_FILE_BOOKMARKS_STORE_IS_FS;
|
||||
*name = NULL;
|
||||
*pixbuf = NULL;
|
||||
|
||||
if (G_IS_DRIVE (fs))
|
||||
{
|
||||
icon = g_drive_get_icon (G_DRIVE (fs));
|
||||
*name = g_drive_get_name (G_DRIVE (fs));
|
||||
|
||||
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE;
|
||||
}
|
||||
else if (G_IS_VOLUME (fs))
|
||||
{
|
||||
icon = g_volume_get_icon (G_VOLUME (fs));
|
||||
*name = g_volume_get_name (G_VOLUME (fs));
|
||||
|
||||
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME;
|
||||
}
|
||||
else if (G_IS_MOUNT (fs))
|
||||
{
|
||||
icon = g_mount_get_icon (G_MOUNT (fs));
|
||||
*name = g_mount_get_name (G_MOUNT (fs));
|
||||
|
||||
*flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT;
|
||||
}
|
||||
|
||||
if (icon)
|
||||
{
|
||||
*pixbuf = gedit_file_browser_utils_pixbuf_from_icon (icon, GTK_ICON_SIZE_MENU);
|
||||
g_object_unref (icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_fs (GeditFileBookmarksStore *model,
|
||||
gpointer fs,
|
||||
guint flags,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
gchar *name;
|
||||
GdkPixbuf *pixbuf;
|
||||
guint fsflags;
|
||||
|
||||
get_fs_properties (fs, &name, &pixbuf, &fsflags);
|
||||
add_node (model, pixbuf, name, fs, flags | fsflags, iter);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
g_free (name);
|
||||
check_mount_separator (model, GEDIT_FILE_BOOKMARKS_STORE_IS_FS, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
process_volume_cb (GVolume *volume,
|
||||
GeditFileBookmarksStore *model)
|
||||
{
|
||||
GMount *mount;
|
||||
guint flags = GEDIT_FILE_BOOKMARKS_STORE_NONE;
|
||||
mount = g_volume_get_mount (volume);
|
||||
|
||||
/* CHECK: should we use the LOCAL/REMOTE thing still? */
|
||||
if (mount)
|
||||
{
|
||||
/* Show mounted volume */
|
||||
add_fs (model, mount, flags, NULL);
|
||||
g_object_unref (mount);
|
||||
}
|
||||
else if (g_volume_can_mount (volume))
|
||||
{
|
||||
/* We also show the unmounted volume here so users can
|
||||
mount it if they want to access it */
|
||||
add_fs (model, volume, flags, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
process_drive_novolumes (GeditFileBookmarksStore *model,
|
||||
GDrive *drive)
|
||||
{
|
||||
if (g_drive_is_media_removable (drive) &&
|
||||
!g_drive_is_media_check_automatic (drive) &&
|
||||
g_drive_can_poll_for_media (drive))
|
||||
{
|
||||
/* This can be the case for floppy drives or other
|
||||
drives where media detection fails. We show the
|
||||
drive and poll for media when the user activates
|
||||
it */
|
||||
add_fs (model, drive, GEDIT_FILE_BOOKMARKS_STORE_NONE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
process_drive_cb (GDrive *drive,
|
||||
GeditFileBookmarksStore *model)
|
||||
{
|
||||
GList *volumes;
|
||||
|
||||
volumes = g_drive_get_volumes (drive);
|
||||
|
||||
if (volumes)
|
||||
{
|
||||
/* Add all volumes for the drive */
|
||||
g_list_foreach (volumes, (GFunc)process_volume_cb, model);
|
||||
g_list_free (volumes);
|
||||
}
|
||||
else
|
||||
{
|
||||
process_drive_novolumes (model, drive);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_drives (GeditFileBookmarksStore *model)
|
||||
{
|
||||
GList *drives;
|
||||
|
||||
drives = g_volume_monitor_get_connected_drives (model->priv->volume_monitor);
|
||||
|
||||
g_list_foreach (drives, (GFunc)process_drive_cb, model);
|
||||
g_list_foreach (drives, (GFunc)g_object_unref, NULL);
|
||||
g_list_free (drives);
|
||||
}
|
||||
|
||||
static void
|
||||
process_volume_nodrive_cb (GVolume *volume,
|
||||
GeditFileBookmarksStore *model)
|
||||
{
|
||||
GDrive *drive;
|
||||
|
||||
drive = g_volume_get_drive (volume);
|
||||
|
||||
if (drive)
|
||||
{
|
||||
g_object_unref (drive);
|
||||
return;
|
||||
}
|
||||
|
||||
process_volume_cb (volume, model);
|
||||
}
|
||||
|
||||
static void
|
||||
init_volumes (GeditFileBookmarksStore *model)
|
||||
{
|
||||
GList *volumes;
|
||||
|
||||
volumes = g_volume_monitor_get_volumes (model->priv->volume_monitor);
|
||||
|
||||
g_list_foreach (volumes, (GFunc)process_volume_nodrive_cb, model);
|
||||
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
|
||||
g_list_free (volumes);
|
||||
}
|
||||
|
||||
static void
|
||||
process_mount_novolume_cb (GMount *mount,
|
||||
GeditFileBookmarksStore *model)
|
||||
{
|
||||
GVolume *volume;
|
||||
|
||||
volume = g_mount_get_volume (mount);
|
||||
|
||||
if (volume)
|
||||
{
|
||||
g_object_unref (volume);
|
||||
}
|
||||
else if (!g_mount_is_shadowed (mount))
|
||||
{
|
||||
/* Add the mount */
|
||||
add_fs (model, mount, GEDIT_FILE_BOOKMARKS_STORE_NONE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_mounts (GeditFileBookmarksStore *model)
|
||||
{
|
||||
GList *mounts;
|
||||
|
||||
mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor);
|
||||
|
||||
g_list_foreach (mounts, (GFunc)process_mount_novolume_cb, model);
|
||||
g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
|
||||
g_list_free (mounts);
|
||||
}
|
||||
|
||||
static void
|
||||
init_fs (GeditFileBookmarksStore * model)
|
||||
{
|
||||
if (model->priv->volume_monitor == NULL) {
|
||||
const gchar **ptr;
|
||||
const gchar *signals[] = {
|
||||
"drive-connected", "drive-changed", "drive-disconnected",
|
||||
"volume-added", "volume-removed", "volume-changed",
|
||||
"mount-added", "mount-removed", "mount-changed",
|
||||
NULL
|
||||
};
|
||||
|
||||
model->priv->volume_monitor = g_volume_monitor_get ();
|
||||
|
||||
/* Connect signals */
|
||||
for (ptr = signals; *ptr; ptr++)
|
||||
{
|
||||
g_signal_connect (model->priv->volume_monitor,
|
||||
*ptr,
|
||||
G_CALLBACK (on_fs_changed), model);
|
||||
}
|
||||
}
|
||||
|
||||
/* First go through all the connected drives */
|
||||
init_drives (model);
|
||||
|
||||
/* Then add all volumes, not associated with a drive */
|
||||
init_volumes (model);
|
||||
|
||||
/* Then finally add all mounts that have no volume */
|
||||
init_mounts (model);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_bookmark (GeditFileBookmarksStore * model,
|
||||
gchar const * name,
|
||||
gchar const * uri)
|
||||
{
|
||||
GFile * file;
|
||||
gboolean ret;
|
||||
guint flags = GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK;
|
||||
GtkTreeIter iter;
|
||||
|
||||
file = g_file_new_for_uri (uri);
|
||||
|
||||
if (g_file_is_native (file)) {
|
||||
flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK;
|
||||
} else {
|
||||
flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK;
|
||||
}
|
||||
|
||||
ret = add_file (model, file, name, flags, &iter);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
init_bookmarks (GeditFileBookmarksStore * model)
|
||||
{
|
||||
gchar *bookmarks;
|
||||
GError *error = NULL;
|
||||
gchar *contents;
|
||||
gchar **lines;
|
||||
gchar **line;
|
||||
gboolean added = FALSE;
|
||||
|
||||
/* Read the bookmarks file */
|
||||
bookmarks = g_build_filename (g_get_home_dir (),
|
||||
".gtk-bookmarks",
|
||||
NULL);
|
||||
|
||||
if (g_file_get_contents (bookmarks, &contents, NULL, &error)) {
|
||||
lines = g_strsplit (contents, "\n", 0);
|
||||
|
||||
for (line = lines; *line; ++line) {
|
||||
if (**line) {
|
||||
gchar *pos;
|
||||
gchar *name;
|
||||
|
||||
/* CHECK: is this really utf8? */
|
||||
pos = g_utf8_strchr (*line, -1, ' ');
|
||||
|
||||
if (pos != NULL) {
|
||||
*pos = '\0';
|
||||
name = pos + 1;
|
||||
} else {
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
/* the bookmarks file should contain valid
|
||||
* URIs, but paranoia is good */
|
||||
if (gedit_utils_is_valid_uri (*line)) {
|
||||
added |= add_bookmark (model, name, *line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (lines);
|
||||
g_free (contents);
|
||||
|
||||
/* Add a watch */
|
||||
if (model->priv->bookmarks_monitor == NULL) {
|
||||
GFile * file;
|
||||
|
||||
file = g_file_new_for_path (bookmarks);
|
||||
model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
g_signal_connect (model->priv->bookmarks_monitor,
|
||||
"changed",
|
||||
(GCallback)on_bookmarks_file_changed,
|
||||
model);
|
||||
}
|
||||
} else {
|
||||
/* The bookmarks file doesn't exist (which is perfectly fine) */
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (added) {
|
||||
/* Bookmarks separator */
|
||||
add_node (model, NULL, NULL, NULL,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK |
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR, NULL);
|
||||
}
|
||||
|
||||
g_free (bookmarks);
|
||||
}
|
||||
|
||||
static gint flags_order[] = {
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_HOME,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_FS,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
|
||||
-1
|
||||
};
|
||||
|
||||
static gint
|
||||
utf8_casecmp (gchar const *s1, const gchar * s2)
|
||||
{
|
||||
gchar *n1;
|
||||
gchar *n2;
|
||||
gint result;
|
||||
|
||||
n1 = g_utf8_casefold (s1, -1);
|
||||
n2 = g_utf8_casefold (s2, -1);
|
||||
|
||||
result = g_utf8_collate (n1, n2);
|
||||
|
||||
g_free (n1);
|
||||
g_free (n2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_names (GtkTreeModel * model, GtkTreeIter * a,
|
||||
GtkTreeIter * b)
|
||||
{
|
||||
gchar *n1;
|
||||
gchar *n2;
|
||||
gint result;
|
||||
guint f1;
|
||||
guint f2;
|
||||
|
||||
gtk_tree_model_get (model, a,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME, &n1,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f1,
|
||||
-1);
|
||||
gtk_tree_model_get (model, b,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME, &n2,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f2,
|
||||
-1);
|
||||
|
||||
/* do not sort actual bookmarks to keep same order as in caja */
|
||||
if ((f1 & GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK) &&
|
||||
(f2 & GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK))
|
||||
result = 0;
|
||||
else if (n1 == NULL && n2 == NULL)
|
||||
result = 0;
|
||||
else if (n1 == NULL)
|
||||
result = -1;
|
||||
else if (n2 == NULL)
|
||||
result = 1;
|
||||
else
|
||||
result = utf8_casecmp (n1, n2);
|
||||
|
||||
g_free (n1);
|
||||
g_free (n2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_flags (GtkTreeModel * model, GtkTreeIter * a,
|
||||
GtkTreeIter * b)
|
||||
{
|
||||
guint f1;
|
||||
guint f2;
|
||||
gint *flags;
|
||||
guint sep;
|
||||
|
||||
sep = GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR;
|
||||
|
||||
gtk_tree_model_get (model, a,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f1,
|
||||
-1);
|
||||
gtk_tree_model_get (model, b,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f2,
|
||||
-1);
|
||||
|
||||
for (flags = flags_order; *flags != -1; ++flags) {
|
||||
if ((f1 & *flags) != (f2 & *flags)) {
|
||||
if (f1 & *flags) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if ((f1 & *flags) && (f1 & sep) != (f2 & sep)) {
|
||||
if (f1 & sep)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_func (GtkTreeModel * model, GtkTreeIter * a,
|
||||
GtkTreeIter * b, gpointer user_data)
|
||||
{
|
||||
gint result;
|
||||
|
||||
result = bookmarks_compare_flags (model, a, b);
|
||||
|
||||
if (result == 0)
|
||||
result = bookmarks_compare_names (model, a, b);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj,
|
||||
guint flags, guint notflags)
|
||||
{
|
||||
GtkTreeIter child;
|
||||
guint childflags = 0;
|
||||
GObject * childobj;
|
||||
gboolean fequal;
|
||||
|
||||
if (!gtk_tree_model_get_iter_first (model, &child))
|
||||
return FALSE;
|
||||
|
||||
do {
|
||||
gtk_tree_model_get (model, &child,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
|
||||
&childobj,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
|
||||
&childflags, -1);
|
||||
|
||||
fequal = (obj == childobj);
|
||||
|
||||
if (childobj)
|
||||
g_object_unref (childobj);
|
||||
|
||||
if ((obj == NULL || fequal) &&
|
||||
(childflags & flags) == flags
|
||||
&& !(childflags & notflags)) {
|
||||
*iter = child;
|
||||
return TRUE;
|
||||
}
|
||||
} while (gtk_tree_model_iter_next (model, &child));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_node (GtkTreeModel * model, GtkTreeIter * iter)
|
||||
{
|
||||
guint flags;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
|
||||
if (!(flags & GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR)) {
|
||||
if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_FS) {
|
||||
check_mount_separator (GEDIT_FILE_BOOKMARKS_STORE (model),
|
||||
flags & GEDIT_FILE_BOOKMARKS_STORE_IS_FS,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_bookmarks (GeditFileBookmarksStore * model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
while (find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
|
||||
0)) {
|
||||
remove_node (GTK_TREE_MODEL (model), &iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
initialize_fill (GeditFileBookmarksStore * model)
|
||||
{
|
||||
init_special_directories (model);
|
||||
init_fs (model);
|
||||
init_bookmarks (model);
|
||||
}
|
||||
|
||||
/* Public */
|
||||
GeditFileBookmarksStore *
|
||||
gedit_file_bookmarks_store_new (void)
|
||||
{
|
||||
GeditFileBookmarksStore *model;
|
||||
GType column_types[] = {
|
||||
GDK_TYPE_PIXBUF,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_OBJECT,
|
||||
G_TYPE_UINT
|
||||
};
|
||||
|
||||
model = g_object_new (GEDIT_TYPE_FILE_BOOKMARKS_STORE, NULL);
|
||||
gtk_tree_store_set_column_types (GTK_TREE_STORE (model),
|
||||
GEDIT_FILE_BOOKMARKS_STORE_N_COLUMNS,
|
||||
column_types);
|
||||
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (model),
|
||||
bookmarks_compare_func,
|
||||
NULL, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_ASCENDING);
|
||||
|
||||
initialize_fill (model);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gedit_file_bookmarks_store_get_uri (GeditFileBookmarksStore * model,
|
||||
GtkTreeIter * iter)
|
||||
{
|
||||
GObject * obj;
|
||||
GFile * file = NULL;
|
||||
guint flags;
|
||||
gchar * ret = NULL;
|
||||
gboolean isfs;
|
||||
|
||||
g_return_val_if_fail (GEDIT_IS_FILE_BOOKMARKS_STORE (model), NULL);
|
||||
g_return_val_if_fail (iter != NULL, NULL);
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
|
||||
&flags,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
|
||||
&obj,
|
||||
-1);
|
||||
|
||||
if (obj == NULL)
|
||||
return NULL;
|
||||
|
||||
isfs = (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_FS);
|
||||
|
||||
if (isfs && (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT))
|
||||
{
|
||||
file = g_mount_get_root (G_MOUNT (obj));
|
||||
}
|
||||
else if (!isfs)
|
||||
{
|
||||
file = g_object_ref (obj);
|
||||
}
|
||||
|
||||
g_object_unref (obj);
|
||||
|
||||
if (file)
|
||||
{
|
||||
ret = g_file_get_uri (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
gedit_file_bookmarks_store_refresh (GeditFileBookmarksStore * model)
|
||||
{
|
||||
gtk_tree_store_clear (GTK_TREE_STORE (model));
|
||||
initialize_fill (model);
|
||||
}
|
||||
|
||||
static void
|
||||
on_fs_changed (GVolumeMonitor *monitor,
|
||||
GObject *object,
|
||||
GeditFileBookmarksStore *model)
|
||||
{
|
||||
GtkTreeModel *tree_model = GTK_TREE_MODEL (model);
|
||||
guint flags = GEDIT_FILE_BOOKMARKS_STORE_IS_FS;
|
||||
guint noflags = GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR;
|
||||
GtkTreeIter iter;
|
||||
|
||||
/* clear all fs items */
|
||||
while (find_with_flags (tree_model, &iter, NULL, flags, noflags))
|
||||
remove_node (tree_model, &iter);
|
||||
|
||||
/* then reinitialize */
|
||||
init_fs (model);
|
||||
}
|
||||
|
||||
static void
|
||||
on_bookmarks_file_changed (GFileMonitor * monitor,
|
||||
GFile * file,
|
||||
GFile * other_file,
|
||||
GFileMonitorEvent event_type,
|
||||
GeditFileBookmarksStore * model)
|
||||
{
|
||||
switch (event_type) {
|
||||
case G_FILE_MONITOR_EVENT_CHANGED:
|
||||
case G_FILE_MONITOR_EVENT_CREATED:
|
||||
/* Re-initialize bookmarks */
|
||||
remove_bookmarks (model);
|
||||
init_bookmarks (model);
|
||||
break;
|
||||
case G_FILE_MONITOR_EVENT_DELETED: // FIXME: shouldn't we also monitor the directory?
|
||||
/* Remove bookmarks */
|
||||
remove_bookmarks (model);
|
||||
g_object_unref (monitor);
|
||||
model->priv->bookmarks_monitor = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ex:ts=8:noet:
|
90
plugins/filebrowser/gedit-file-bookmarks-store.h
Executable file
90
plugins/filebrowser/gedit-file-bookmarks-store.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* gedit-file-bookmarks-store.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BOOKMARKS_STORE_H__
|
||||
#define __GEDIT_FILE_BOOKMARKS_STORE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GEDIT_TYPE_FILE_BOOKMARKS_STORE (gedit_file_bookmarks_store_get_type ())
|
||||
#define GEDIT_FILE_BOOKMARKS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BOOKMARKS_STORE, GeditFileBookmarksStore))
|
||||
#define GEDIT_FILE_BOOKMARKS_STORE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BOOKMARKS_STORE, GeditFileBookmarksStore const))
|
||||
#define GEDIT_FILE_BOOKMARKS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BOOKMARKS_STORE, GeditFileBookmarksStoreClass))
|
||||
#define GEDIT_IS_FILE_BOOKMARKS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BOOKMARKS_STORE))
|
||||
#define GEDIT_IS_FILE_BOOKMARKS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BOOKMARKS_STORE))
|
||||
#define GEDIT_FILE_BOOKMARKS_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BOOKMARKS_STORE, GeditFileBookmarksStoreClass))
|
||||
|
||||
typedef struct _GeditFileBookmarksStore GeditFileBookmarksStore;
|
||||
typedef struct _GeditFileBookmarksStoreClass GeditFileBookmarksStoreClass;
|
||||
typedef struct _GeditFileBookmarksStorePrivate GeditFileBookmarksStorePrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_ICON = 0,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_N_COLUMNS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GEDIT_FILE_BOOKMARKS_STORE_NONE = 0,
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR = 1 << 0, /* Separator item */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR = 1 << 1, /* Special user dir */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_HOME = 1 << 2, /* The special Home user directory */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP = 1 << 3, /* The special Desktop user directory */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS = 1 << 4, /* The special Documents user directory */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_FS = 1 << 5, /* A mount object */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT = 1 << 6, /* A mount object */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME = 1 << 7, /* A volume object */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE = 1 << 8, /* A drive object */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT = 1 << 9, /* The root file system (file:///) */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK = 1 << 10, /* A gtk bookmark */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK = 1 << 11, /* A remote gtk bookmark */
|
||||
GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK = 1 << 12 /* A local gtk bookmark */
|
||||
};
|
||||
|
||||
struct _GeditFileBookmarksStore
|
||||
{
|
||||
GtkTreeStore parent;
|
||||
|
||||
GeditFileBookmarksStorePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GeditFileBookmarksStoreClass
|
||||
{
|
||||
GtkTreeStoreClass parent_class;
|
||||
};
|
||||
|
||||
GType gedit_file_bookmarks_store_get_type (void) G_GNUC_CONST;
|
||||
GType gedit_file_bookmarks_store_register_type (GTypeModule * module);
|
||||
|
||||
GeditFileBookmarksStore *gedit_file_bookmarks_store_new (void);
|
||||
gchar *gedit_file_bookmarks_store_get_uri (GeditFileBookmarksStore * model,
|
||||
GtkTreeIter * iter);
|
||||
void gedit_file_bookmarks_store_refresh (GeditFileBookmarksStore * model);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GEDIT_FILE_BOOKMARKS_STORE_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
20
plugins/filebrowser/gedit-file-browser-enum-register.c.template
Executable file
20
plugins/filebrowser/gedit-file-browser-enum-register.c.template
Executable file
@@ -0,0 +1,20 @@
|
||||
/*** BEGIN file-header ***/
|
||||
void
|
||||
gedit_file_browser_enum_and_flag_register_type (GTypeModule * module)
|
||||
{
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* Enumerations from "@filename@" */
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN enumeration-production ***/
|
||||
register_@enum_name@ (module);
|
||||
|
||||
/*** END enumeration-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
}
|
||||
|
||||
/*** END file-tail ***/
|
45
plugins/filebrowser/gedit-file-browser-enum-types.c.template
Executable file
45
plugins/filebrowser/gedit-file-browser-enum-types.c.template
Executable file
@@ -0,0 +1,45 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "gedit-file-browser-enum-types.h"
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
#include "@filename@"
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
static GType @enum_name@_type = 0;
|
||||
|
||||
static GType
|
||||
register_@enum_name@ (GTypeModule *module)
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@,
|
||||
"@VALUENAME@",
|
||||
"@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@enum_name@_type =
|
||||
g_type_module_register_@type@ (module,
|
||||
"@EnumName@",
|
||||
values);
|
||||
|
||||
return @enum_name@_type;
|
||||
}
|
||||
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
return @enum_name@_type;
|
||||
}
|
||||
|
||||
/*** END value-tail ***/
|
29
plugins/filebrowser/gedit-file-browser-enum-types.h.template
Executable file
29
plugins/filebrowser/gedit-file-browser-enum-types.h.template
Executable file
@@ -0,0 +1,29 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#ifndef __GEDIT_FILE_BROWSER_ENUM_TYPES_H__
|
||||
#define __GEDIT_FILE_BROWSER_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* Enumerations from "@filename@" */
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN enumeration-production ***/
|
||||
#define GEDIT_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/*** END enumeration-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
void gedit_file_browser_enum_and_flag_register_type (GTypeModule * module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GEDIT_FILE_BROWSER_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
||||
|
41
plugins/filebrowser/gedit-file-browser-error.h
Executable file
41
plugins/filebrowser/gedit-file-browser-error.h
Executable file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* gedit-file-browser-error.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_ERROR_H__
|
||||
#define __GEDIT_FILE_BROWSER_ERROR_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GEDIT_FILE_BROWSER_ERROR_NONE,
|
||||
GEDIT_FILE_BROWSER_ERROR_RENAME,
|
||||
GEDIT_FILE_BROWSER_ERROR_DELETE,
|
||||
GEDIT_FILE_BROWSER_ERROR_NEW_FILE,
|
||||
GEDIT_FILE_BROWSER_ERROR_NEW_DIRECTORY,
|
||||
GEDIT_FILE_BROWSER_ERROR_OPEN_DIRECTORY,
|
||||
GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
|
||||
GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY,
|
||||
GEDIT_FILE_BROWSER_ERROR_NUM
|
||||
} GeditFileBrowserError;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GEDIT_FILE_BROWSER_ERROR_H__ */
|
5
plugins/filebrowser/gedit-file-browser-marshal.list
Executable file
5
plugins/filebrowser/gedit-file-browser-marshal.list
Executable file
@@ -0,0 +1,5 @@
|
||||
VOID:UINT,STRING
|
||||
VOID:STRING,STRING
|
||||
BOOL:OBJECT,POINTER
|
||||
BOOL:POINTER
|
||||
BOOL:VOID
|
1033
plugins/filebrowser/gedit-file-browser-messages.c
Executable file
1033
plugins/filebrowser/gedit-file-browser-messages.c
Executable file
File diff suppressed because it is too large
Load Diff
35
plugins/filebrowser/gedit-file-browser-messages.h
Executable file
35
plugins/filebrowser/gedit-file-browser-messages.h
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* gedit-file-browser-messages.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2008 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_MESSAGES_H__
|
||||
#define __GEDIT_FILE_BROWSER_MESSAGES_H__
|
||||
|
||||
#include <gedit/gedit-window.h>
|
||||
#include <gedit/gedit-message-bus.h>
|
||||
#include "gedit-file-browser-widget.h"
|
||||
|
||||
void gedit_file_browser_messages_register (GeditWindow *window,
|
||||
GeditFileBrowserWidget *widget);
|
||||
void gedit_file_browser_messages_unregister (GeditWindow *window);
|
||||
|
||||
#endif /* __GEDIT_FILE_BROWSER_MESSAGES_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
1254
plugins/filebrowser/gedit-file-browser-plugin.c
Executable file
1254
plugins/filebrowser/gedit-file-browser-plugin.c
Executable file
File diff suppressed because it is too large
Load Diff
71
plugins/filebrowser/gedit-file-browser-plugin.h
Executable file
71
plugins/filebrowser/gedit-file-browser-plugin.h
Executable file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* gedit-file-browser-plugin.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_PLUGIN_H__
|
||||
#define __GEDIT_FILE_BROWSER_PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gedit/gedit-plugin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define GEDIT_TYPE_FILE_BROWSER_PLUGIN (filetree_plugin_get_type ())
|
||||
#define GEDIT_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPlugin))
|
||||
#define GEDIT_FILE_BROWSER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPluginClass))
|
||||
#define GEDIT_IS_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_FILE_BROWSER_PLUGIN))
|
||||
#define GEDIT_IS_FILE_BROWSER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_FILE_BROWSER_PLUGIN))
|
||||
#define GEDIT_FILE_BROWSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _GeditFileBrowserPluginPrivate GeditFileBrowserPluginPrivate;
|
||||
typedef struct _GeditFileBrowserPlugin GeditFileBrowserPlugin;
|
||||
typedef struct _GeditFileBrowserPluginClass GeditFileBrowserPluginClass;
|
||||
|
||||
struct _GeditFileBrowserPlugin
|
||||
{
|
||||
GeditPlugin parent_instance;
|
||||
|
||||
/*< private > */
|
||||
GeditFileBrowserPluginPrivate *priv;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct _GeditFileBrowserPluginClass
|
||||
{
|
||||
GeditPluginClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType filetree_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_gedit_plugin (GTypeModule * module);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GEDIT_FILE_BROWSER_PLUGIN_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
3625
plugins/filebrowser/gedit-file-browser-store.c
Executable file
3625
plugins/filebrowser/gedit-file-browser-store.c
Executable file
File diff suppressed because it is too large
Load Diff
200
plugins/filebrowser/gedit-file-browser-store.h
Executable file
200
plugins/filebrowser/gedit-file-browser-store.h
Executable file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* gedit-file-browser-store.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_STORE_H__
|
||||
#define __GEDIT_FILE_BROWSER_STORE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GEDIT_TYPE_FILE_BROWSER_STORE (gedit_file_browser_store_get_type ())
|
||||
#define GEDIT_FILE_BROWSER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStore))
|
||||
#define GEDIT_FILE_BROWSER_STORE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStore const))
|
||||
#define GEDIT_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStoreClass))
|
||||
#define GEDIT_IS_FILE_BROWSER_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BROWSER_STORE))
|
||||
#define GEDIT_IS_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_STORE))
|
||||
#define GEDIT_FILE_BROWSER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStoreClass))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_ICON = 0,
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_NAME,
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_URI,
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS,
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM,
|
||||
GEDIT_FILE_BROWSER_STORE_COLUMN_NUM
|
||||
} GeditFileBrowserStoreColumn;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY = 1 << 0,
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN = 1 << 1,
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT = 1 << 2,
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_LOADED = 1 << 3,
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED = 1 << 4,
|
||||
GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY = 1 << 5
|
||||
} GeditFileBrowserStoreFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_OK,
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE,
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_ERROR,
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_NO_TRASH,
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_MOUNTING,
|
||||
GEDIT_FILE_BROWSER_STORE_RESULT_NUM
|
||||
} GeditFileBrowserStoreResult;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_NONE = 0,
|
||||
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN = 1 << 0,
|
||||
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY = 1 << 1
|
||||
} GeditFileBrowserStoreFilterMode;
|
||||
|
||||
#define FILE_IS_DIR(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY)
|
||||
#define FILE_IS_HIDDEN(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN)
|
||||
#define FILE_IS_TEXT(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT)
|
||||
#define FILE_LOADED(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_LOADED)
|
||||
#define FILE_IS_FILTERED(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED)
|
||||
#define FILE_IS_DUMMY(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY)
|
||||
|
||||
typedef struct _GeditFileBrowserStore GeditFileBrowserStore;
|
||||
typedef struct _GeditFileBrowserStoreClass GeditFileBrowserStoreClass;
|
||||
typedef struct _GeditFileBrowserStorePrivate GeditFileBrowserStorePrivate;
|
||||
|
||||
typedef gboolean (*GeditFileBrowserStoreFilterFunc) (GeditFileBrowserStore
|
||||
* model,
|
||||
GtkTreeIter * iter,
|
||||
gpointer user_data);
|
||||
|
||||
struct _GeditFileBrowserStore
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GeditFileBrowserStorePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GeditFileBrowserStoreClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*begin_loading) (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
void (*end_loading) (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
void (*error) (GeditFileBrowserStore * model,
|
||||
guint code,
|
||||
gchar * message);
|
||||
gboolean (*no_trash) (GeditFileBrowserStore * model,
|
||||
GList * files);
|
||||
void (*rename) (GeditFileBrowserStore * model,
|
||||
const gchar * olduri,
|
||||
const gchar * newuri);
|
||||
void (*begin_refresh) (GeditFileBrowserStore * model);
|
||||
void (*end_refresh) (GeditFileBrowserStore * model);
|
||||
void (*unload) (GeditFileBrowserStore * model,
|
||||
const gchar * uri);
|
||||
};
|
||||
|
||||
GType gedit_file_browser_store_get_type (void) G_GNUC_CONST;
|
||||
GType gedit_file_browser_store_register_type (GTypeModule * module);
|
||||
|
||||
GeditFileBrowserStore *gedit_file_browser_store_new (gchar const *root);
|
||||
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_root_and_virtual_root (GeditFileBrowserStore * model,
|
||||
gchar const *root,
|
||||
gchar const *virtual_root);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_root (GeditFileBrowserStore * model,
|
||||
gchar const *root);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_virtual_root (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_virtual_root_from_string (GeditFileBrowserStore * model,
|
||||
gchar const *root);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_virtual_root_up (GeditFileBrowserStore * model);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_set_virtual_root_top (GeditFileBrowserStore * model);
|
||||
|
||||
gboolean
|
||||
gedit_file_browser_store_get_iter_virtual_root (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
gboolean gedit_file_browser_store_get_iter_root (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
gchar * gedit_file_browser_store_get_root (GeditFileBrowserStore * model);
|
||||
gchar * gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore * model);
|
||||
|
||||
gboolean gedit_file_browser_store_iter_equal (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter1,
|
||||
GtkTreeIter * iter2);
|
||||
|
||||
void gedit_file_browser_store_set_value (GeditFileBrowserStore * tree_model,
|
||||
GtkTreeIter * iter,
|
||||
gint column,
|
||||
GValue * value);
|
||||
|
||||
void _gedit_file_browser_store_iter_expanded (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
void _gedit_file_browser_store_iter_collapsed (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter);
|
||||
|
||||
GeditFileBrowserStoreFilterMode
|
||||
gedit_file_browser_store_get_filter_mode (GeditFileBrowserStore * model);
|
||||
void gedit_file_browser_store_set_filter_mode (GeditFileBrowserStore * model,
|
||||
GeditFileBrowserStoreFilterMode mode);
|
||||
void gedit_file_browser_store_set_filter_func (GeditFileBrowserStore * model,
|
||||
GeditFileBrowserStoreFilterFunc func,
|
||||
gpointer user_data);
|
||||
void gedit_file_browser_store_refilter (GeditFileBrowserStore * model);
|
||||
GeditFileBrowserStoreFilterMode
|
||||
gedit_file_browser_store_filter_mode_get_default (void);
|
||||
|
||||
void gedit_file_browser_store_refresh (GeditFileBrowserStore * model);
|
||||
gboolean gedit_file_browser_store_rename (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter,
|
||||
gchar const *new_name,
|
||||
GError ** error);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_delete (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * iter,
|
||||
gboolean trash);
|
||||
GeditFileBrowserStoreResult
|
||||
gedit_file_browser_store_delete_all (GeditFileBrowserStore * model,
|
||||
GList *rows,
|
||||
gboolean trash);
|
||||
|
||||
gboolean gedit_file_browser_store_new_file (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * parent,
|
||||
GtkTreeIter * iter);
|
||||
gboolean gedit_file_browser_store_new_directory (GeditFileBrowserStore * model,
|
||||
GtkTreeIter * parent,
|
||||
GtkTreeIter * iter);
|
||||
|
||||
void gedit_file_browser_store_cancel_mount_operation (GeditFileBrowserStore *store);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GEDIT_FILE_BROWSER_STORE_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
198
plugins/filebrowser/gedit-file-browser-utils.c
Executable file
198
plugins/filebrowser/gedit-file-browser-utils.c
Executable file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* gedit-file-bookmarks-store.c - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "gedit-file-browser-utils.h"
|
||||
#include <gedit/gedit-utils.h>
|
||||
|
||||
static GdkPixbuf *
|
||||
process_icon_pixbuf (GdkPixbuf * pixbuf,
|
||||
gchar const * name,
|
||||
gint size,
|
||||
GError * error)
|
||||
{
|
||||
GdkPixbuf * scale;
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning ("Could not load theme icon %s: %s",
|
||||
name,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (pixbuf && gdk_pixbuf_get_width (pixbuf) > size) {
|
||||
scale = gdk_pixbuf_scale_simple (pixbuf,
|
||||
size,
|
||||
size,
|
||||
GDK_INTERP_BILINEAR);
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scale;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gedit_file_browser_utils_pixbuf_from_theme (gchar const * name,
|
||||
GtkIconSize size)
|
||||
{
|
||||
gint width;
|
||||
GError *error = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
gtk_icon_size_lookup (size, &width, NULL);
|
||||
|
||||
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
|
||||
name,
|
||||
width,
|
||||
0,
|
||||
&error);
|
||||
|
||||
pixbuf = process_icon_pixbuf (pixbuf, name, width, error);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gedit_file_browser_utils_pixbuf_from_icon (GIcon * icon,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkPixbuf * ret = NULL;
|
||||
GtkIconTheme *theme;
|
||||
GtkIconInfo *info;
|
||||
gint width;
|
||||
|
||||
if (!icon)
|
||||
return NULL;
|
||||
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
gtk_icon_size_lookup (size, &width, NULL);
|
||||
|
||||
info = gtk_icon_theme_lookup_by_gicon (theme,
|
||||
icon,
|
||||
width,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
ret = gtk_icon_info_load_icon (info, NULL);
|
||||
gtk_icon_info_free (info);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gedit_file_browser_utils_pixbuf_from_file (GFile * file,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GIcon * icon;
|
||||
GFileInfo * info;
|
||||
GdkPixbuf * ret = NULL;
|
||||
|
||||
info = g_file_query_info (file,
|
||||
G_FILE_ATTRIBUTE_STANDARD_ICON,
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
icon = g_file_info_get_icon (info);
|
||||
if (icon != NULL)
|
||||
ret = gedit_file_browser_utils_pixbuf_from_icon (icon, size);
|
||||
|
||||
g_object_unref (info);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gedit_file_browser_utils_file_basename (GFile * file)
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *ret;
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
ret = gedit_file_browser_utils_uri_basename (uri);
|
||||
g_free (uri);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gedit_file_browser_utils_uri_basename (gchar const * uri)
|
||||
{
|
||||
return gedit_utils_basename_for_display (uri);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gedit_file_browser_utils_confirmation_dialog (GeditWindow * window,
|
||||
GtkMessageType type,
|
||||
gchar const *message,
|
||||
gchar const *secondary,
|
||||
gchar const * button_stock,
|
||||
gchar const * button_label)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
gint ret;
|
||||
GtkWidget *button;
|
||||
|
||||
dlg = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL |
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
type,
|
||||
GTK_BUTTONS_NONE, "%s", message);
|
||||
|
||||
if (secondary)
|
||||
gtk_message_dialog_format_secondary_text
|
||||
(GTK_MESSAGE_DIALOG (dlg), "%s", secondary);
|
||||
|
||||
/* Add a cancel button */
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
|
||||
button,
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
/* Add custom button */
|
||||
button = gtk_button_new_from_stock (button_stock);
|
||||
|
||||
if (button_label) {
|
||||
gtk_button_set_use_stock (GTK_BUTTON (button), FALSE);
|
||||
gtk_button_set_label (GTK_BUTTON (button), button_label);
|
||||
}
|
||||
|
||||
gtk_widget_show (button);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
|
||||
button,
|
||||
GTK_RESPONSE_OK);
|
||||
|
||||
ret = gtk_dialog_run (GTK_DIALOG (dlg));
|
||||
gtk_widget_destroy (dlg);
|
||||
|
||||
return (ret == GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
// ex:ts=8:noet:
|
27
plugins/filebrowser/gedit-file-browser-utils.h
Executable file
27
plugins/filebrowser/gedit-file-browser-utils.h
Executable file
@@ -0,0 +1,27 @@
|
||||
#ifndef __GEDIT_FILE_BROWSER_UTILS_H__
|
||||
#define __GEDIT_FILE_BROWSER_UTILS_H__
|
||||
|
||||
#include <gedit/gedit-window.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
GdkPixbuf *gedit_file_browser_utils_pixbuf_from_theme (gchar const *name,
|
||||
GtkIconSize size);
|
||||
|
||||
GdkPixbuf *gedit_file_browser_utils_pixbuf_from_icon (GIcon * icon,
|
||||
GtkIconSize size);
|
||||
GdkPixbuf *gedit_file_browser_utils_pixbuf_from_file (GFile * file,
|
||||
GtkIconSize size);
|
||||
|
||||
gchar * gedit_file_browser_utils_file_basename (GFile * file);
|
||||
gchar * gedit_file_browser_utils_uri_basename (gchar const * uri);
|
||||
|
||||
gboolean gedit_file_browser_utils_confirmation_dialog (GeditWindow * window,
|
||||
GtkMessageType type,
|
||||
gchar const *message,
|
||||
gchar const *secondary,
|
||||
gchar const * button_stock,
|
||||
gchar const * button_label);
|
||||
|
||||
#endif /* __GEDIT_FILE_BROWSER_UTILS_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
1256
plugins/filebrowser/gedit-file-browser-view.c
Executable file
1256
plugins/filebrowser/gedit-file-browser-view.c
Executable file
File diff suppressed because it is too large
Load Diff
84
plugins/filebrowser/gedit-file-browser-view.h
Executable file
84
plugins/filebrowser/gedit-file-browser-view.h
Executable file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* gedit-file-browser-view.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_VIEW_H__
|
||||
#define __GEDIT_FILE_BROWSER_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GEDIT_TYPE_FILE_BROWSER_VIEW (gedit_file_browser_view_get_type ())
|
||||
#define GEDIT_FILE_BROWSER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserView))
|
||||
#define GEDIT_FILE_BROWSER_VIEW_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserView const))
|
||||
#define GEDIT_FILE_BROWSER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewClass))
|
||||
#define GEDIT_IS_FILE_BROWSER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW))
|
||||
#define GEDIT_IS_FILE_BROWSER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_VIEW))
|
||||
#define GEDIT_FILE_BROWSER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewClass))
|
||||
|
||||
typedef struct _GeditFileBrowserView GeditFileBrowserView;
|
||||
typedef struct _GeditFileBrowserViewClass GeditFileBrowserViewClass;
|
||||
typedef struct _GeditFileBrowserViewPrivate GeditFileBrowserViewPrivate;
|
||||
|
||||
typedef enum {
|
||||
GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
|
||||
GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
|
||||
} GeditFileBrowserViewClickPolicy;
|
||||
|
||||
struct _GeditFileBrowserView
|
||||
{
|
||||
GtkTreeView parent;
|
||||
|
||||
GeditFileBrowserViewPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GeditFileBrowserViewClass
|
||||
{
|
||||
GtkTreeViewClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*error) (GeditFileBrowserView * filetree,
|
||||
guint code,
|
||||
gchar const *message);
|
||||
void (*file_activated) (GeditFileBrowserView * filetree,
|
||||
GtkTreeIter *iter);
|
||||
void (*directory_activated) (GeditFileBrowserView * filetree,
|
||||
GtkTreeIter *iter);
|
||||
void (*bookmark_activated) (GeditFileBrowserView * filetree,
|
||||
GtkTreeIter *iter);
|
||||
};
|
||||
|
||||
GType gedit_file_browser_view_get_type (void) G_GNUC_CONST;
|
||||
GType gedit_file_browser_view_register_type (GTypeModule * module);
|
||||
|
||||
GtkWidget *gedit_file_browser_view_new (void);
|
||||
void gedit_file_browser_view_set_model (GeditFileBrowserView * tree_view,
|
||||
GtkTreeModel * model);
|
||||
void gedit_file_browser_view_start_rename (GeditFileBrowserView * tree_view,
|
||||
GtkTreeIter * iter);
|
||||
void gedit_file_browser_view_set_click_policy (GeditFileBrowserView * tree_view,
|
||||
GeditFileBrowserViewClickPolicy policy);
|
||||
void gedit_file_browser_view_set_restore_expand_state (GeditFileBrowserView * tree_view,
|
||||
gboolean restore_expand_state);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GEDIT_FILE_BROWSER_VIEW_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
54
plugins/filebrowser/gedit-file-browser-widget-ui.xml
Executable file
54
plugins/filebrowser/gedit-file-browser-widget-ui.xml
Executable file
@@ -0,0 +1,54 @@
|
||||
<ui>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="Tool_Opt1"/>
|
||||
<toolitem action="DirectoryUp"/>
|
||||
<separator/>
|
||||
<toolitem action="DirectoryRefresh"/>
|
||||
<separator/>
|
||||
<placeholder name="Tool_Opt2"/>
|
||||
<separator/>
|
||||
<toolitem action="FilterHidden"/>
|
||||
<separator/>
|
||||
<placeholder name="Tool_Opt3"/>
|
||||
</toolbar>
|
||||
|
||||
<popup name="FilePopup" action="FilePopupAction">
|
||||
<menuitem action="FileOpen" />
|
||||
<placeholder name="FilePopup_Opt1" />
|
||||
<separator/>
|
||||
<menuitem action="DirectoryNew" />
|
||||
<menuitem action="FileNew" />
|
||||
<separator/>
|
||||
<placeholder name="FilePopup_Opt2" />
|
||||
<separator/>
|
||||
<menuitem action="FileRename"/>
|
||||
<menuitem action="FileMoveToTrash"/>
|
||||
<menuitem action="FileDelete"/>
|
||||
<separator/>
|
||||
<placeholder name="FilePopup_Opt3" />
|
||||
<separator/>
|
||||
<menuitem action="DirectoryRefresh"/>
|
||||
<menuitem action="DirectoryOpen"/>
|
||||
<placeholder name="FilePopup_Opt4" />
|
||||
<separator/>
|
||||
<placeholder name="FilePopup_Opt5" />
|
||||
<separator/>
|
||||
<menu name="FilterMenu" action="FilterMenuAction">
|
||||
<menuitem action="FilterHidden"/>
|
||||
<menuitem action="FilterBinary"/>
|
||||
</menu>
|
||||
<placeholder name="FilePopup_Opt6" />
|
||||
<separator/>
|
||||
</popup>
|
||||
|
||||
<popup name="BookmarkPopup" action="BookmarkPopupAction">
|
||||
<placeholder name="BookmarkPopup_Opt1" />
|
||||
<separator/>
|
||||
<placeholder name="BookmarkPopup_Opt2" />
|
||||
<separator/>
|
||||
<menuitem action="BookmarkOpen"/>
|
||||
<placeholder name="BookmarkPopup_Opt3" />
|
||||
<separator/>
|
||||
<placeholder name="BookmarkPopup_Opt4" />
|
||||
</popup>
|
||||
</ui>
|
3143
plugins/filebrowser/gedit-file-browser-widget.c
Executable file
3143
plugins/filebrowser/gedit-file-browser-widget.c
Executable file
File diff suppressed because it is too large
Load Diff
121
plugins/filebrowser/gedit-file-browser-widget.h
Executable file
121
plugins/filebrowser/gedit-file-browser-widget.h
Executable file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* gedit-file-browser-widget.h - Gedit plugin providing easy file access
|
||||
* from the sidepanel
|
||||
*
|
||||
* Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
*
|
||||
* 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 __GEDIT_FILE_BROWSER_WIDGET_H__
|
||||
#define __GEDIT_FILE_BROWSER_WIDGET_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gedit-file-browser-store.h"
|
||||
#include "gedit-file-bookmarks-store.h"
|
||||
#include "gedit-file-browser-view.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GEDIT_TYPE_FILE_BROWSER_WIDGET (gedit_file_browser_widget_get_type ())
|
||||
#define GEDIT_FILE_BROWSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_WIDGET, GeditFileBrowserWidget))
|
||||
#define GEDIT_FILE_BROWSER_WIDGET_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_WIDGET, GeditFileBrowserWidget const))
|
||||
#define GEDIT_FILE_BROWSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BROWSER_WIDGET, GeditFileBrowserWidgetClass))
|
||||
#define GEDIT_IS_FILE_BROWSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BROWSER_WIDGET))
|
||||
#define GEDIT_IS_FILE_BROWSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_WIDGET))
|
||||
#define GEDIT_FILE_BROWSER_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_WIDGET, GeditFileBrowserWidgetClass))
|
||||
|
||||
typedef struct _GeditFileBrowserWidget GeditFileBrowserWidget;
|
||||
typedef struct _GeditFileBrowserWidgetClass GeditFileBrowserWidgetClass;
|
||||
typedef struct _GeditFileBrowserWidgetPrivate GeditFileBrowserWidgetPrivate;
|
||||
|
||||
typedef
|
||||
gboolean (*GeditFileBrowserWidgetFilterFunc) (GeditFileBrowserWidget * obj,
|
||||
GeditFileBrowserStore *
|
||||
model, GtkTreeIter * iter,
|
||||
gpointer user_data);
|
||||
|
||||
struct _GeditFileBrowserWidget
|
||||
{
|
||||
GtkVBox parent;
|
||||
|
||||
GeditFileBrowserWidgetPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GeditFileBrowserWidgetClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*uri_activated) (GeditFileBrowserWidget * widget,
|
||||
gchar const *uri);
|
||||
void (*error) (GeditFileBrowserWidget * widget,
|
||||
guint code,
|
||||
gchar const *message);
|
||||
gboolean (*confirm_delete) (GeditFileBrowserWidget * widget,
|
||||
GeditFileBrowserStore * model,
|
||||
GList *list);
|
||||
gboolean (*confirm_no_trash) (GeditFileBrowserWidget * widget,
|
||||
GList *list);
|
||||
};
|
||||
|
||||
GType gedit_file_browser_widget_get_type (void) G_GNUC_CONST;
|
||||
GType gedit_file_browser_widget_register_type (GTypeModule * module);
|
||||
|
||||
GtkWidget *gedit_file_browser_widget_new (const gchar *data_dir);
|
||||
|
||||
void gedit_file_browser_widget_show_bookmarks (GeditFileBrowserWidget * obj);
|
||||
void gedit_file_browser_widget_show_files (GeditFileBrowserWidget * obj);
|
||||
|
||||
void gedit_file_browser_widget_set_root (GeditFileBrowserWidget * obj,
|
||||
gchar const *root,
|
||||
gboolean virtual_root);
|
||||
void
|
||||
gedit_file_browser_widget_set_root_and_virtual_root (GeditFileBrowserWidget * obj,
|
||||
gchar const *root,
|
||||
gchar const *virtual_root);
|
||||
|
||||
gboolean
|
||||
gedit_file_browser_widget_get_selected_directory (GeditFileBrowserWidget * obj,
|
||||
GtkTreeIter * iter);
|
||||
|
||||
GeditFileBrowserStore *
|
||||
gedit_file_browser_widget_get_browser_store (GeditFileBrowserWidget * obj);
|
||||
GeditFileBookmarksStore *
|
||||
gedit_file_browser_widget_get_bookmarks_store (GeditFileBrowserWidget * obj);
|
||||
GeditFileBrowserView *
|
||||
gedit_file_browser_widget_get_browser_view (GeditFileBrowserWidget * obj);
|
||||
GtkWidget *
|
||||
gedit_file_browser_widget_get_filter_entry (GeditFileBrowserWidget * obj);
|
||||
|
||||
GtkUIManager *
|
||||
gedit_file_browser_widget_get_ui_manager (GeditFileBrowserWidget * obj);
|
||||
|
||||
gulong gedit_file_browser_widget_add_filter (GeditFileBrowserWidget * obj,
|
||||
GeditFileBrowserWidgetFilterFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
void gedit_file_browser_widget_remove_filter (GeditFileBrowserWidget * obj,
|
||||
gulong id);
|
||||
void gedit_file_browser_widget_set_filter_pattern (GeditFileBrowserWidget * obj,
|
||||
gchar const *pattern);
|
||||
|
||||
void gedit_file_browser_widget_refresh (GeditFileBrowserWidget * obj);
|
||||
void gedit_file_browser_widget_history_back (GeditFileBrowserWidget * obj);
|
||||
void gedit_file_browser_widget_history_forward (GeditFileBrowserWidget * obj);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GEDIT_FILE_BROWSER_WIDGET_H__ */
|
||||
|
||||
// ex:ts=8:noet:
|
97
plugins/filebrowser/gedit-file-browser.schemas.in
Executable file
97
plugins/filebrowser/gedit-file-browser.schemas.in
Executable file
@@ -0,0 +1,97 @@
|
||||
<mateconfschemafile>
|
||||
<schemalist>
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/on_load/tree_view</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/on_load/tree_view</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>bool</type>
|
||||
<default>TRUE</default>
|
||||
<locale name="C">
|
||||
<short>Open With Tree View</short>
|
||||
<long>Open the tree view when the file browser plugin gets loaded instead of the bookmarks view</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/on_load/root</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/on_load/root</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
<locale name="C">
|
||||
<short>File Browser Root Directory</short>
|
||||
<long>The file browser root directory to use when loading the file
|
||||
browser plugin and onload/tree_view is TRUE.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/on_load/virtual_root</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/on_load/virtual_root</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
<locale name="C">
|
||||
<short>File Browser Virtual Root Directory</short>
|
||||
<long>The file browser virtual root directory to use when loading the
|
||||
file browser plugin when onload/tree_view is TRUE. The virtual root
|
||||
must always be below the actual root.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/on_load/enable_remote</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/on_load/enable_remote</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>bool</type>
|
||||
<default>FALSE</default>
|
||||
<locale name="C">
|
||||
<short>Enable Restore of Remote Locations</short>
|
||||
<long>Sets whether to enable restoring of remote locations.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/open_at_first_doc</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/open_at_first_doc</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>bool</type>
|
||||
<default>TRUE</default>
|
||||
<locale name="C">
|
||||
<short>Set Location to First Document</short>
|
||||
<long>If TRUE the file browser plugin will view the directory of
|
||||
the first opened document given that the file browser hasn't been
|
||||
used yet. (Thus this generally applies to opening a document from
|
||||
the command line or opening it with Caja, etc.)</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/filter_mode</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/filter_mode</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>string</type>
|
||||
<default>hidden_and_binary</default>
|
||||
<locale name="C">
|
||||
<short>File Browser Filter Mode</short>
|
||||
<long>This value determines what files get filtered from the file
|
||||
browser. Valid values are: none (filter nothing),
|
||||
hidden (filter hidden files), binary (filter binary files) and
|
||||
hidden_and_binary (filter both hidden and binary files).</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gedit-2/plugins/filebrowser/filter_pattern</key>
|
||||
<applyto>/apps/gedit-2/plugins/filebrowser/filter_pattern</applyto>
|
||||
<owner>gedit</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
<locale name="C">
|
||||
<short>File Browser Filter Pattern</short>
|
||||
<long>The filter pattern to filter the file browser with. This filter
|
||||
works on top of the filter_mode.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
</schemalist>
|
||||
</mateconfschemafile>
|
Reference in New Issue
Block a user