Commit f5bd7718 authored by Jim Krehl's avatar Jim Krehl Committed by Jim Krehl

The commit merges in the "version-2" branch. Many things have been

2007-02-26  Jim Krehl  <jimmyk@novell.com>
        The commit merges in the "version-2" branch.  Many things have
        been updated/changed for this version ...

        * main-menu/src/bookmark-tile-table.c
        * main-menu/src/bookmark-tile-table.h
        * main-menu/src/main-menu.c
        * main-menu/src/main-menu-ui.c
        * main-menu/src/main-menu-ui.h
        * main-menu/src/recent-apps-tile-table.c
        * main-menu/src/recent-apps-tile-table.h
        * main-menu/src/recent-docs-tile-table.c
        * main-menu/src/recent-docs-tile-table.h
        * main-menu/src/system-tile-table.c
        * main-menu/src/system-tile-table.h
        * main-menu/src/tile-table.c
        * main-menu/src/tile-table.h
        * main-menu/src/user-apps-tile-table.c
        * main-menu/src/user-apps-tile-table.h
        * main-menu/src/user-dirs-tile-table.c
        * main-menu/src/user-dirs-tile-table.h
        * main-menu/src/user-docs-tile-table.c
        * main-menu/src/user-docs-tile-table.h:

        There are now 3 types of items shown in the main section of the
        menu: Applications, Documents, and Places.  Applications and
        Documents can be either "Favorite" or "Recent".  Places
        corresponds to the list of default places and user bookmarked
        places as in the FileChooser dialog.

        * main-menu/src/slab-window.glade:

        The main-menu is now defined by a glade file.

        * main-menu/etc/applications.xbel
        * main-menu/etc/documents.xbel
        * main-menu/etc/places.xbel
        * main-menu/etc/slab.schemas.in.in
        * main-menu/etc/system-items.xbel
        * main-menu/etc/gnome-screensaver-lock.desktop
        * main-menu/etc/gnome-session-kill.desktop
        * main-menu/src/main-menu-migration.h
        * main-menu/src/main-menu-migration.c:

        The lists of user bookmarked Applications and Documents, as well
        as the list of system items is now maintained in XBEL files in
        the user's data dir.  Because of the new storage scheme,
        migration needs to be done to preserve user prefs over upgrade.
        The system area now only references .desktop files so for items
        like "Lock Screen" for which there is no .desktop file the
        main-menu provides one.

        * main-menu/src/main-menu-common.h
        * main-menu/src/main-menu-engine.c
        * main-menu/src/text-button.c
        * main-menu/src/text-button.h
        * main-menu/src/file-area-widget.c
        * main-menu/src/main-menu-conf.c
        * main-menu/src/file-area-widget.h
        * main-menu/src/main-menu-conf.h
        * main-menu/src/slab-window.c
        * main-menu/src/slab-window.h:

        These files are no longer pertinent.

        * nautilus-main-menu/nautilus-main-menu.c:

        Added a nautilus menu extension so that one can bookmark a
        document with nautilus.


svn path=/trunk/; revision=205
parent 0f3c027a
......@@ -4,5 +4,6 @@ JP Rosevear <jpr@novell.com>
Scott Reeves <sreeves@novell.com>
Contributors:
Rodney Dawes
Jaap A. Haitsma
Jonh Wendell
2007-02-26 Jim Krehl <jimmyk@novell.com>
The commit merges in the "version-2" branch. Many things have been
updated/changed for this version ...
* main-menu/src/bookmark-tile-table.c
* main-menu/src/bookmark-tile-table.h
* main-menu/src/main-menu.c
* main-menu/src/main-menu-ui.c
* main-menu/src/main-menu-ui.h
* main-menu/src/recent-apps-tile-table.c
* main-menu/src/recent-apps-tile-table.h
* main-menu/src/recent-docs-tile-table.c
* main-menu/src/recent-docs-tile-table.h
* main-menu/src/system-tile-table.c
* main-menu/src/system-tile-table.h
* main-menu/src/tile-table.c
* main-menu/src/tile-table.h
* main-menu/src/user-apps-tile-table.c
* main-menu/src/user-apps-tile-table.h
* main-menu/src/user-dirs-tile-table.c
* main-menu/src/user-dirs-tile-table.h
* main-menu/src/user-docs-tile-table.c
* main-menu/src/user-docs-tile-table.h:
There are now 3 types of items shown in the main section of the menu:
Applications, Documents, and Places. Applications and Documents can be
either "Favorite" or "Recent". Places corresponds to the list of
default places and user bookmarked places as in the FileChooser dialog.
* main-menu/src/slab-window.glade:
The main-menu is now defined by a glade file.
* main-menu/etc/applications.xbel
* main-menu/etc/documents.xbel
* main-menu/etc/places.xbel
* main-menu/etc/slab.schemas.in.in
* main-menu/etc/system-items.xbel
* main-menu/etc/gnome-screensaver-lock.desktop
* main-menu/etc/gnome-session-kill.desktop
* main-menu/src/main-menu-migration.h
* main-menu/src/main-menu-migration.c:
The lists of user bookmarked Applications and Documents, as well as the
list of system items is now maintained in XBEL files in the user's data
dir. Because of the new storage scheme, migration needs to be done to
preserve user prefs over upgrade. The system area now only references
.desktop files so for items like "Lock Screen" for which there is no
.desktop file the main-menu provides one.
* main-menu/src/main-menu-common.h
* main-menu/src/main-menu-engine.c
* main-menu/src/text-button.c
* main-menu/src/text-button.h
* main-menu/src/file-area-widget.c
* main-menu/src/main-menu-conf.c
* main-menu/src/file-area-widget.h
* main-menu/src/main-menu-conf.h
* main-menu/src/slab-window.c
* main-menu/src/slab-window.h:
These files are no longer pertinent.
* nautilus-main-menu/nautilus-main-menu.c:
Added a nautilus menu extension so that one can bookmark a document
with nautilus.
2007-02-22 Scott Reeves <sreeves@novell.com>
* libslab/slab-gnome-util.c
* libslab/app-shell.c
......@@ -77,7 +145,6 @@
system-tile's launched twice.
* libslab/application-tile.c: - When no GenericName is present then
just show and center the Name
2007-01-19 Scott Reeves <sreeves@novell.com>
* control-center/src/control-center.c
......
AC_INIT([gnome-main-menu], [0.6.3], [])
AC_INIT([gnome-main-menu], [0.9.5], [])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_HEADERS([config.h])
......@@ -22,7 +22,7 @@ dnl ==============================================
GETTEXT_PACKAGE=gnome-main-menu
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
ALL_LINGUAS="ar bg bn br bs ca cs cy da de dz el en_CA en_GB en_IGID es fi fr gl he hi hr hu id it ja ka km ko lo lt mk nb nl pa pl pt_BR pt ro ru sk sl sr sv ta tr uk zh_CN zh_TW"
ALL_LINGUAS="af ar bg bn br bs ca cs cy da de dz el en_CA en_GB en_IGID en_US es et fi fr gl gu he hi hr hu id it ja ka km ko lo lt mk mr nb nl pa pl pt_BR pt ro ru sk sl sr sv ta tr uk vi xh zh_CN zh_TW zu"
IT_PROG_INTLTOOL([0.34])
AM_GLIB_GNU_GETTEXT
......@@ -43,7 +43,7 @@ PKG_CHECK_MODULES(LIBSLAB, [ $COMMON_MODULES gnome-desktop-2.0 librsvg-2.0 libgn
AC_SUBST(LIBSLAB_CFLAGS)
AC_SUBST(LIBSLAB_LIBS)
PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-2.0 gnome-desktop-2.0 gconf-2.0 libgtop-2.0 libgnome-2.0 libgnomeui-2.0 dbus-glib-1 NetworkManager hal-storage ])
PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-2.0 gnome-desktop-2.0 gconf-2.0 libgtop-2.0 libgnome-2.0 libgnomeui-2.0 dbus-glib-1 NetworkManager hal-storage cairo ])
AC_CHECK_HEADERS(iwlib.h, [ AC_CHECK_LIB(iw, iw_sockets_open, have_iwlib=yes, have_iwlib=no)], have_iwlib=no)
......
......@@ -10,14 +10,19 @@ libslab_la_SOURCES = \
app-shell.c \
app-shell-startup.c \
application-tile.c \
directory-tile.c \
document-tile.c \
double-click-detector.c \
double-click-detector.h \
eggbookmarkfile.c \
eggbookmarkfile.h \
egg-recent-item.c \
egg-recent-item.h \
egg-recent-model.c \
egg-recent-model.h \
gnome-utils.c \
libslab-utils.c \
libslab-utils.h \
nameplate-tile.c \
recent-files.c \
recent-files.h \
......@@ -28,6 +33,7 @@ libslab_la_SOURCES = \
shell-window.c \
slab-gnome-util.c \
slab-section.c \
system-tile.c \
themed-icon.c \
themed-icon.h \
tile-action.c \
......@@ -40,6 +46,7 @@ libslab_include_HEADERS = \
app-shell.h \
app-shell-startup.h \
application-tile.h \
directory-tile.h \
document-tile.h \
gnome-utils.h \
nameplate-tile.h \
......@@ -49,6 +56,7 @@ libslab_include_HEADERS = \
shell-window.h \
slab-gnome-util.h \
slab-section.h \
system-tile.h \
tile.h
libslab_la_LIBADD = \
......
/*
* This file is part of libtile.
*
* Copyright (c) 2006 Novell, Inc.
* Copyright (c) 2006, 2007 Novell, Inc.
*
* Libtile is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
......@@ -27,6 +27,7 @@
#include <gconf/gconf-client.h>
#include "slab-gnome-util.h"
#include "libslab-utils.h"
#include "themed-icon.h"
......@@ -61,16 +62,17 @@ static void remove_from_user_list (ApplicationTile *);
static void add_to_startup_list (ApplicationTile *);
static void remove_from_startup_list (ApplicationTile *);
static gboolean verify_package_management_command (gchar *);
static gboolean verify_package_management_command (const gchar *);
static void run_package_management_command (ApplicationTile *, gchar *);
static gboolean is_desktop_item_in_user_list (const gchar *);
static void update_user_list_menu_item (ApplicationTile *);
static void update_user_list_menu_item (ApplicationTile *);
static StartupStatus get_desktop_item_startup_status (GnomeDesktopItem *);
static void update_startup_menu_item (ApplicationTile *);
static void gconf_user_list_change_cb (GConfClient *, guint, GConfEntry *, gpointer);
static void apps_store_monitor_cb (
GnomeVFSMonitorHandle *, const gchar *,
const gchar *, GnomeVFSMonitorEventType, gpointer);
typedef struct {
GnomeDesktopItem *desktop_item;
......@@ -83,8 +85,7 @@ typedef struct {
gboolean is_in_user_list;
StartupStatus startup_status;
GConfClient *gconf_client;
guint gconf_conn_id;
GnomeVFSMonitorHandle *user_spec_monitor_handle;
} ApplicationTilePrivate;
#define APPLICATION_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APPLICATION_TILE_TYPE, ApplicationTilePrivate))
......@@ -178,8 +179,7 @@ application_tile_init (ApplicationTile *tile)
priv->is_in_user_list = FALSE;
priv->gconf_client = NULL;
priv->gconf_conn_id = 0;
priv->user_spec_monitor_handle = NULL;
tile->name = tile->description = tile->gconf_prefix = NULL;
}
......@@ -212,10 +212,10 @@ application_tile_finalize (GObject *g_object)
priv->image_id = NULL;
}
gconf_client_notify_remove (priv->gconf_client, priv->gconf_conn_id);
g_object_unref (priv->gconf_client);
if (priv->user_spec_monitor_handle)
gnome_vfs_monitor_cancel (priv->user_spec_monitor_handle);
(* G_OBJECT_CLASS (application_tile_parent_class)->finalize) (g_object);
G_OBJECT_CLASS (application_tile_parent_class)->finalize (g_object);
}
static void
......@@ -341,7 +341,7 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
"gconf-prefix", gconf_prefix,
NULL);
priv->is_in_user_list = is_desktop_item_in_user_list (TILE (this)->uri);
priv->is_in_user_list = libslab_user_apps_store_has_uri (TILE (this)->uri);
priv->startup_status = get_desktop_item_startup_status (priv->desktop_item);
actions = g_new0 (TileAction *, 6);
......@@ -458,10 +458,7 @@ application_tile_setup (ApplicationTile *this, const gchar *gconf_prefix)
} else
actions [APPLICATION_TILE_ACTION_UNINSTALL_PACKAGE] = NULL;
priv->gconf_client = gconf_client_get_default ();
priv->gconf_conn_id = gconf_client_notify_add (
priv->gconf_client, SLAB_USER_SPECIFIED_APPS_KEY,
gconf_user_list_change_cb, this, NULL, &error);
priv->user_spec_monitor_handle = libslab_add_apps_monitor (apps_store_monitor_cb, this);
if (error) {
g_warning ("error monitoring %s [%s]\n", SLAB_USER_SPECIFIED_APPS_KEY, error->message);
......@@ -538,82 +535,34 @@ static void
add_to_user_list (ApplicationTile *this)
{
ApplicationTilePrivate *priv = APPLICATION_TILE_GET_PRIVATE (this);
GList *tiles;
GSList *app_list;
gchar *loc;
GConfClient *gconf_client;
GError *error;
loc = g_strdup (gnome_desktop_item_get_location (priv->desktop_item));
app_list = get_slab_gconf_slist (SLAB_USER_SPECIFIED_APPS_KEY);
app_list = g_slist_append (app_list, loc);
gconf_client = gconf_client_get_default ();
error = NULL;
gconf_client_set_list (gconf_client, SLAB_USER_SPECIFIED_APPS_KEY, GCONF_VALUE_STRING,
app_list, &error);
if (error)
g_warning (
"error adding %s to %s [%s]\n",
loc, SLAB_USER_SPECIFIED_APPS_KEY, error->message);
tiles = libslab_get_user_app_uris ();
if (! g_list_find_custom (tiles, TILE (this)->uri, (GCompareFunc) libslab_strcmp)) {
tiles = g_list_append (tiles, TILE (this)->uri);
libslab_save_app_uris (tiles);
}
free_slab_gconf_slist_of_strings (app_list);
priv->is_in_user_list = TRUE;
g_list_free (tiles);
}
static void
remove_from_user_list (ApplicationTile *this)
{
ApplicationTilePrivate *priv = APPLICATION_TILE_GET_PRIVATE (this);
GList *tiles;
GSList *app_list;
GSList *new_app_list;
const gchar *loc;
gint offset;
GConfClient *gconf_client;
GError *error;
GSList *node;
app_list = get_slab_gconf_slist (SLAB_USER_SPECIFIED_APPS_KEY);
if (! app_list)
return;
loc = gnome_desktop_item_get_location (priv->desktop_item);
new_app_list = NULL;
for (node = app_list; node; node = node->next) {
offset = strlen (loc) - strlen ((gchar *) node->data);
if (offset < 0)
offset = 0;
if (strcmp (& loc [offset], (gchar *) node->data))
new_app_list = g_slist_append (new_app_list, node->data);
}
gconf_client = gconf_client_get_default ();
error = NULL;
gconf_client_set_list (gconf_client, SLAB_USER_SPECIFIED_APPS_KEY, GCONF_VALUE_STRING,
new_app_list, &error);
tiles = libslab_get_user_app_uris ();
tiles = g_list_remove_link (tiles, g_list_find_custom (tiles, TILE (this)->uri, (GCompareFunc) libslab_strcmp));
libslab_save_app_uris (tiles);
if (error)
g_warning (
"error removing %s from %s [%s]\n",
loc, SLAB_USER_SPECIFIED_APPS_KEY, error->message);
free_slab_gconf_slist_of_strings (app_list);
priv->is_in_user_list = FALSE;
g_list_free (tiles);
}
static void
......@@ -629,7 +578,7 @@ uninstall_trigger (Tile *tile, TileEvent *event, TileAction *action)
}
static gboolean
verify_package_management_command (gchar *gconf_key)
verify_package_management_command (const gchar *gconf_key)
{
gchar *cmd;
gchar *path;
......@@ -804,40 +753,6 @@ application_tile_get_desktop_item (ApplicationTile *tile)
return APPLICATION_TILE_GET_PRIVATE (tile)->desktop_item;
}
static gboolean
is_desktop_item_in_user_list (const gchar *uri)
{
GSList *app_list;
GSList *node;
gint offset;
gint uri_len;
gboolean retval;
retval = FALSE;
app_list = get_slab_gconf_slist (SLAB_USER_SPECIFIED_APPS_KEY);
if (! app_list)
return FALSE;
uri_len = strlen (uri);
for (node = app_list; node; node = node->next) {
offset = uri_len - strlen ((gchar *) node->data);
if (offset < 0)
offset = 0;
if (! strcmp (& uri [offset], (gchar *) node->data))
{
retval = TRUE;
break;
}
}
free_slab_gconf_slist_of_strings (app_list);
return retval;
}
static void
update_user_list_menu_item (ApplicationTile *this)
{
......@@ -938,15 +853,17 @@ header_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_
}
static void
gconf_user_list_change_cb (GConfClient *gconf_client, guint c_id, GConfEntry *entry,
gpointer user_data)
apps_store_monitor_cb (
GnomeVFSMonitorHandle *handle, const gchar *monitor_uri,
const gchar *info_uri, GnomeVFSMonitorEventType type, gpointer user_data)
{
ApplicationTile *this = APPLICATION_TILE (user_data);
ApplicationTilePrivate *priv = APPLICATION_TILE_GET_PRIVATE (this);
gboolean is_in_user_list_current;
is_in_user_list_current = is_desktop_item_in_user_list (TILE (this)->uri);
is_in_user_list_current = libslab_user_apps_store_has_uri (TILE (this)->uri);
if (is_in_user_list_current == priv->is_in_user_list)
return;
......
/*
* This file is part of libtile.
*
* Copyright (c) 2006 Novell, Inc.
*
* Libtile is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* Libtile 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libslab; if not, write to the Free Software Foundation, Inc., 51
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "directory-tile.h"
#include <glib/gi18n.h>
#include <string.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <libgnomevfs/gnome-vfs.h>
#include <unistd.h>
#include "slab-gnome-util.h"
#include "gnome-utils.h"
#include "libslab-utils.h"
#define GCONF_SEND_TO_CMD_KEY "/desktop/gnome/applications/main-menu/file-area/file_send_to_cmd"
#define GCONF_ENABLE_DELETE_KEY_DIR "/apps/nautilus/preferences"
#define GCONF_ENABLE_DELETE_KEY GCONF_ENABLE_DELETE_KEY_DIR "/enable_delete"
G_DEFINE_TYPE (DirectoryTile, directory_tile, NAMEPLATE_TILE_TYPE)
static void directory_tile_finalize (GObject *);
static void directory_tile_style_set (GtkWidget *, GtkStyle *);
static void directory_tile_private_setup (DirectoryTile *);
static void load_image (DirectoryTile *);
static GtkWidget *create_header (const gchar *);
static void header_size_allocate_cb (GtkWidget *, GtkAllocation *, gpointer);
static void open_trigger (Tile *, TileEvent *, TileAction *);
static void rename_trigger (Tile *, TileEvent *, TileAction *);
static void move_to_trash_trigger (Tile *, TileEvent *, TileAction *);
static void delete_trigger (Tile *, TileEvent *, TileAction *);
static void send_to_trigger (Tile *, TileEvent *, TileAction *);
static void rename_entry_activate_cb (GtkEntry *, gpointer);
static gboolean rename_entry_key_release_cb (GtkWidget *, GdkEventKey *, gpointer);
static void gconf_enable_delete_cb (GConfClient *, guint, GConfEntry *, gpointer);
static void disown_spawned_child (gpointer);
typedef struct
{
gchar *basename;
GtkBin *header_bin;
gchar *icon_name;
gboolean renaming;
gboolean image_is_broken;
gboolean delete_enabled;
guint gconf_conn_id;
} DirectoryTilePrivate;
#define DIRECTORY_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DIRECTORY_TILE_TYPE, DirectoryTilePrivate))
static void directory_tile_class_init (DirectoryTileClass *this_class)
{
GObjectClass *g_obj_class = G_OBJECT_CLASS (this_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (this_class);
g_obj_class->finalize = directory_tile_finalize;
widget_class->style_set = directory_tile_style_set;
g_type_class_add_private (this_class, sizeof (DirectoryTilePrivate));
}
GtkWidget *
directory_tile_new (const gchar *in_uri, const gchar *title, const gchar *icon_name)
{
DirectoryTile *this;
DirectoryTilePrivate *priv;
gchar *uri;
GtkWidget *image;
GtkWidget *header;
GtkMenu *context_menu;
GtkContainer *menu_ctnr;
GtkWidget *menu_item;
TileAction *action;
gchar *basename;
gchar *markup;
AtkObject *accessible;
gchar *filename;
gchar *tooltip_text;
uri = g_strdup (in_uri);
image = gtk_image_new ();
if (! title) {
markup = g_path_get_basename (uri);
basename = gnome_vfs_unescape_string (markup, NULL);
g_free (markup);
}
else
basename = g_strdup (title);
header = create_header (basename);
filename = g_filename_from_uri (uri, NULL, NULL);
if (filename)
tooltip_text = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
else
tooltip_text = NULL;
g_free (filename);
context_menu = GTK_MENU (gtk_menu_new ());
this = g_object_new (
DIRECTORY_TILE_TYPE,
"tile-uri", uri,
"nameplate-image", image,
"nameplate-header", header,
"nameplate-tooltip", tooltip_text,
"context-menu", context_menu,
NULL);
g_free (uri);
priv = DIRECTORY_TILE_GET_PRIVATE (this);
priv->basename = g_strdup (basename);
priv->header_bin = GTK_BIN (header);
priv->icon_name = g_strdup (icon_name);
directory_tile_private_setup (this);
TILE (this)->actions = g_new0 (TileAction *, 6);
TILE (this)->n_actions = 6;
menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
/* make open with default action */
markup = g_markup_printf_escaped (_("<b>Open</b>"));
action = tile_action_new (TILE (this), open_trigger, markup, TILE_ACTION_OPENS_NEW_WINDOW);
g_free (markup);
TILE (this)->default_action = action;
menu_item = GTK_WIDGET (GTK_WIDGET (tile_action_get_menu_item (action)));
TILE (this)->actions [DIRECTORY_TILE_ACTION_OPEN] = action;
gtk_container_add (menu_ctnr, menu_item);
/* insert separator */
menu_item = gtk_separator_menu_item_new ();
gtk_container_add (menu_ctnr, menu_item);
/* make rename action */
action = tile_action_new (TILE (this), rename_trigger, _("Rename..."), 0);
TILE (this)->actions[DIRECTORY_TILE_ACTION_RENAME] = action;
menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
gtk_container_add (menu_ctnr, menu_item);
/* insert separator */
menu_item = gtk_separator_menu_item_new ();
gtk_container_add (menu_ctnr, menu_item);
/* make move to trash action */
action = tile_action_new (TILE (this), move_to_trash_trigger, _("Move to Trash"), 0);
TILE (this)->actions[DIRECTORY_TILE_ACTION_MOVE_TO_TRASH] = action;
menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
gtk_container_add (menu_ctnr, menu_item);
/* make delete action */
if (priv->delete_enabled)
{
action = tile_action_new (TILE (this), delete_trigger, _("Delete"), 0);
TILE (this)->actions[DIRECTORY_TILE_ACTION_DELETE] = action;
menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
gtk_container_add (menu_ctnr, menu_item);
}
/* insert separator */
menu_item = gtk_separator_menu_item_new ();
gtk_container_add (menu_ctnr, menu_item);
/* make send to action */
/* Only allow Send To for local files, ideally this would use something
* equivalent to gnome_vfs_uri_is_local, but that method will stat the file and
* that can hang in some conditions. */
if (!strncmp (TILE (this)->uri, "file://", 7))
{
action = tile_action_new (TILE (this), send_to_trigger, _("Send To..."),
TILE_ACTION_OPENS_NEW_WINDOW);
menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
}
else
{
action = NULL;
menu_item = gtk_menu_item_new_with_label (_("Send To..."));
gtk_widget_set_sensitive (menu_item, FALSE);
}
TILE (this)->actions[DIRECTORY_TILE_ACTION_SEND_TO] = action;
gtk_container_add (menu_ctnr, menu_item);
gtk_widget_show_all (GTK_WIDGET (TILE (this)->context_menu));
load_image (this);
accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
if (basename)
atk_object_set_name (accessible, basename);
g_free (basename);
return GTK_WIDGET (this);
}
static void
directory_tile_private_setup (DirectoryTile *tile)
{
DirectoryTilePrivate *priv = DIRECTORY_TILE_GET_PRIVATE (tile);
GConfClient *client;
priv->renaming = FALSE;
priv->delete_enabled =
(gboolean) GPOINTER_TO_INT (get_gconf_value (GCONF_ENABLE_DELETE_KEY));
client = gconf_client_get_default ();
gconf_client_add_dir (client, GCONF_ENABLE_DELETE_KEY_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
priv->gconf_conn_id =
connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile);
g_object_unref (client);
}
static void
directory_tile_init (DirectoryTile *tile)
{
DirectoryTilePrivate *priv = DIRECTORY_TILE_GET_PRIVATE (tile);
priv->basename = NULL;
priv->header_bin = NULL;
priv->icon_name = NULL;
priv->renaming = FALSE;
priv->image_is_broken = TRUE;
priv->delete_enabled = FALSE;
priv->gconf_conn_id = 0;
}
static void
directory_tile_finalize (GObject *g_object)
{
DirectoryTilePrivate *priv = DIRECTORY_TILE_GET_PRIVATE (g_object);
GConfClient *client;
g_free (priv->basename