[gnome-control-center/gnome-2-32] Update libslab from master
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-2-32] Update libslab from master
- Date: Sun, 22 Aug 2010 20:14:58 +0000 (UTC)
commit e369cec3bfb9df4ced232762a3a8297ec7016458
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 10 12:07:03 2010 +0000
Update libslab from master
https://bugzilla.gnome.org/show_bug.cgi?id=612417
libslab/app-shell.c | 16 +++++++----
libslab/application-tile.c | 2 +-
libslab/bookmark-agent.c | 59 +++++++++++++++++++++++++++++++++++--------
libslab/bookmark-agent.h | 3 +-
libslab/directory-tile.c | 4 +-
libslab/document-tile.c | 49 +++++++++++++++++++++++++++++------
libslab/document-tile.h | 7 +++-
libslab/shell-window.c | 1 -
8 files changed, 108 insertions(+), 33 deletions(-)
---
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index a44edba..1f4eb8b 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -728,7 +728,7 @@ show_no_results_message (AppShellData * app_data, GtkWidget * containing_vbox)
gchar *markup;
gchar *str1;
gchar *str2;
-
+
if (!app_data->filtered_out_everything_widget)
{
GtkWidget *hbox;
@@ -750,14 +750,16 @@ show_no_results_message (AppShellData * app_data, GtkWidget * containing_vbox)
gtk_container_add (GTK_CONTAINER (app_data->filtered_out_everything_widget), hbox);
}
- str1 = g_strdup_printf ("<b>%s</b>", app_data->filter_string);
+ str1 = g_markup_printf_escaped ("<b>%s</b>", app_data->filter_string);
str2 = g_strdup_printf (_("Your filter \"%s\" does not match any items."), str1);
- markup = g_markup_printf_escaped ("<span size=\"large\"><b>%s</b></span>\n\n%s",
+ markup = g_strdup_printf ("<span size=\"large\"><b>%s</b></span>\n\n%s",
_("No matches found."), str2);
gtk_label_set_text (app_data->filtered_out_everything_widget_label, markup);
gtk_label_set_use_markup (app_data->filtered_out_everything_widget_label, TRUE);
gtk_box_pack_start (GTK_BOX (containing_vbox), app_data->filtered_out_everything_widget,
TRUE, TRUE, 0);
+ g_free (str1);
+ g_free (str2);
g_free (markup);
}
@@ -811,7 +813,7 @@ populate_application_category_section (AppShellData * app_data, SlabSection * se
app_resizer_layout_table_default (APP_RESIZER (app_data->category_layout), table,
launcher_list);
-
+
}
gboolean
@@ -860,7 +862,7 @@ generate_categories (AppShellData * app_data)
GMenuTreeDirectory *root_dir;
GSList *contents, *l;
gboolean need_misc = FALSE;
-
+
if (!app_data->tree)
{
app_data->tree = gmenu_tree_lookup (app_data->menu_name, GMENU_TREE_FLAGS_NONE);
@@ -869,6 +871,8 @@ generate_categories (AppShellData * app_data)
root_dir = gmenu_tree_get_root_directory (app_data->tree);
if (root_dir)
contents = gmenu_tree_directory_get_contents (root_dir);
+ else
+ contents = NULL;
if (!root_dir || !contents)
{
GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -909,7 +913,7 @@ generate_categories (AppShellData * app_data)
g_hash_table_destroy (app_data->hash);
app_data->hash = NULL;
}
-
+
gmenu_tree_item_unref (root_dir);
if (app_data->new_apps && (app_data->new_apps->max_items > 0))
diff --git a/libslab/application-tile.c b/libslab/application-tile.c
index 7767e8a..e23c864 100644
--- a/libslab/application-tile.c
+++ b/libslab/application-tile.c
@@ -471,7 +471,7 @@ create_header (const gchar *name)
header = gtk_label_new (name);
- gtk_label_set_ellipsize (GTK_LABEL (header), PANGO_ELLIPSIZE_END);
+ gtk_label_set_line_wrap (GTK_LABEL (header), TRUE);
gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
g_signal_connect (
diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c
index bdd418a..57932c2 100644
--- a/libslab/bookmark-agent.c
+++ b/libslab/bookmark-agent.c
@@ -220,20 +220,51 @@ bookmark_agent_move_item (BookmarkAgent *this, const gchar *uri, const gchar *ur
}
void
-bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri)
+bookmark_agent_purge_items (BookmarkAgent *this)
{
BookmarkAgentPrivate *priv = PRIVATE (this);
- gint rank;
-
GError *error = NULL;
gchar **uris = NULL;
- gint rank_i;
+ gsize uris_len;
gint i;
+ g_return_if_fail (priv->user_modifiable);
+
+ uris = g_bookmark_file_get_uris (priv->store, &uris_len);
+ if (TYPE_IS_RECENT (priv->type)) {
+ for (i = 0; i < uris_len; i++) {
+ gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uris [i], & error);
+
+ if (error)
+ libslab_handle_g_error (
+ & error, "%s: unable to remove [%s] from %s.",
+ G_STRFUNC, priv->store_path, uris [i]);
+ }
+ } else {
+ for (i = 0; i < uris_len; i++) {
+ g_bookmark_file_remove_item (priv->store, uris [i], NULL);
+ }
+ save_store (this);
+ }
+ g_strfreev (uris);
+}
+
+void
+bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri)
+{
+ BookmarkAgentPrivate *priv = PRIVATE (this);
+ gint rank;
- g_return_if_fail (priv->user_modifiable);
+ GError *error = NULL;
+
+ gchar **uris = NULL;
+ gint rank_i;
+ gint i;
+
+
+ g_return_if_fail (priv->user_modifiable);
if (! bookmark_agent_has_item (this, uri))
return;
@@ -1070,7 +1101,9 @@ create_doc_item (BookmarkAgent *this, const gchar *uri)
if (! (strcmp (uri, "BLANK_SPREADSHEET") && strcmp (uri, "BLANK_DOCUMENT"))) {
- dir = g_build_filename (g_get_home_dir (), "Documents", NULL);
+ dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
+ if (! dir)
+ dir = g_build_filename (g_get_home_dir (), "Documents", NULL);
if (! strcmp (uri, "BLANK_SPREADSHEET")) {
g_bookmark_file_set_title (priv->store, uri, "BLANK_SPREADSHEET");
@@ -1132,20 +1165,24 @@ create_dir_item (BookmarkAgent *this, const gchar *uri)
if (! strcmp (uri, "HOME")) {
uri_new = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
- name = _("Home");
- icon = "gnome-fs-home";
+ name = g_strdup (C_("Home folder", "Home"));
+ icon = "user-home";
}
else if (! strcmp (uri, "DOCUMENTS")) {
- path = g_build_filename (g_get_home_dir (), "Documents", NULL);
+ path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
+ if (! path)
+ path = g_build_filename (g_get_home_dir (), "Documents", NULL);
name = _("Documents");
uri_new = g_filename_to_uri (path, NULL, NULL);
g_free (path);
}
else if (! strcmp (uri, "DESKTOP")) {
- path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
+ path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+ if (! path)
+ path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
name = _("Desktop");
uri_new = g_filename_to_uri (path, NULL, NULL);
- icon = "gnome-fs-desktop";
+ icon = "user-desktop";
g_free (path);
}
else if (! strcmp (uri, "file:///")) {
diff --git a/libslab/bookmark-agent.h b/libslab/bookmark-agent.h
index 391389e..5f7e9cc 100644
--- a/libslab/bookmark-agent.h
+++ b/libslab/bookmark-agent.h
@@ -80,7 +80,8 @@ void bookmark_agent_move_item (BookmarkAgent *this, const gchar *u
void bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri);
void bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris);
-void bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
+void bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
+void bookmark_agent_purge_items (BookmarkAgent *this);
void bookmark_item_free (BookmarkItem *item);
diff --git a/libslab/directory-tile.c b/libslab/directory-tile.c
index 6d94aef..c9d0cf1 100644
--- a/libslab/directory-tile.c
+++ b/libslab/directory-tile.c
@@ -332,7 +332,7 @@ load_image (DirectoryTile *tile)
if (priv->icon_name)
icon_name = priv->icon_name;
else
- icon_name = "gnome-fs-directory";
+ icon_name = "folder";
priv->image_is_broken = slab_load_image (
GTK_IMAGE (NAMEPLATE_TILE (tile)->image), GTK_ICON_SIZE_DND, icon_name);
@@ -624,7 +624,7 @@ static void
disown_spawned_child (gpointer user_data)
{
setsid ();
- setpgrp ();
+ setpgid (0, 0);
}
static void
diff --git a/libslab/document-tile.c b/libslab/document-tile.c
index 26fdc36..94e5033 100644
--- a/libslab/document-tile.c
+++ b/libslab/document-tile.c
@@ -55,6 +55,8 @@ static void open_with_default_trigger (Tile *, TileEvent *, TileAction *);
static void open_in_file_manager_trigger (Tile *, TileEvent *, TileAction *);
static void rename_trigger (Tile *, TileEvent *, TileAction *);
static void move_to_trash_trigger (Tile *, TileEvent *, TileAction *);
+static void remove_recent_item (Tile *, TileEvent *, TileAction *);
+static void purge_recent_items (Tile *, TileEvent *, TileAction *);
static void delete_trigger (Tile *, TileEvent *, TileAction *);
static void user_docs_trigger (Tile *, TileEvent *, TileAction *);
static void send_to_trigger (Tile *, TileEvent *, TileAction *);
@@ -109,14 +111,14 @@ document_tile_new_force_icon (const gchar *in_uri, const gchar *mime_type, time_
DocumentTile *this;
DocumentTilePrivate *priv;
- this = (DocumentTile *) document_tile_new (in_uri, mime_type, modified);
+ this = (DocumentTile *) document_tile_new (BOOKMARK_STORE_USER_DOCS, in_uri, mime_type, modified);
priv = DOCUMENT_TILE_GET_PRIVATE (this);
priv->force_icon_name = g_strdup (icon);
return GTK_WIDGET (this);
}
GtkWidget *
-document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
+document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *in_uri, const gchar *mime_type, time_t modified)
{
DocumentTile *this;
DocumentTilePrivate *priv;
@@ -179,11 +181,11 @@ document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
priv->mime_type = g_strdup (mime_type);
priv->modified = modified;
priv->header_bin = GTK_BIN (header);
+ priv->agent = bookmark_agent_get_instance (bookmark_store_type);
document_tile_private_setup (this);
-
- TILE (this)->actions = g_new0 (TileAction *, 7);
- TILE (this)->n_actions = 7;
+ TILE (this)->actions = g_new0 (TileAction *, DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS);
+ TILE (this)->n_actions = DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS;
menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
@@ -297,6 +299,23 @@ document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
gtk_container_add (menu_ctnr, menu_item);
}
+ if (!priv->is_bookmarked) {
+ /* clean item from menu */
+ action = tile_action_new (TILE (this), remove_recent_item, _("Remove from recent menu"), 0);
+ TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ITEM] = action;
+
+ menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
+ gtk_container_add (menu_ctnr, menu_item);
+
+ /* clean all the items from menu */
+
+ action = tile_action_new (TILE (this), purge_recent_items, _("Purge all the recent items"), 0);
+ TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ALL] = 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));
accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
@@ -343,8 +362,6 @@ document_tile_private_setup (DocumentTile *this)
g_object_unref (client);
- priv->agent = bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS);
-
priv->notify_signal_id = g_signal_connect (
G_OBJECT (priv->agent), "notify", G_CALLBACK (agent_notify_cb), this);
}
@@ -425,7 +442,7 @@ load_image (DocumentTile *tile)
if (priv->force_icon_name)
icon_id = priv->force_icon_name;
else
- icon_id = "gnome-fs-regular";
+ icon_id = "text-x-preview";
free_icon_id = FALSE;
goto exit;
@@ -715,7 +732,7 @@ update_user_list_menu_item (DocumentTile *this)
if (! action)
return;
- priv->is_bookmarked = bookmark_agent_has_item (priv->agent, TILE (this)->uri);
+ priv->is_bookmarked = bookmark_agent_has_item (bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS), TILE (this)->uri);
if (priv->is_bookmarked)
tile_action_set_menu_item_label (action, _("Remove from Favorites"));
@@ -943,6 +960,20 @@ rename_trigger (Tile *tile, TileEvent *event, TileAction *action)
}
static void
+remove_recent_item (Tile *tile, TileEvent *event, TileAction *action)
+{
+ DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
+ bookmark_agent_remove_item (priv->agent, TILE (tile)->uri);
+}
+
+static void
+purge_recent_items (Tile *tile, TileEvent *event, TileAction *action)
+{
+ DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
+ bookmark_agent_purge_items (priv->agent);
+}
+
+static void
move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
diff --git a/libslab/document-tile.h b/libslab/document-tile.h
index 0e2e83d..6503674 100644
--- a/libslab/document-tile.h
+++ b/libslab/document-tile.h
@@ -24,6 +24,7 @@
#include <time.h>
#include "nameplate-tile.h"
+#include "bookmark-agent.h"
G_BEGIN_DECLS
@@ -49,11 +50,13 @@ typedef struct {
#define DOCUMENT_TILE_ACTION_DELETE 4
#define DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU 5
#define DOCUMENT_TILE_ACTION_SEND_TO 6
-#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS 7 /* must be last entry and equal to the number of actions */
+#define DOCUMENT_TILE_ACTION_CLEAN_ITEM 7
+#define DOCUMENT_TILE_ACTION_CLEAN_ALL 8
+#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS 9 /* must be last entry and equal to the number of actions */
GType document_tile_get_type (void);
-GtkWidget *document_tile_new (const gchar *uri, const gchar *mime_type, time_t modified);
+GtkWidget *document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *uri, const gchar *mime_type, time_t modified);
//If you want to show a icon instead of a thumbnail
GtkWidget *document_tile_new_force_icon (const gchar *uri, const gchar *mime_type, time_t modified, const gchar *icon);
diff --git a/libslab/shell-window.c b/libslab/shell-window.c
index 5202229..23656a5 100644
--- a/libslab/shell-window.c
+++ b/libslab/shell-window.c
@@ -26,7 +26,6 @@
static void shell_window_class_init (ShellWindowClass *);
static void shell_window_init (ShellWindow *);
-static void shell_window_destroy (GtkObject *);
static void shell_window_handle_size_request (GtkWidget * widget, GtkRequisition * requisition,
AppShellData * data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]