Commit 0ba77552 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz
Browse files

Use new glib API where it makes sense.

2007-06-14  Vincent Untz  <vuntz@gnome.org>

	Use new glib API where it makes sense.

	* applet.c: (panel_applet_save_position): use g_timeout_add_seconds()
	* menu.c: (add_app_to_desktop): use g_get_user_special_dir() to know
	where's the desktop
	* panel-ditem-editor.c: (panel_ditem_editor_changed),
	(panel_ditem_editor_revert): use g_timeout_add_seconds()
	* panel-menu-items.c: (activate_uri): small update
	(activate_desktop_uri): new,  use g_get_user_special_dir() to know
	where's the desktop
	(panel_place_menu_item_create_menu): use activate_desktop_uri() for
	the desktop menu item

svn path=/trunk/; revision=10454
parent 221e37e0
2007-06-14 Vincent Untz <vuntz@gnome.org>
Use new glib API where it makes sense.
* applet.c: (panel_applet_save_position): use g_timeout_add_seconds()
* menu.c: (add_app_to_desktop): use g_get_user_special_dir() to know
where's the desktop
* panel-ditem-editor.c: (panel_ditem_editor_changed),
(panel_ditem_editor_revert): use g_timeout_add_seconds()
* panel-menu-items.c: (activate_uri): small update
(activate_desktop_uri): new, use g_get_user_special_dir() to know
where's the desktop
(panel_place_menu_item_create_menu): use activate_desktop_uri() for
the desktop menu item
==================== 2.19.3 ====================
 
2007-05-26 Vincent Untz <vuntz@gnome.org>
......
......@@ -1037,9 +1037,9 @@ panel_applet_save_position (AppletInfo *applet_info,
if (!immediate) {
if (!queued_position_source)
queued_position_source =
g_timeout_add (1000,
(GSourceFunc) panel_applet_position_save_timeout,
NULL);
g_timeout_add_seconds (1,
(GSourceFunc) panel_applet_position_save_timeout,
NULL);
if (!g_slist_find (queued_position_saves, applet_info))
queued_position_saves =
......
......@@ -636,7 +636,7 @@ add_app_to_desktop (GtkWidget *item,
if (desktop_is_home_dir ()) {
target_dir = g_build_filename (g_get_home_dir (), NULL);
} else {
target_dir = g_build_filename (g_get_home_dir (), "Desktop", NULL);
target_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
}
target_uri = panel_make_unique_desktop_uri (target_dir, source_uri);
......
......@@ -82,8 +82,8 @@ struct _PanelDItemEditorPrivate
char *icon_theme_dir;
};
/* Time in milliseconds after which we save the file on the disk */
#define SAVE_FREQUENCY 2000
/* Time in seconds after which we save the file on the disk */
#define SAVE_FREQUENCY 2
enum {
REVERT_BUTTON
......@@ -821,9 +821,10 @@ panel_ditem_editor_changed (PanelDItemEditor *dialog)
if (dialog->priv->save_timeout != 0)
g_source_remove (dialog->priv->save_timeout);
dialog->priv->save_timeout = g_timeout_add (SAVE_FREQUENCY,
panel_ditem_editor_save_timeout,
dialog);
dialog->priv->save_timeout = g_timeout_add_seconds (
SAVE_FREQUENCY,
panel_ditem_editor_save_timeout,
dialog);
/* We can revert to the original state */
if (dialog->priv->revert_key_file != NULL)
......@@ -1544,9 +1545,10 @@ panel_ditem_editor_revert (PanelDItemEditor *dialog)
if (dialog->priv->save_timeout != 0)
g_source_remove (dialog->priv->save_timeout);
dialog->priv->save_timeout = g_timeout_add (SAVE_FREQUENCY,
panel_ditem_editor_save_timeout,
dialog);
dialog->priv->save_timeout = g_timeout_add_seconds (
SAVE_FREQUENCY,
panel_ditem_editor_save_timeout,
dialog);
}
}
......
......@@ -90,8 +90,8 @@ struct _PanelDesktopMenuItemPrivate {
static GnomeVFSVolumeMonitor *volume_monitor = NULL;
static void
activate_uri (GtkWidget *menuitem,
char *path)
activate_uri (GtkWidget *menuitem,
const char *path)
{
GError *error = NULL;
GdkScreen *screen;
......@@ -127,6 +127,14 @@ activate_uri (GtkWidget *menuitem,
}
g_free (url);
}
static void
activate_desktop_uri (GtkWidget *menuitem,
gpointer data)
{
activate_uri (menuitem,
g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
}
static void
panel_menu_items_append_from_desktop (GtkWidget *menu,
......@@ -572,11 +580,6 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
if (!gconf_client_get_bool (panel_gconf_get_client (),
DESKTOP_IS_HOME_DIR_KEY,
NULL)) {
char *uri;
uri = gnome_vfs_make_uri_from_input_with_dirs ("Desktop",
GNOME_VFS_MAKE_URI_DIR_HOMEDIR);
panel_menu_items_append_place_item (
PANEL_ICON_DESKTOP,
/* Translators: Desktop is used here as in
......@@ -586,10 +589,8 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
Q_("Desktop Folder|Desktop"),
_("Open the contents of your desktop in a folder"),
places_menu,
G_CALLBACK (activate_uri),
uri);
g_free (uri);
G_CALLBACK (activate_desktop_uri),
NULL);
}
panel_place_menu_item_append_gtk_bookmarks (places_menu);
......
Supports Markdown
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