[gnome-panel] panel: Migrate settings: menu buttons to gnome-control-center launcher
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Migrate settings: menu buttons to gnome-control-center launcher
- Date: Tue, 1 Feb 2011 13:41:04 +0000 (UTC)
commit 5a661d79dab91a24de783094e0a9077dbacecfbb
Author: Vincent Untz <vuntz gnome org>
Date: Tue Feb 1 14:39:08 2011 +0100
panel: Migrate settings: menu buttons to gnome-control-center launcher
Since we don't use a menu structure for the capplets, it makes no sense
to keep supporting the settings: menu buttons.
This is based on 15dae2739023ba5da982520ef089618fe36be6e9 (which was
reverted in ee28fd5510514f0061722d09e9ef6757f81a4562): we already did
that a few years ago :-)
gnome-panel/panel-compatibility.c | 20 ++++++++++++++++++++
gnome-panel/panel-compatibility.h | 2 ++
gnome-panel/panel-menu-button.c | 29 +++++++++++++++++++++--------
3 files changed, 43 insertions(+), 8 deletions(-)
---
diff --git a/gnome-panel/panel-compatibility.c b/gnome-panel/panel-compatibility.c
index 128143d..359e732 100644
--- a/gnome-panel/panel-compatibility.c
+++ b/gnome-panel/panel-compatibility.c
@@ -1101,6 +1101,26 @@ panel_compatibility_migrate_screenshot_action (GConfClient *client,
panel_profile_add_to_list (PANEL_GCONF_OBJECTS, id);
}
+void
+panel_compatiblity_migrate_settings_menu_button (GConfClient *client,
+ const char *id)
+{
+ const char *key;
+
+ panel_profile_remove_from_list (PANEL_GCONF_OBJECTS, id);
+
+ key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id,
+ "launcher_location");
+ gconf_client_set_string (client, key,
+ "gnome-control-center.desktop", NULL);
+
+ key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id,
+ "object_type");
+ gconf_client_set_string (client, key, "launcher-object", NULL);
+
+ panel_profile_add_to_list (PANEL_GCONF_OBJECTS, id);
+}
+
gchar *
panel_compatibility_get_applet_iid (const gchar *id)
{
diff --git a/gnome-panel/panel-compatibility.h b/gnome-panel/panel-compatibility.h
index c338a58..e079ea7 100644
--- a/gnome-panel/panel-compatibility.h
+++ b/gnome-panel/panel-compatibility.h
@@ -36,6 +36,8 @@ void panel_compatibility_migrate_applications_scheme (GConfClient *client,
const char *key);
void panel_compatibility_migrate_screenshot_action (GConfClient *client,
const char *id);
+void panel_compatiblity_migrate_settings_menu_button (GConfClient *client,
+ const char *id);
gchar *panel_compatibility_get_applet_iid (const gchar *id);
diff --git a/gnome-panel/panel-menu-button.c b/gnome-panel/panel-menu-button.c
index 7c29ae6..8db7f77 100644
--- a/gnome-panel/panel-menu-button.c
+++ b/gnome-panel/panel-menu-button.c
@@ -36,6 +36,7 @@
#include <libpanel-util/panel-show.h>
#include "applet.h"
+#include "panel-compatibility.h"
#include "panel-widget.h"
#include "panel-util.h"
#include "panel-profile.h"
@@ -75,7 +76,8 @@ typedef struct {
static MenuPathRootItem root_items [] = {
{ APPLICATIONS_MENU, "applications", "applications.menu" },
- { SETTINGS_MENU, "settings", "settings.menu" }
+ /* compatibility with GNOME < 2.91.0 */
+ { SETTINGS_MENU, "settings", NULL }
};
struct _PanelMenuButtonPrivate {
@@ -872,19 +874,30 @@ panel_menu_button_load_from_gconf (PanelWidget *panel,
gboolean exactpos,
const char *id)
{
- GConfClient *client;
- const char *key;
- char *menu_path;
- char *custom_icon;
- char *tooltip;
- gboolean use_menu_path;
- gboolean use_custom_icon;
+ GConfClient *client;
+ char *scheme;
+ MenuPathRoot root;
+ const char *key;
+ char *menu_path;
+ char *custom_icon;
+ char *tooltip;
+ gboolean use_menu_path;
+ gboolean use_custom_icon;
client = panel_gconf_get_client ();
key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "menu_path");
menu_path = gconf_client_get_string (client, key, NULL);
+ scheme = g_strndup (menu_path, strcspn (menu_path, ":"));
+ root = panel_menu_scheme_to_path_root (scheme);
+ g_free (scheme);
+ if (root == SETTINGS_MENU) {
+ panel_compatiblity_migrate_settings_menu_button (client, id);
+ g_free (menu_path);
+ return;
+ }
+
key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "custom_icon");
custom_icon = gconf_client_get_string (client, key, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]