...
 
Commits (3)
2007-12-21 Scott Reeves <sreeves@novell.com>
* configure.in:
bump rev
2008-10-27 Federico Mena Quintero <federico@novell.com>
2007-12-21 Scott Reeves <sreeves@novell.com>
* configure.in
* main-menu/src/hard-drive-status-tile.c
* main-menu/src/main-menu-ui.c
* main-menu/src/network-status-agent.c
* libslab/application-tile.c
* libslab/slab-gnome-util.c
* libslab/libslab-utils.c
* libslab/directory-tile.c
* libslab/bookmark-agent.c
* libslab/document-tile.c:
Merge in changes (rev 353-361) from openSUSE10.3 branch
Merged from trunk:
* main-menu/src/tile-table.c (TileTablePrivate): Add an
icon_size_group field.
(tile_table_reload): Remember the size group we use for icons,
instead of creating it (and leaking it) every time.
(finalize): Free the icon_size_group.
2007-11-28 Scott Reeves <sreeves@novell.com>
* libslab/app-shell-startup.c
......
2008-11-06 Federico Mena Quintero <federico@novell.com>
Merged from trunk:
Use the new GtkTooltip mechanism rather than the deprecated
GtkTooltips. This also fixes a leak of GtkTooltips objects.
* nameplate-tile.c (NameplateTilePrivate): Removed the "tooltips" field.
(nameplate_tile_set_property): Use gtk_widget_set_tooltip_text()
rather than creating a GtkTooltips object and setting the tooltips there.
(nameplate_tile_get_property): Use gtk_widget_get_tooltip_text()
instead of getting a GtkTooltipsData object.
2008-11-06 Federico Mena Quintero <federico@novell.com>
Merged from trunk:
* bookmark-agent.c (create_app_item): Free the title of the
bookmark file.
2008-10-27 Federico Mena Quintero <federico@novell.com>
Merged from trunk:
Fix some memory leaks:
* tile.c (tile_finalize): Actually destroy the context menu, don't
ref/sink it.
(tile_set_property): Attach the context menu to the tile, don't
just store its pointer.
* nameplate-tile.c (nameplate_tile_finalize): Free the tooltips.
* bookmark-agent.c (create_app_item): Free the URI.
(create_doc_item): Likewise.
(create_dir_item): Likewise.
2008-07-28 Federico Mena Quintero <federico@novell.com>
Merged from trunk:
https://bugzilla.novell.com/show_bug.cgi?id=402256 - Main-menu has
high CPU usage on NIS/NFS home directories.
* document-tile.c (load_image): Don't do thumbnailing ourselves,
as we don't have the threading logic to do it in the background.
Instead, let Nautilus handle thumbnailing by itself.
2007-09-16 Andre Klapper <a9016009@gmx.de>
* system-tile.c: revert to svn revision 339 (=before
......
......@@ -826,43 +826,75 @@ load_recent_store (BookmarkAgent *this)
{
BookmarkAgentPrivate *priv = PRIVATE (this);
GBookmarkFile *store;
#ifdef USE_GTK_RECENT_MANAGER
GtkRecentInfo *info;
gboolean include;
#else
EggRecentModel *model;
EggRecentItem *info;
#endif
gchar **uris = NULL;
GList *items_ordered = NULL;
GList *items;
GList *items_ordered = NULL;
BookmarkItem *item;
gboolean include;
GList *node;
gint i;
GList *node;
#ifdef USE_GTK_RECENT_MANAGER
items = gtk_recent_manager_get_items (gtk_recent_manager_get_default ());
#else
model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
if (priv->type == BOOKMARK_STORE_RECENT_APPS)
egg_recent_model_set_filter_groups (model, "recently-used-apps", NULL);
else
egg_recent_model_set_filter_groups (model, NULL);
store = g_bookmark_file_new ();
g_bookmark_file_load_from_file (store, priv->store_path, NULL);
items = egg_recent_model_get_list (model);
#endif
uris = g_bookmark_file_get_uris (store, NULL);
for (node = items; node; node = node->next) {
#ifdef USE_GTK_RECENT_MANAGER
info = (GtkRecentInfo *) node->data;
for (i = 0; uris && uris [i]; ++i) {
if (priv->type == BOOKMARK_STORE_RECENT_APPS)
include = g_bookmark_file_has_group (store, uris [i], "recently-used-apps", NULL);
include = gtk_recent_info_has_group (info, "recently-used-apps");
else
include = ! g_bookmark_file_get_is_private (store, uris [i], NULL);
include = ! gtk_recent_info_get_private_hint (info);
if (include) {
item = g_new0 (BookmarkItem, 1);
item->uri = g_strdup (uris [i]);
item->mime_type = g_bookmark_file_get_mime_type (store, uris [i], NULL);
item->mtime = g_bookmark_file_get_modified (store, uris [i], NULL);
item->uri = g_strdup (gtk_recent_info_get_uri (info));
item->mime_type = g_strdup (gtk_recent_info_get_mime_type (info));
item->mtime = gtk_recent_info_get_modified (info);
items_ordered = g_list_insert_sorted (items_ordered, item, recent_item_mru_comp_func);
}
gtk_recent_info_unref (info);
#else
info = (EggRecentItem *) node->data;
item = g_new0 (BookmarkItem, 1);
item->uri = egg_recent_item_get_uri (info);
item->mime_type = egg_recent_item_get_mime_type (info);
item->mtime = egg_recent_item_get_timestamp (info);
items_ordered = g_list_append (items_ordered, item);
egg_recent_item_unref (info);
#endif
}
g_strfreev (uris);
g_bookmark_file_free (store);
g_list_free (items);
#ifndef USE_GTK_RECENT_MANAGER
g_object_unref (model);
#endif
g_bookmark_file_free (priv->store);
priv->store = g_bookmark_file_new ();
......@@ -914,8 +946,9 @@ update_user_spec_path (BookmarkAgent *this)
if (use_user_path)
path = g_strdup (priv->user_store_path);
else
else {
path = find_package_data_file (priv->store_filename);
}
if (use_user_path)
status = BOOKMARK_STORE_USER;
......@@ -1065,6 +1098,8 @@ create_doc_item (BookmarkAgent *this, const gchar *uri)
if (libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
g_free (uri_new);
}
static void
......@@ -1150,6 +1185,8 @@ create_dir_item (BookmarkAgent *this, const gchar *uri)
if (uri_new && libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
g_free (uri_new);
}
static void
......
......@@ -22,7 +22,6 @@
#include <glib/gi18n.h>
#include <string.h>
#include <eel/eel-alert-dialog.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
......@@ -39,7 +38,6 @@
#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"
#define GCONF_CONFIRM_DELETE_KEY GCONF_ENABLE_DELETE_KEY_DIR "/confirm_trash"
G_DEFINE_TYPE (DocumentTile, document_tile, NAMEPLATE_TILE_TYPE)
......@@ -418,9 +416,6 @@ load_image (DocumentTile *tile)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GdkPixbuf *thumb;
gchar *thumb_path;
gchar *icon_id = NULL;
gboolean free_icon_id = TRUE;
......@@ -434,32 +429,7 @@ load_image (DocumentTile *tile)
if (! thumbnail_factory)
thumbnail_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
thumb_path = gnome_thumbnail_factory_lookup (thumbnail_factory, TILE (tile)->uri, priv->modified);
if (!thumb_path) {
if (
gnome_thumbnail_factory_can_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->mime_type, priv->modified)
) {
thumb = gnome_thumbnail_factory_generate_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->mime_type);
if (thumb) {
gnome_thumbnail_factory_save_thumbnail (
thumbnail_factory, thumb, TILE (tile)->uri, priv->modified);
icon_id = gnome_thumbnail_factory_lookup (
thumbnail_factory, TILE (tile)->uri, priv->modified);
g_object_unref (thumb);
}
else
gnome_thumbnail_factory_create_failed_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->modified);
}
}
else
icon_id = thumb_path;
icon_id = gnome_thumbnail_factory_lookup (thumbnail_factory, TILE (tile)->uri, priv->modified);
if (! icon_id)
icon_id = gnome_icon_lookup (
......@@ -798,37 +768,12 @@ delete_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
gchar *prompt;
GtkDialog *confirm_dialog;
gint result;
GnomeVFSURI *src_uri;
GList *list = NULL;
GnomeVFSResult retval;
if (GPOINTER_TO_INT (libslab_get_gconf_value (GCONF_CONFIRM_DELETE_KEY))) {
prompt = g_strdup_printf (
_("Are you sure you want to permanently delete \"%s\"?"), priv->basename);
confirm_dialog = GTK_DIALOG (eel_alert_dialog_new (
NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
prompt, _("If you delete an item, it is permanently lost.")));
gtk_dialog_add_button (confirm_dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (confirm_dialog, GTK_STOCK_DELETE, GTK_RESPONSE_YES);
gtk_dialog_set_default_response (GTK_DIALOG (confirm_dialog), GTK_RESPONSE_YES);
result = gtk_dialog_run (confirm_dialog);
gtk_widget_destroy (GTK_WIDGET (confirm_dialog));
g_free (prompt);
if (result != GTK_RESPONSE_YES)
return;
}
src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
list = g_list_append (list, src_uri);
......
......@@ -36,7 +36,6 @@ typedef struct
GtkContainer *image_ctnr;
GtkContainer *header_ctnr;
GtkContainer *subheader_ctnr;
GtkTooltips *tooltips;
} NameplateTilePrivate;
#define NAMEPLATE_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAMEPLATE_TILE_TYPE, NameplateTilePrivate))
......@@ -100,7 +99,6 @@ nameplate_tile_class_init (NameplateTileClass * this_class)
static void
nameplate_tile_init (NameplateTile * this)
{
NAMEPLATE_TILE_GET_PRIVATE (this)->tooltips = NULL;
}
static GObject *
......@@ -117,6 +115,12 @@ nameplate_tile_constructor (GType type, guint n_param, GObjectConstructParam * p
static void
nameplate_tile_finalize (GObject * g_object)
{
NameplateTile *np_tile;
NameplateTilePrivate *priv;
np_tile = NAMEPLATE_TILE (g_object);
priv = NAMEPLATE_TILE_GET_PRIVATE (np_tile);
(*G_OBJECT_CLASS (nameplate_tile_parent_class)->finalize) (g_object);
}
......@@ -124,7 +128,7 @@ static void
nameplate_tile_get_property (GObject * g_object, guint prop_id, GValue * value,
GParamSpec * param_spec)
{
GtkTooltipsData *tooltip;
char *tooltip;
NameplateTile *np_tile = NAMEPLATE_TILE (g_object);
switch (prop_id)
......@@ -141,8 +145,9 @@ nameplate_tile_get_property (GObject * g_object, guint prop_id, GValue * value,
g_value_set_object (value, np_tile->subheader);
break;
case PROP_NAMEPLATE_TOOLTIP:
tooltip = gtk_tooltips_data_get (GTK_WIDGET (np_tile));
g_value_set_string (value, tooltip ? tooltip->tip_text : NULL);
tooltip = gtk_widget_get_tooltip_text (GTK_WIDGET (np_tile));
g_value_set_string (value, tooltip);
g_free (tooltip);
break;
default:
......@@ -229,17 +234,7 @@ nameplate_tile_set_property (GObject * g_object, guint prop_id, const GValue * v
break;
case PROP_NAMEPLATE_TOOLTIP:
if (tooltip) {
if (! priv->tooltips)
priv->tooltips = gtk_tooltips_new ();
gtk_tooltips_set_tip (priv->tooltips, GTK_WIDGET(this), tooltip, tooltip);
gtk_tooltips_enable(priv->tooltips);
}
else
if (priv->tooltips)
gtk_tooltips_disable(priv->tooltips);
gtk_widget_set_tooltip_text (GTK_WIDGET (this), tooltip);
break;
......
......@@ -209,7 +209,7 @@ tile_finalize (GObject * g_object)
if (tile->uri)
g_free (tile->uri);
if (tile->context_menu)
gtk_object_sink (GTK_OBJECT (tile->context_menu));
gtk_widget_destroy (GTK_WIDGET (tile->context_menu));
g_object_unref (priv->double_click_detector);
......@@ -240,17 +240,34 @@ tile_get_property (GObject * g_obj, guint prop_id, GValue * value, GParamSpec *
static void
tile_set_property (GObject * g_obj, guint prop_id, const GValue * value, GParamSpec * param_spec)
{
Tile *tile;
GtkMenu *menu;
if (!IS_TILE (g_obj))
return;
tile = TILE (g_obj);
switch (prop_id)
{
case PROP_TILE_URI:
TILE (g_obj)->uri = g_strdup (g_value_get_string (value));
tile->uri = g_strdup (g_value_get_string (value));
break;
case PROP_TILE_CONTEXT_MENU:
TILE (g_obj)->context_menu = g_value_get_object (value);
menu = g_value_get_object (value);
if (menu == tile->context_menu)
break;
if (tile->context_menu)
gtk_menu_detach (tile->context_menu);
tile->context_menu = menu;
if (tile->context_menu)
gtk_menu_attach_to_widget (tile->context_menu, GTK_WIDGET (tile), NULL);
break;
default:
......
......@@ -29,6 +29,7 @@ typedef struct {
BookmarkAgent *agent;
GList *tiles;
GtkSizeGroup *icon_size_group;
GtkBin **bins;
gint n_bins;
......@@ -120,8 +121,6 @@ tile_table_reload (TileTable *this)
GtkWidget *tile;
gint n_tiles;
GtkSizeGroup *icon_size_group;
GList *node;
gint i;
......@@ -144,7 +143,8 @@ tile_table_reload (TileTable *this)
priv->tiles = NULL;
icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
if (!priv->icon_size_group)
priv->icon_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
for (node = tiles; node; node = node->next) {
tile = GTK_WIDGET (node->data);
......@@ -161,7 +161,7 @@ tile_table_reload (TileTable *this)
priv->tiles = g_list_append (priv->tiles, tile);
if (IS_NAMEPLATE_TILE (tile))
gtk_size_group_add_widget (icon_size_group, NAMEPLATE_TILE (tile)->image);
gtk_size_group_add_widget (priv->icon_size_group, NAMEPLATE_TILE (tile)->image);
}
g_list_free (tiles);
......@@ -341,6 +341,9 @@ finalize (GObject *g_obj)
{
TileTablePrivate *priv = PRIVATE (g_obj);
if (priv->icon_size_group)
g_object_unref (priv->icon_size_group);
g_free (priv->bins);
G_OBJECT_CLASS (tile_table_parent_class)->finalize (g_obj);
......