Commit 6e7fc522 authored by Scott Reeves's avatar Scott Reeves

Merge in changes (rev 353-361) from openSUSE10.3 branch

svn path=/trunk/; revision=371
parent 1c9f4830
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
2007-11-28 Scott Reeves <sreeves@novell.com>
* libslab/app-shell-startup.c
* libslab/app-shell.c:
......
......@@ -38,7 +38,7 @@ PKG_CHECK_MODULES(GLADE, libglade-2.0)
AC_SUBST(GLADE_CFLAGS)
AC_SUBST(GLADE_LIBS)
PKG_CHECK_MODULES(LIBSLAB, [ $COMMON_MODULES gnome-desktop-2.0 librsvg-2.0 libgnome-menu pango ])
PKG_CHECK_MODULES(LIBSLAB, [ $COMMON_MODULES gnome-desktop-2.0 librsvg-2.0 libgnome-menu pango eel-2.0 ])
AC_SUBST(LIBSLAB_CFLAGS)
AC_SUBST(LIBSLAB_LIBS)
......
......@@ -150,11 +150,18 @@ application_tile_new_full (const gchar *desktop_item_id,
desktop_item = load_desktop_item_from_unknown (desktop_item_id);
if (desktop_item)
if (
desktop_item &&
gnome_desktop_item_get_entry_type (desktop_item) == GNOME_DESKTOP_ITEM_TYPE_APPLICATION
)
uri = gnome_desktop_item_get_location (desktop_item);
if (! desktop_item || ! uri)
if (! uri) {
if (desktop_item)
gnome_desktop_item_unref (desktop_item);
return NULL;
}
this = g_object_new (APPLICATION_TILE_TYPE, "tile-uri", uri, NULL);
priv = APPLICATION_TILE_GET_PRIVATE (this);
......
......@@ -826,75 +826,43 @@ load_recent_store (BookmarkAgent *this)
{
BookmarkAgentPrivate *priv = PRIVATE (this);
#ifdef USE_GTK_RECENT_MANAGER
GtkRecentInfo *info;
gboolean include;
#else
EggRecentModel *model;
EggRecentItem *info;
#endif
GBookmarkFile *store;
GList *items;
GList *items_ordered = NULL;
gchar **uris = NULL;
GList *items_ordered = NULL;
BookmarkItem *item;
GList *node;
gboolean include;
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);
items = egg_recent_model_get_list (model);
#endif
store = g_bookmark_file_new ();
g_bookmark_file_load_from_file (store, priv->store_path, NULL);
for (node = items; node; node = node->next) {
#ifdef USE_GTK_RECENT_MANAGER
info = (GtkRecentInfo *) node->data;
uris = g_bookmark_file_get_uris (store, NULL);
for (i = 0; uris && uris [i]; ++i) {
if (priv->type == BOOKMARK_STORE_RECENT_APPS)
include = gtk_recent_info_has_group (info, "recently-used-apps");
include = g_bookmark_file_has_group (store, uris [i], "recently-used-apps", NULL);
else
include = ! gtk_recent_info_get_private_hint (info);
include = ! g_bookmark_file_get_is_private (store, uris [i], NULL);
if (include) {
item = g_new0 (BookmarkItem, 1);
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);
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);
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_list_free (items);
#ifndef USE_GTK_RECENT_MANAGER
g_object_unref (model);
#endif
g_strfreev (uris);
g_bookmark_file_free (store);
g_bookmark_file_free (priv->store);
priv->store = g_bookmark_file_new ();
......@@ -946,9 +914,8 @@ 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;
......
......@@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include <string.h>
#include <eel/eel-alert-dialog.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <libgnomevfs/gnome-vfs.h>
#include <unistd.h>
......@@ -33,6 +34,7 @@
#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 (DirectoryTile, directory_tile, NAMEPLATE_TILE_TYPE)
......@@ -558,12 +560,38 @@ move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
static void
delete_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
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\"?"),
DIRECTORY_TILE_GET_PRIVATE (tile)->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);
......@@ -644,5 +672,5 @@ static void
disown_spawned_child (gpointer user_data)
{
setsid ();
setpgid (0, 0);
setpgrp ();
}
......@@ -22,6 +22,7 @@
#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>
......@@ -38,6 +39,7 @@
#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)
......@@ -796,12 +798,37 @@ 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);
......
......@@ -84,6 +84,7 @@ GnomeDesktopItem *
libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
{
GnomeDesktopItem *item;
gchar *basename;
GError *error = NULL;
......@@ -118,6 +119,21 @@ libslab_gnome_desktop_item_new_from_unknown_id (const gchar *id)
error = NULL;
}
basename = g_strrstr (id, "/");
if (basename) {
basename++;
item = gnome_desktop_item_new_from_basename (basename, 0, &error);
if (! error)
return item;
else {
g_error_free (error);
error = NULL;
}
}
return NULL;
}
......
......@@ -148,43 +148,56 @@ load_desktop_item_from_gconf_key (const gchar * key)
}
GnomeDesktopItem *
load_desktop_item_from_unknown (const gchar * id)
load_desktop_item_from_unknown (const gchar *id)
{
GnomeDesktopItem *item;
GError *error;
gchar *basename;
GError *error = NULL;
error = NULL;
item = gnome_desktop_item_new_from_uri (id, 0, &error);
if (!error)
if (! error)
return item;
else
{
else {
g_error_free (error);
error = NULL;
}
item = gnome_desktop_item_new_from_file (id, 0, &error);
if (!error)
if (! error)
return item;
else
{
else {
g_error_free (error);
error = NULL;
}
item = gnome_desktop_item_new_from_basename (id, 0, &error);
if (!error)
if (! error)
return item;
else
{
else {
g_error_free (error);
error = NULL;
}
basename = g_strrstr (id, "/");
if (basename) {
basename++;
item = gnome_desktop_item_new_from_basename (basename, 0, &error);
if (! error)
return item;
else {
g_error_free (error);
error = NULL;
}
}
return NULL;
}
......
......@@ -40,7 +40,7 @@
#define TIMEOUT_KEY_DIR "/apps/procman"
#define TIMEOUT_KEY "/apps/procman/disks_interval"
#define FILE_BROWSER_GCONF_KEY "/desktop/gnome/applications/main-menu/file_browser"
#define SYSTEM_MONITOR_GCONF_KEY "/desktop/gnome/applications/main-menu/system_monitor"
G_DEFINE_TYPE (HardDriveStatusTile, hard_drive_status_tile, NAMEPLATE_TILE_TYPE)
......@@ -459,7 +459,7 @@ open_hard_drive_tile (Tile * tile, TileEvent * event, TileAction * action)
gchar *fb_ditem_id;
fb_ditem_id = (gchar *) libslab_get_gconf_value (FILE_BROWSER_GCONF_KEY);
fb_ditem_id = (gchar *) libslab_get_gconf_value (SYSTEM_MONITOR_GCONF_KEY);
if (! fb_ditem_id)
fb_ditem_id = g_strdup ("nautilus.desktop");
......
......@@ -1008,10 +1008,30 @@ item_to_dir_tile (BookmarkItem *item, gpointer data)
static Tile *
item_to_system_tile (BookmarkItem *item, gpointer data)
{
Tile *tile;
gchar *basename;
if (app_is_in_blacklist (item->uri))
return NULL;
return TILE (system_tile_new (item->uri, item->title));
tile = TILE (system_tile_new (item->uri, item->title));
if (tile)
return tile;
basename = g_strrstr (item->uri, "/");
if (basename)
basename++;
else
basename = item->uri;
if (! libslab_strcmp (basename, "control-center.desktop"))
tile = TILE (system_tile_new ("gnomecc.desktop", item->title));
else if (! libslab_strcmp (basename, "zen-installer.desktop"))
tile = TILE (system_tile_new ("package-manager.desktop", item->title));
return tile;
}
static BookmarkItem *
......@@ -1607,8 +1627,6 @@ panel_button_clicked_cb (GtkButton *button, gpointer user_data)
GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (button);
DoubleClickDetector *detector;
GTimeVal t_curr;
guint32 t_curr_ms;
gboolean visible;
......@@ -1616,14 +1634,11 @@ panel_button_clicked_cb (GtkButton *button, gpointer user_data)
detector = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (toggle), "double-click-detector"));
g_get_current_time (& t_curr);
t_curr_ms = 1000 * t_curr.tv_sec + t_curr.tv_usec / 1000;
visible = GTK_WIDGET_VISIBLE (priv->slab_window);
if (! double_click_detector_is_double_click (detector, t_curr_ms, TRUE)) {
if (! double_click_detector_is_double_click (detector, gtk_get_current_event_time (), TRUE)) {
if (! visible)
gtk_window_present_with_time (GTK_WINDOW (priv->slab_window), t_curr_ms);
gtk_window_present_with_time (GTK_WINDOW (priv->slab_window), gtk_get_current_event_time ());
else
gtk_widget_hide (priv->slab_window);
......
......@@ -35,6 +35,8 @@ typedef struct
{
DBusGConnection *nm_conn;
DBusGProxy *nm_proxy;
guint state_curr;
} NetworkStatusAgentPrivate;
#define NETWORK_STATUS_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NETWORK_STATUS_AGENT_TYPE, NetworkStatusAgentPrivate))
......@@ -88,6 +90,7 @@ network_status_agent_init (NetworkStatusAgent * agent)
priv->nm_conn = NULL;
priv->nm_proxy = NULL;
priv->state_curr = 0;
}
NetworkStatusAgent *
......@@ -324,8 +327,15 @@ nm_get_device_info (NetworkStatusAgent * agent, DBusGProxy * device)
static void
nm_state_change_cb (DBusGProxy * proxy, guint state, gpointer user_data)
{
g_signal_emit (NETWORK_STATUS_AGENT (user_data),
network_status_agent_signals[STATUS_CHANGED], 0);
NetworkStatusAgent *this = NETWORK_STATUS_AGENT (user_data);
NetworkStatusAgentPrivate *priv = NETWORK_STATUS_AGENT_GET_PRIVATE (this);
if (priv->state_curr == state)
return;
priv->state_curr = state;
g_signal_emit (this, network_status_agent_signals [STATUS_CHANGED], 0);
}
static DBusHandlerResult
......@@ -460,4 +470,3 @@ gtop_get_first_active_device_info ()
g_strfreev (networks);
return info;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment