Index: main-menu/src/main-menu-ui.c
===================================================================
--- main-menu/src/main-menu-ui.c (revision 372)
+++ main-menu/src/main-menu-ui.c (working copy)
@@ -290,13 +290,12 @@
create_system_section (this);
create_status_section (this);
create_more_buttons (this);
- setup_file_tables (this);
setup_lock_down (this);
bind_beagle_search_key (this);
- update_limits (this);
select_page (this);
apply_lockdown_settings (this);
+ setup_file_tables (this);
return this;
}
@@ -1201,20 +1200,12 @@
if (priv->max_total_items < max_total_items_new)
priv->max_total_items = max_total_items_new;
- }
- g_object_get (
- priv->file_tables [USER_DIRS_TABLE],
- "n-rows", & n_rows, "n-columns", & n_cols, NULL);
-
- if (priv->max_total_items < (n_rows * n_cols))
- priv->max_total_items = n_rows * n_cols;
-
- for (i = 0; i < 2; ++i)
g_object_set (
recent_tables [i],
TILE_TABLE_LIMIT_PROP, priv->max_total_items - n_user_bins [i],
NULL);
+ }
}
static void
@@ -1537,9 +1528,9 @@
tile_table_reload (priv->file_tables [USER_APPS_TABLE]);
tile_table_reload (priv->file_tables [RCNT_APPS_TABLE]);
tile_table_reload (priv->file_tables [USER_DOCS_TABLE]);
+ tile_table_reload (priv->file_tables [RCNT_DOCS_TABLE]);
tile_table_reload (priv->file_tables [USER_DIRS_TABLE]);
- update_limits (this);
}
static void
Index: main-menu/src/tile-table.c
===================================================================
--- main-menu/src/tile-table.c (revision 372)
+++ main-menu/src/tile-table.c (working copy)
@@ -101,8 +101,6 @@
priv->create_item_func = uti_func;
priv->item_func_data = data_uti;
- tile_table_reload (TILE_TABLE (this));
-
g_signal_connect (
G_OBJECT (priv->agent), "notify::" BOOKMARK_AGENT_ITEMS_PROP,
G_CALLBACK (agent_notify_cb), this);
Index: libslab/tile.h
===================================================================
--- libslab/tile.h (revision 372)
+++ libslab/tile.h (working copy)
@@ -89,6 +89,7 @@
void (*tile_explicit_disable) (Tile *);
void (*tile_activated) (Tile *, TileEvent *);
+ void (*tile_right_clicked) (Tile *, TileEvent *);
void (*tile_implicit_enable) (Tile *, TileEvent *);
void (*tile_implicit_disable) (Tile *, TileEvent *);
void (*tile_action_triggered) (Tile *, TileEvent *, TileAction *);
Index: libslab/document-tile.c
===================================================================
--- libslab/document-tile.c (revision 372)
+++ libslab/document-tile.c (working copy)
@@ -69,6 +69,7 @@
static void gconf_enable_delete_cb (GConfClient *, guint, GConfEntry *, gpointer);
static void agent_notify_cb (GObject *, GParamSpec *, gpointer);
+static void add_context_menu_cb (GObject *, GParamSpec *, gpointer);
typedef struct
{
@@ -90,6 +91,7 @@
BookmarkStoreStatus store_status;
gboolean is_bookmarked;
gulong notify_signal_id;
+ gulong rightclick_signal_id;
} DocumentTilePrivate;
static GnomeThumbnailFactory *thumbnail_factory = NULL;
@@ -118,13 +120,7 @@
GtkWidget *image;
GtkWidget *header;
GtkWidget *subheader;
- GtkMenu *context_menu;
- GtkContainer *menu_ctnr;
- GtkWidget *menu_item;
-
- TileAction *action;
-
gchar *basename;
GDate *time_stamp;
@@ -165,12 +161,10 @@
tooltip_text = NULL;
g_free (filename);
-
- context_menu = GTK_MENU (gtk_menu_new ());
this = g_object_new (DOCUMENT_TILE_TYPE, "tile-uri", uri, "nameplate-image", image,
"nameplate-header", header, "nameplate-subheader", subheader,
- "nameplate-tooltip", tooltip_text, "context-menu", context_menu, NULL);
+ "nameplate-tooltip", tooltip_text, "context-menu", NULL, NULL);
g_free (uri);
if (tooltip_text)
@@ -186,119 +180,8 @@
TILE (this)->actions = g_new0 (TileAction *, 7);
TILE (this)->n_actions = 7;
+ TILE (this)->actions[DOCUMENT_TILE_ACTION_OPEN_WITH_DEFAULT] = NULL;
- menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
-
- /* make open with default action */
-
- if (priv->default_app) {
- markup = g_markup_printf_escaped (_("Open with \"%s\""),
- priv->default_app->name);
- action = tile_action_new (TILE (this), open_with_default_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)));
- }
- else {
- action = NULL;
- menu_item = gtk_menu_item_new_with_label (_("Open with Default Application"));
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- TILE (this)->actions[DOCUMENT_TILE_ACTION_OPEN_WITH_DEFAULT] = action;
-
- gtk_container_add (menu_ctnr, menu_item);
-
- /* make open in nautilus action */
-
- action = tile_action_new (TILE (this), open_in_file_manager_trigger,
- _("Open in File Manager"), TILE_ACTION_OPENS_NEW_WINDOW);
- TILE (this)->actions[DOCUMENT_TILE_ACTION_OPEN_IN_FILE_MANAGER] = action;
-
- if (!TILE (this)->default_action)
- TILE (this)->default_action = 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 rename action */
-
- action = tile_action_new (TILE (this), rename_trigger, _("Rename..."), 0);
- TILE (this)->actions[DOCUMENT_TILE_ACTION_RENAME] = action;
-
- menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
- 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[DOCUMENT_TILE_ACTION_SEND_TO] = action;
-
- gtk_container_add (menu_ctnr, menu_item);
-
- /* make "add/remove to favorites" action */
-
- action = tile_action_new (TILE (this), user_docs_trigger, NULL, 0);
- TILE (this)->actions [DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU] = action;
-
- update_user_list_menu_item (this);
-
- 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[DOCUMENT_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[DOCUMENT_TILE_ACTION_DELETE] = action;
-
- menu_item = GTK_WIDGET (tile_action_get_menu_item (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));
@@ -317,8 +200,9 @@
document_tile_private_setup (DocumentTile *this)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (this);
+ NameplateTile *nplate = NAMEPLATE_TILE (this);
+ Tile *tile = TILE (nplate);
- GnomeVFSResult result;
GnomeVFSFileInfo *info;
GConfClient *client;
@@ -326,14 +210,8 @@
info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info (TILE (this)->uri, info,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
+ priv->default_app = NULL;
- if (result == GNOME_VFS_OK)
- priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
- else
- priv->default_app = NULL;
-
priv->renaming = FALSE;
gnome_vfs_file_info_unref (info);
@@ -353,6 +231,8 @@
priv->notify_signal_id = g_signal_connect (
G_OBJECT (priv->agent), "notify", G_CALLBACK (agent_notify_cb), this);
+ priv->rightclick_signal_id = g_signal_connect (
+ G_OBJECT (tile), "tile-right-clicked", G_CALLBACK (add_context_menu_cb), this);
}
static void
@@ -360,24 +240,25 @@
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
- priv->basename = NULL;
- priv->mime_type = NULL;
- priv->modified = 0;
+ priv->basename = NULL;
+ priv->mime_type = NULL;
+ priv->modified = 0;
- priv->default_app = NULL;
+ priv->default_app = NULL;
- priv->header_bin = NULL;
+ priv->header_bin = NULL;
- priv->renaming = FALSE;
- priv->image_is_broken = TRUE;
+ priv->renaming = FALSE;
+ priv->image_is_broken = TRUE;
- priv->delete_enabled = FALSE;
- priv->gconf_conn_id = 0;
+ priv->delete_enabled = FALSE;
+ priv->gconf_conn_id = 0;
- priv->agent = NULL;
- priv->store_status = BOOKMARK_STORE_DEFAULT;
- priv->is_bookmarked = FALSE;
- priv->notify_signal_id = 0;
+ priv->agent = NULL;
+ priv->store_status = BOOKMARK_STORE_DEFAULT;
+ priv->is_bookmarked = FALSE;
+ priv->notify_signal_id = 0;
+ priv->rightclick_signal_id = 0;
}
static void
@@ -395,6 +276,9 @@
if (priv->notify_signal_id)
g_signal_handler_disconnect (priv->agent, priv->notify_signal_id);
+ if (priv->rightclick_signal_id)
+ g_signal_handler_disconnect (priv->agent, priv->rightclick_signal_id);
+
g_object_unref (G_OBJECT (priv->agent));
client = gconf_client_get_default ();
@@ -681,12 +565,21 @@
static void
open_in_file_manager_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
+ DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
+
gchar *filename;
gchar *dirname;
gchar *uri;
gchar *cmd;
+ if(!priv->default_app)
+ priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
+ if(priv->default_app) {
+ open_with_default_trigger(tile, event, action);
+ return;
+ }
+
filename = g_filename_from_uri (TILE (tile)->uri, NULL, NULL);
dirname = g_path_get_dirname (filename);
uri = g_filename_to_uri (dirname, NULL, NULL);
@@ -928,3 +821,136 @@
{
update_user_list_menu_item (DOCUMENT_TILE (user_data));
}
+
+static void
+add_context_menu_cb (GObject *g_obj, GParamSpec *pspec, gpointer user_data)
+{
+ DocumentTile *this = DOCUMENT_TILE (user_data);
+ DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (this);
+
+ GtkMenu *context_menu;
+
+ GtkContainer *menu_ctnr;
+ GtkWidget *menu_item;
+
+ TileAction *action;
+
+ gchar *markup;
+
+ if (priv->rightclick_signal_id)
+ g_signal_handler_disconnect (priv->agent, priv->rightclick_signal_id);
+
+ context_menu = GTK_MENU (gtk_menu_new ());
+
+ TILE(this)->context_menu = context_menu;
+
+ menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
+
+ /* make open with default action */
+
+ priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
+ if (priv->default_app) {
+ markup = g_markup_printf_escaped (_("Open with \"%s\""),
+ priv->default_app->name);
+ action = tile_action_new (TILE (this), open_with_default_trigger, markup,
+ TILE_ACTION_OPENS_NEW_WINDOW);
+ g_free (markup);
+ menu_item = GTK_WIDGET (GTK_WIDGET (tile_action_get_menu_item (action)));
+ }
+ else {
+ action = NULL;
+ menu_item = gtk_menu_item_new_with_label (_("Open with Default Application"));
+ gtk_widget_set_sensitive (menu_item, FALSE);
+ }
+
+ gtk_container_add (menu_ctnr, menu_item);
+
+ /* make open in nautilus action */
+
+ action = tile_action_new (TILE (this), open_in_file_manager_trigger,
+ _("Open in File Manager"), TILE_ACTION_OPENS_NEW_WINDOW);
+ TILE (this)->actions[DOCUMENT_TILE_ACTION_OPEN_IN_FILE_MANAGER] = action;
+
+ if (!TILE (this)->default_action)
+ TILE (this)->default_action = 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 rename action */
+
+ action = tile_action_new (TILE (this), rename_trigger, _("Rename..."), 0);
+ TILE (this)->actions[DOCUMENT_TILE_ACTION_RENAME] = action;
+
+ menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
+ 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[DOCUMENT_TILE_ACTION_SEND_TO] = action;
+
+ gtk_container_add (menu_ctnr, menu_item);
+
+ /* make "add/remove to favorites" action */
+
+ action = tile_action_new (TILE (this), user_docs_trigger, NULL, 0);
+ TILE (this)->actions [DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU] = action;
+
+ update_user_list_menu_item (this);
+
+ 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[DOCUMENT_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[DOCUMENT_TILE_ACTION_DELETE] = action;
+
+ menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
+ gtk_container_add (menu_ctnr, menu_item);
+ }
+
+ gtk_widget_show_all (GTK_WIDGET (TILE (this)->context_menu));
+
+ gtk_menu_popup (TILE (this)->context_menu, NULL, NULL, NULL, NULL, 0, 0);
+}
Index: libslab/tile.c
===================================================================
--- libslab/tile.c (revision 372)
+++ libslab/tile.c (working copy)
@@ -74,6 +74,7 @@
TILE_IMPLICIT_ENABLE_SIGNAL,
TILE_IMPLICIT_DISABLE_SIGNAL,
TILE_ACTION_TRIGGERED_SIGNAL,
+ TILE_RIGHT_CLICKED_SIGNAL,
LAST_SIGNAL
};
@@ -115,6 +116,7 @@
this_class->tile_explicit_enable = NULL;
this_class->tile_explicit_disable = NULL;
this_class->tile_activated = NULL;
+ this_class->tile_right_clicked = NULL;
this_class->tile_implicit_enable = NULL;
this_class->tile_implicit_disable = NULL;
this_class->tile_action_triggered = tile_tile_action_triggered;
@@ -152,6 +154,12 @@
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (TileClass, tile_action_triggered),
NULL, NULL, tile_action_triggered_event_marshal, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+
+ tile_signals[TILE_RIGHT_CLICKED_SIGNAL] = g_signal_new ("tile-right-clicked",
+ G_TYPE_FROM_CLASS (this_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (TileClass, tile_right_clicked),
+ NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
}
static GObject *
@@ -306,6 +314,21 @@
g_free (tile_event);
}
+static void
+tile_right_clicked (GtkButton * widget)
+{
+ TileEvent *tile_event;
+
+ tile_event = g_new0 (TileEvent, 1);
+ tile_event->type = TILE_EVENT_ACTIVATED_DOUBLE_CLICK;
+ tile_event->time = gtk_get_current_event_time ();
+
+ g_signal_emit (widget, tile_signals[TILE_RIGHT_CLICKED_SIGNAL], 0, tile_event);
+
+ gtk_button_released (widget);
+ g_free (tile_event);
+}
+
static gboolean
tile_focus_in (GtkWidget * widget, GdkEventFocus * event)
{
@@ -382,6 +405,8 @@
if (GTK_IS_MENU (tile->context_menu))
gtk_menu_popup (tile->context_menu, NULL, NULL, NULL, NULL, event->button,
event->time);
+ else
+ g_signal_emit (tile, tile_signals[TILE_RIGHT_CLICKED_SIGNAL], 0, tile_event);
break;