[gnome-applets/wip/gnome-3.10+: 1/2] update for new libpanel-applet version
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/gnome-3.10+: 1/2] update for new libpanel-applet version
- Date: Tue, 7 Oct 2014 22:15:10 +0000 (UTC)
commit fa7f7a0484413885f8efc21afe33a335ca0e16d2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Oct 8 01:12:34 2014 +0300
update for new libpanel-applet version
accessx-status/accessx-status-applet-menu.xml | 19 +++-
accessx-status/applet.c | 63 +++++++-------
battstat/battstat-applet-menu.xml | 18 +++-
battstat/battstat.h | 2 +-
battstat/battstat_applet.c | 52 ++++++------
battstat/properties.c | 8 ++-
charpick/charpick-applet-menu.xml | 18 +++-
charpick/charpick.c | 57 +++++++-------
charpick/charpick.h | 5 +-
charpick/properties.c | 7 +-
configure.ac | 8 +-
cpufreq/cpufreq-applet-menu.xml | 18 +++-
cpufreq/src/cpufreq-applet.c | 68 ++++++++-------
drivemount/drivemount-applet-menu.xml | 13 +++-
drivemount/drivemount.c | 42 +++++-----
geyes/geyes-applet-menu.xml | 19 +++-
geyes/geyes.c | 57 +++++++-------
geyes/geyes.h | 5 +-
geyes/themes.c | 6 +-
gweather/gweather-applet-menu.xml | 31 ++++++--
gweather/gweather-applet.c | 90 +++++++++++----------
invest-applet/data/invest-applet-menu.xml | 25 +++++-
invest-applet/invest/applet.py | 41 ++++++----
mini-commander/src/about.c | 5 +-
mini-commander/src/about.h | 5 +-
mini-commander/src/help.c | 6 +-
mini-commander/src/help.h | 5 +-
mini-commander/src/mini-commander-applet-menu.xml | 18 +++-
mini-commander/src/mini-commander_applet.c | 42 +++++-----
mini-commander/src/preferences.c | 7 +-
mini-commander/src/preferences.h | 5 +-
mixer/applet.c | 85 +++++++++----------
mixer/applet.h | 2 +-
mixer/mixer-applet-menu.xml | 31 ++++++--
modemlights/modem-applet-menu.xml | 25 +++++-
modemlights/modem-applet.c | 89 +++++++++++----------
multiload/global.h | 5 +-
multiload/main.c | 73 ++++++++---------
multiload/multiload-applet-menu.xml | 26 +++++--
multiload/properties.c | 6 +-
po/POTFILES.in | 15 ++++
stickynotes/stickynotes-applet-menu.xml | 42 +++++++---
stickynotes/stickynotes_applet.c | 82 ++++++-------------
stickynotes/stickynotes_applet.h | 2 +-
stickynotes/stickynotes_applet_callbacks.c | 28 +++++--
stickynotes/stickynotes_applet_callbacks.h | 17 ++--
trashapplet/src/trashapplet.c | 86 +++++++++++---------
trashapplet/trashapplet-menu.xml | 26 +++++--
windowpicker/data/menu.xml | 12 +++-
windowpicker/src/applet.c | 64 +++++++++------
50 files changed, 859 insertions(+), 622 deletions(-)
---
diff --git a/accessx-status/accessx-status-applet-menu.xml b/accessx-status/accessx-status-applet-menu.xml
index f4d1c26..2fc1d2f 100644
--- a/accessx-status/accessx-status-applet-menu.xml
+++ b/accessx-status/accessx-status-applet-menu.xml
@@ -1,5 +1,14 @@
-<menuitem name="Item 1" action="Dialog" />
-<menuitem name="Item 2" action="Help" />
-<menuitem name="Item 3" action="About" />
-
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Keyboard Accessibility Preferences</attribute>
+ <attribute name="action">accessx.dialog</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">accessx.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">accessx.about</attribute>
+ </item>
+</section>
diff --git a/accessx-status/applet.c b/accessx-status/applet.c
index 5d10a37..023ea90 100644
--- a/accessx-status/applet.c
+++ b/accessx-status/applet.c
@@ -118,9 +118,11 @@ static void popup_error_dialog (AccessxStatusApplet *sapplet);
/* cribbed from geyes */
static void
-about_cb (GtkAction *action,
- AccessxStatusApplet *sapplet)
+about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ AccessxStatusApplet *sapplet = (AccessxStatusApplet *) user_data;
static const gchar *authors [] = {
"Calum Benson <calum benson sun com>",
"Bill Haneman <bill haneman sun com>",
@@ -146,9 +148,11 @@ about_cb (GtkAction *action,
}
static void
-help_cb (GtkAction *action,
- AccessxStatusApplet *sapplet)
+help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ AccessxStatusApplet *sapplet = (AccessxStatusApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (sapplet->applet)),
@@ -182,9 +186,11 @@ help_cb (GtkAction *action,
}
static void
-dialog_cb (GtkAction *action,
- AccessxStatusApplet *sapplet)
+dialog_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ AccessxStatusApplet *sapplet = (AccessxStatusApplet *) user_data;
GError *error = NULL;
GdkScreen *screen;
GdkAppLaunchContext *launch_context;
@@ -233,16 +239,10 @@ dialog_cb (GtkAction *action,
g_object_unref (appinfo);
}
-static const GtkActionEntry accessx_status_applet_menu_actions [] = {
- { "Dialog", GTK_STOCK_PROPERTIES, N_("_Keyboard Accessibility Preferences"),
- NULL, NULL,
- G_CALLBACK (dialog_cb) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_cb) }
+static const GActionEntry accessx_status_applet_menu_actions [] = {
+ { "dialog", dialog_cb, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
};
static XkbDescPtr
@@ -1179,7 +1179,7 @@ static gboolean
button_press_cb (GtkWidget *widget, GdkEventButton *event, AccessxStatusApplet *sapplet)
{
if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
- dialog_cb (NULL, sapplet);
+ dialog_cb (NULL, NULL, sapplet);
return FALSE;
}
@@ -1194,7 +1194,7 @@ key_press_cb (GtkWidget *widget, GdkEventKey *event, AccessxStatusApplet *sapple
case GDK_KEY_Return:
case GDK_KEY_space:
case GDK_KEY_KP_Space:
- dialog_cb (NULL, sapplet);
+ dialog_cb (NULL, NULL, sapplet);
return TRUE;
default:
@@ -1249,7 +1249,8 @@ accessx_status_applet_fill (PanelApplet *applet)
{
AccessxStatusApplet *sapplet;
AtkObject *atk_object;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
gboolean was_realized = FALSE;
@@ -1275,22 +1276,22 @@ accessx_status_applet_fill (PanelApplet *applet)
g_signal_connect (sapplet->applet, "key_press_event",
G_CALLBACK (key_press_cb), sapplet);
- action_group = gtk_action_group_new ("Accessx Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- accessx_status_applet_menu_actions,
- G_N_ELEMENTS (accessx_status_applet_menu_actions),
- sapplet);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ accessx_status_applet_menu_actions,
+ G_N_ELEMENTS (accessx_status_applet_menu_actions),
+ sapplet);
ui_path = g_build_filename (ACCESSX_MENU_UI_DIR, "accessx-status-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (sapplet->applet, ui_path, action_group);
+ panel_applet_setup_menu_from_file (sapplet->applet, ui_path, action_group, GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (sapplet->applet)) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "accessx",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "dialog");
+ g_object_bind_property (applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "Dialog");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
gtk_widget_set_tooltip_text (GTK_WIDGET (sapplet->applet), _("Keyboard Accessibility Status"));
diff --git a/battstat/battstat-applet-menu.xml b/battstat/battstat-applet-menu.xml
index d6eb579..b9436f5 100644
--- a/battstat/battstat-applet-menu.xml
+++ b/battstat/battstat-applet-menu.xml
@@ -1,4 +1,14 @@
-<menuitem name="Battstat Properties Item" action="BattstatProperties" />
-<menuitem name="Battstat Help Item" action="BattstatHelp" />
-<menuitem name="Battstat About Item" action="BattstatAbout" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">battstat.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">battstat.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">battstat.about</attribute>
+ </item>
+</section>
diff --git a/battstat/battstat.h b/battstat/battstat.h
index 226adbf..c19b668 100644
--- a/battstat/battstat.h
+++ b/battstat/battstat.h
@@ -164,7 +164,7 @@ typedef struct _ProgressData {
} ProgressData;
/* properties.c */
-void prop_cb (GtkAction *, ProgressData *);
+void prop_cb (GSimpleAction *, GVariant *, gpointer);
/* battstat_applet.c */
void reconfigure_layout( ProgressData *battstat );
diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c
index cd48a88..eba64bc 100644
--- a/battstat/battstat_applet.c
+++ b/battstat/battstat_applet.c
@@ -51,19 +51,13 @@
#endif
static gboolean check_for_updates (gpointer data);
-static void about_cb( GtkAction *, ProgressData * );
-static void help_cb( GtkAction *, ProgressData * );
-
-static const GtkActionEntry battstat_menu_actions [] = {
- { "BattstatProperties", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (prop_cb) },
- { "BattstatHelp", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "BattstatAbout", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_cb) }
+static void about_cb( GSimpleAction *, GVariant *, gpointer );
+static void help_cb( GSimpleAction *, GVariant *, gpointer );
+
+static const GActionEntry battstat_menu_actions [] = {
+ { "preferences", prop_cb, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
};
#define AC_POWER_STRING _("System is running on AC power")
@@ -1159,16 +1153,22 @@ battstat_show_help( ProgressData *battstat, const char *section )
/* Called when the user selects the 'help' menu item.
*/
static void
-help_cb( GtkAction *action, ProgressData *battstat )
+help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ProgressData *battstat = (ProgressData *) user_data;
battstat_show_help( battstat, NULL );
}
/* Called when the user selects the 'about' menu item.
*/
static void
-about_cb( GtkAction *action, ProgressData *battstat )
+about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ProgressData *battstat = (ProgressData *) user_data;
const gchar *authors[] = {
"J\xC3\xB6rgen Pehrson <jp spektr eu org>",
"Lennart Poettering <lennart poettering de> (Linux ACPI support)",
@@ -1558,7 +1558,8 @@ battstat_applet_fill (PanelApplet *applet)
{
ProgressData *battstat;
AtkObject *atk_widget;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
const char *err;
@@ -1595,23 +1596,24 @@ battstat_applet_fill (PanelApplet *applet)
create_layout (battstat);
setup_text_orientation( battstat );
- action_group = gtk_action_group_new ("Battstat Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
battstat_menu_actions,
G_N_ELEMENTS (battstat_menu_actions),
battstat);
ui_path = g_build_filename (BATTSTAT_MENU_UI_DIR, "battstat-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (battstat->applet),
- ui_path, action_group);
+ ui_path, action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (PANEL_APPLET (battstat->applet))) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "battstat",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "BattstatProperties");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
atk_widget = gtk_widget_get_accessible (battstat->applet);
diff --git a/battstat/properties.c b/battstat/properties.c
index c41469f..659b5a1 100644
--- a/battstat/properties.c
+++ b/battstat/properties.c
@@ -209,15 +209,19 @@ response_cb (GtkDialog *dialog, gint id, gpointer data)
}
void
-prop_cb (GtkAction *action,
- ProgressData *battstat)
+prop_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ProgressData *battstat;
GtkBuilder *builder;
GtkWidget *combo_ptr, *spin_ptr;
GtkListStore *liststore;
GtkCellRenderer *renderer;
GtkTreeIter iter;
+ battstat = (ProgressData *) user_data;
+
if (DEBUG) g_print("prop_cb()\n");
if (battstat->prop_win) {
diff --git a/charpick/charpick-applet-menu.xml b/charpick/charpick-applet-menu.xml
index b1af96a..4838034 100644
--- a/charpick/charpick-applet-menu.xml
+++ b/charpick/charpick-applet-menu.xml
@@ -1,4 +1,14 @@
-<menuitem name="Item 1" action="Preferences" />
-<menuitem name="Item 2" action="Help" />
-<menuitem name="Item 3" action="About" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">charpick.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">charpick.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">charpick.about</attribute>
+ </item>
+</section>
diff --git a/charpick/charpick.c b/charpick/charpick.c
index 05504cb..19b5bae 100644
--- a/charpick/charpick.c
+++ b/charpick/charpick.c
@@ -567,9 +567,12 @@ static void applet_change_orient(PanelApplet *applet, PanelAppletOrient o, gpoin
static void
-about (GtkAction *action,
- charpick_data *curr_data)
+about (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ charpick_data *curr_data = (charpick_data *) user_data;
+
static const char * const authors[] = {
"Alexandre Muñiz <munizao xprt net>",
"Kevin Vandersloot",
@@ -598,9 +601,11 @@ about (GtkAction *action,
static void
-help_cb (GtkAction *action,
- charpick_data *curr_data)
+help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ charpick_data *curr_data = (charpick_data *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (curr_data->applet)),
@@ -677,16 +682,10 @@ get_chartable (charpick_data *curr_data)
g_strfreev (value);
}
-static const GtkActionEntry charpick_applet_menu_actions [] = {
- { "Preferences", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (show_preferences_dialog) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about) }
+static const GActionEntry charpick_applet_menu_actions [] = {
+ { "preferences", show_preferences_dialog, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about, NULL, NULL, NULL }
};
void
@@ -718,7 +717,8 @@ charpicker_applet_fill (PanelApplet *applet)
GdkAtom utf8_atom;
GList *list;
gchar *string;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
g_set_application_name (_("Character Palette"));
@@ -795,23 +795,24 @@ charpicker_applet_fill (PanelApplet *applet)
gtk_widget_show_all (GTK_WIDGET (applet));
- action_group = gtk_action_group_new ("Charpicker Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- charpick_applet_menu_actions,
- G_N_ELEMENTS (charpick_applet_menu_actions),
- curr_data);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ charpick_applet_menu_actions,
+ G_N_ELEMENTS (charpick_applet_menu_actions),
+ curr_data);
ui_path = g_build_filename (CHARPICK_MENU_UI_DIR, "charpick-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (PANEL_APPLET (applet),
- ui_path, action_group);
+ panel_applet_setup_menu_from_file (applet,
+ ui_path, action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (PANEL_APPLET (applet))) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "charpick",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "Preferences");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
register_stock_for_edit ();
diff --git a/charpick/charpick.h b/charpick/charpick.h
index 4edf0a7..e6d6785 100644
--- a/charpick/charpick.h
+++ b/charpick/charpick.h
@@ -50,8 +50,9 @@ void build_table (charpick_data *curr_data);
void add_to_popup_menu (charpick_data *curr_data);
void populate_menu (charpick_data *curr_data);
void save_chartable (charpick_data *curr_data);
-void show_preferences_dialog (GtkAction *action,
- charpick_data *curr_data);
+void show_preferences_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
void add_edit_dialog_create (charpick_data *curr_data,
gchar *string,
diff --git a/charpick/properties.c b/charpick/properties.c
index 032689e..4395461 100644
--- a/charpick/properties.c
+++ b/charpick/properties.c
@@ -525,9 +525,12 @@ response_cb (GtkDialog *dialog, gint id, gpointer data)
}
void
-show_preferences_dialog (GtkAction *action,
- charpick_data *curr_data)
+show_preferences_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ charpick_data *curr_data = (charpick_data *) user_data;
+
if (curr_data->propwindow) {
gtk_window_set_screen (GTK_WINDOW (curr_data->propwindow),
gtk_widget_get_screen (curr_data->applet));
diff --git a/configure.ac b/configure.ac
index d474ea5..7c43e95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@ dnl ***************************************************************************
GTK_REQUIRED=3.2
GLIB_REQUIRED=2.30.0
GIO_REQUIRED=2.26.0
-LIBPANEL_REQUIRED=2.91.90
+LIBPANEL_REQUIRED=3.10.0
LIBGTOP_REQUIRED=2.11.92
LIBXKLAVIER_REQUIRED=4.0
LIBWNCK_REQUIRED=2.91.0
@@ -116,19 +116,19 @@ AC_SUBST(GTK_FLAGS)
AC_SUBST(GTK_LIBS)
dnl -- check for libpanelapplet (required) ------------------------------------
-PKG_CHECK_MODULES(GNOME_APPLETS, libpanelapplet-4.0 >= $LIBPANEL_REQUIRED)
+PKG_CHECK_MODULES(GNOME_APPLETS, libpanel-applet >= $LIBPANEL_REQUIRED)
AC_SUBST(GNOME_APPLETS_CFLAGS)
AC_SUBST(GNOME_APPLETS_LIBS)
AC_ARG_WITH([libpanel-applet-dir], [], [LIBPANEL_APPLET_DIR=$withval], [LIBPANEL_APPLET_DIR=""])
if test "$LIBPANEL_APPLET_DIR" == ""; then
- LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanelapplet-4.0`
+ LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanel-applet`
fi
AC_MSG_NOTICE([installing applets in $LIBPANEL_APPLET_DIR])
AC_SUBST(LIBPANEL_APPLET_DIR)
-LIBPANEL_APPLET_API_VERSION=`$PKG_CONFIG --variable=libpanel_applet_api_version libpanelapplet-4.0`
+LIBPANEL_APPLET_API_VERSION=`$PKG_CONFIG --variable=libpanel_applet_api_version libpanel-applet`
AC_SUBST(LIBPANEL_APPLET_API_VERSION)
dnl -- check for libgtop (optional) -------------------------------------------
diff --git a/cpufreq/cpufreq-applet-menu.xml b/cpufreq/cpufreq-applet-menu.xml
index 9837581..86ddac1 100644
--- a/cpufreq/cpufreq-applet-menu.xml
+++ b/cpufreq/cpufreq-applet-menu.xml
@@ -1,4 +1,14 @@
-<menuitem name="CPUFreq Preferences Item" action="CPUFreqAppletPreferences" />
-<menuitem name="CPUFreq Help Item" action="CPUFreqAppletHelp" />
-<menuitem name="CPUFreq About Item" action="CPUFreqAppletAbout" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">cpufreq.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">cpufreq.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">cpufreq.about</attribute>
+ </item>
+</section>
diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c
index 40b8439..ba0bf35 100644
--- a/cpufreq/src/cpufreq-applet.c
+++ b/cpufreq/src/cpufreq-applet.c
@@ -78,12 +78,15 @@ struct _CPUFreqAppletClass {
static void cpufreq_applet_init (CPUFreqApplet *applet);
static void cpufreq_applet_class_init (CPUFreqAppletClass *klass);
-static void cpufreq_applet_preferences_cb (GtkAction *action,
- CPUFreqApplet *applet);
-static void cpufreq_applet_help_cb (GtkAction *action,
- CPUFreqApplet *applet);
-static void cpufreq_applet_about_cb (GtkAction *action,
- CPUFreqApplet *applet);
+static void cpufreq_applet_preferences_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void cpufreq_applet_help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void cpufreq_applet_about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
static void cpufreq_applet_pixmap_set_image (CPUFreqApplet *applet,
gint perc);
@@ -118,16 +121,10 @@ static const gchar *const cpufreq_icons[] = {
NULL
};
-static const GtkActionEntry cpufreq_applet_menu_actions[] = {
- { "CPUFreqAppletPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (cpufreq_applet_preferences_cb) },
- { "CPUFreqAppletHelp", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (cpufreq_applet_help_cb) },
- { "CPUFreqAppletAbout", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (cpufreq_applet_about_cb) }
+static const GActionEntry cpufreq_applet_menu_actions [] = {
+ { "preferences", cpufreq_applet_preferences_cb, NULL, NULL, NULL },
+ { "help", cpufreq_applet_help_cb, NULL, NULL, NULL },
+ { "about", cpufreq_applet_about_cb, NULL, NULL, NULL }
};
G_DEFINE_TYPE (CPUFreqApplet, cpufreq_applet, PANEL_TYPE_APPLET)
@@ -555,17 +552,21 @@ cpufreq_applet_change_orient (PanelApplet *pa, PanelAppletOrient orient)
}
static void
-cpufreq_applet_preferences_cb (GtkAction *action,
- CPUFreqApplet *applet)
+cpufreq_applet_preferences_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ CPUFreqApplet *applet = (CPUFreqApplet *) user_data;
cpufreq_preferences_dialog_run (applet->prefs,
gtk_widget_get_screen (GTK_WIDGET (applet)));
}
static void
-cpufreq_applet_help_cb (GtkAction *action,
- CPUFreqApplet *applet)
+cpufreq_applet_help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ CPUFreqApplet *applet = (CPUFreqApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (applet)),
@@ -581,8 +582,9 @@ cpufreq_applet_help_cb (GtkAction *action,
}
static void
-cpufreq_applet_about_cb (GtkAction *action,
- CPUFreqApplet *applet)
+cpufreq_applet_about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
static const gchar *const authors[] = {
"Carlos Garcia Campos <carlosgc gnome org>",
@@ -934,7 +936,8 @@ cpufreq_applet_prefs_show_mode_changed (CPUFreqPrefs *prefs,
static void
cpufreq_applet_setup (CPUFreqApplet *applet)
{
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
AtkObject *atk_obj;
GSettings *settings;
@@ -972,23 +975,24 @@ cpufreq_applet_setup (CPUFreqApplet *applet)
(gpointer) applet);
/* Setup the menus */
- action_group = gtk_action_group_new ("CPUFreq Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
cpufreq_applet_menu_actions,
G_N_ELEMENTS (cpufreq_applet_menu_actions),
applet);
ui_path = g_build_filename (CPUFREQ_MENU_UI_DIR, "cpufreq-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (applet),
- ui_path, action_group);
+ ui_path, action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (PANEL_APPLET (applet))) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "cpufreq",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "CPUFreqPreferences");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet));
diff --git a/drivemount/drivemount-applet-menu.xml b/drivemount/drivemount-applet-menu.xml
index efc2659..0c5f5cf 100644
--- a/drivemount/drivemount-applet-menu.xml
+++ b/drivemount/drivemount-applet-menu.xml
@@ -1,3 +1,10 @@
-<menuitem name="Help" action="Help" />
-<menuitem name="About" action="About" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">drivemount.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">drivemount.about</attribute>
+ </item>
+</section>
diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c
index 702bb26..33c7789 100644
--- a/drivemount/drivemount.c
+++ b/drivemount/drivemount.c
@@ -84,9 +84,12 @@ change_background (PanelApplet *applet,
}
static void
-display_about_dialog (GtkAction *action,
- DriveList *drive_list)
+display_about_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ DriveList *drive_list = (DriveList *) user_data;
+
const gchar *authors[] = {
"James Henstridge <jamesh canonical com>",
NULL
@@ -109,9 +112,11 @@ display_about_dialog (GtkAction *action,
}
static void
-display_help (GtkAction *action,
- DriveList *drive_list)
+display_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ DriveList *drive_list = (DriveList *) user_data;
GdkScreen *screen;
GError *error = NULL;
@@ -140,13 +145,9 @@ display_help (GtkAction *action,
}
}
-static const GtkActionEntry applet_menu_actions[] = {
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (display_help) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (display_about_dialog) }
+static const GActionEntry applet_menu_actions [] = {
+ { "help", display_help, NULL, NULL, NULL },
+ { "about", display_about_dialog, NULL, NULL, NULL }
};
static gboolean
@@ -157,7 +158,7 @@ applet_factory (PanelApplet *applet,
gboolean ret = FALSE;
GtkWidget *drive_list;
AtkObject *ao;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
gchar *ui_path;
if (!strcmp (iid, drivemount_iid)) {
@@ -183,15 +184,18 @@ applet_factory (PanelApplet *applet,
panel_applet_get_orient (applet),
DRIVE_LIST (drive_list));
- action_group = gtk_action_group_new ("DriveMount Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- applet_menu_actions,
- G_N_ELEMENTS (applet_menu_actions),
- drive_list);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ applet_menu_actions,
+ G_N_ELEMENTS (applet_menu_actions),
+ drive_list);
ui_path = g_build_filename (DRIVEMOUNT_MENU_UI_DIR, "drivemount-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (applet, ui_path, action_group);
+ panel_applet_setup_menu_from_file (applet, ui_path, action_group, GETTEXT_PACKAGE);
g_free (ui_path);
+
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "drivemount",
+ G_ACTION_GROUP (action_group));
+
g_object_unref (action_group);
ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
diff --git a/geyes/geyes-applet-menu.xml b/geyes/geyes-applet-menu.xml
index 860052a..631f7ea 100644
--- a/geyes/geyes-applet-menu.xml
+++ b/geyes/geyes-applet-menu.xml
@@ -1,5 +1,14 @@
-<menuitem name="Item 1" action="Props" />
-<menuitem name="Item 2" action="Help" />
-<menuitem name="Item 3" action="About" />
-
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">geyes.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">geyes.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">geyes.about</attribute>
+ </item>
+</section>
diff --git a/geyes/geyes.c b/geyes/geyes.c
index 1cfebd7..a0213a2 100644
--- a/geyes/geyes.c
+++ b/geyes/geyes.c
@@ -133,9 +133,12 @@ timer_cb (EyesApplet *eyes_applet)
}
static void
-about_cb (GtkAction *action,
- EyesApplet *eyes_applet)
+about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EyesApplet *eyes_applet = (EyesApplet *) user_data;
+
static const gchar *authors [] = {
"Dave Camp <campd oit edu>",
NULL
@@ -294,9 +297,11 @@ destroy_cb (GtkWidget *object, EyesApplet *eyes_applet)
}
static void
-help_cb (GtkAction *action,
- EyesApplet *eyes_applet)
+help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EyesApplet *eyes_applet = (EyesApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)),
@@ -316,17 +321,10 @@ help_cb (GtkAction *action,
}
}
-
-static const GtkActionEntry geyes_applet_menu_actions [] = {
- { "Props", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (properties_cb) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_cb) }
+static const GActionEntry geyes_applet_menu_actions [] = {
+ { "preferences", properties_cb, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
};
static void
@@ -348,7 +346,8 @@ static gboolean
geyes_applet_fill (PanelApplet *applet)
{
EyesApplet *eyes_applet;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
g_set_application_name (_("Eyes"));
@@ -363,23 +362,25 @@ geyes_applet_fill (PanelApplet *applet)
eyes_applet->timeout_id = g_timeout_add (
UPDATE_TIMEOUT, (GSourceFunc) timer_cb, eyes_applet);
- action_group = gtk_action_group_new ("Geyes Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- geyes_applet_menu_actions,
- G_N_ELEMENTS (geyes_applet_menu_actions),
- eyes_applet);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ geyes_applet_menu_actions,
+ G_N_ELEMENTS (geyes_applet_menu_actions),
+ eyes_applet);
ui_path = g_build_filename (GEYES_MENU_UI_DIR, "geyes-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (eyes_applet->applet,
- ui_path, action_group);
+ ui_path, action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (eyes_applet->applet)) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "geyes",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down",
+ action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "Props");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
gtk_widget_set_tooltip_text (GTK_WIDGET (eyes_applet->applet), _("Eyes"));
diff --git a/geyes/geyes.h b/geyes/geyes.h
index d8266a0..1057801 100644
--- a/geyes/geyes.h
+++ b/geyes/geyes.h
@@ -80,7 +80,8 @@ void theme_dirs_create (void);
int load_theme (EyesApplet *eyes_applet,
const gchar *theme_dir);
-void properties_cb (GtkAction *action,
- EyesApplet *eyes_applet);
+void properties_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
#endif
diff --git a/geyes/themes.c b/geyes/themes.c
index 50c6bf0..ae101b6 100644
--- a/geyes/themes.c
+++ b/geyes/themes.c
@@ -243,9 +243,11 @@ presponse_cb (GtkDialog *dialog, gint id, gpointer data)
}
void
-properties_cb (GtkAction *action,
- EyesApplet *eyes_applet)
+properties_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EyesApplet *eyes_applet = (EyesApplet *) user_data;
GtkWidget *pbox, *hbox;
GtkWidget *vbox, *indent;
GtkWidget *categories_vbox;
diff --git a/gweather/gweather-applet-menu.xml b/gweather/gweather-applet-menu.xml
index 8fc0a35..4020bc0 100644
--- a/gweather/gweather-applet-menu.xml
+++ b/gweather/gweather-applet-menu.xml
@@ -1,7 +1,24 @@
-<menuitem name="Item 1" action="Details" />
-<menuitem name="Item 2" action="Update" />
-<separator/>
-<menuitem name="Item 3" action="Props" />
-<menuitem name="Item 4" action="Help" />
-<menuitem name="Item 5" action="About" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Details</attribute>
+ <attribute name="action">gweather.details</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Update</attribute>
+ <attribute name="action">gweather.update</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">gweather.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">gweather.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">gweather.about</attribute>
+ </item>
+</section>
diff --git a/gweather/gweather-applet.c b/gweather/gweather-applet.c
index 9d963d6..9234885 100644
--- a/gweather/gweather-applet.c
+++ b/gweather/gweather-applet.c
@@ -42,16 +42,19 @@
static void update_finish (GWeatherInfo *info, gpointer data);
-static void about_cb (GtkAction *action,
- GWeatherApplet *gw_applet)
+static void about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
-
+ GWeatherApplet *gw_applet = (GWeatherApplet *) user_data;
gweather_about_run (gw_applet);
}
-static void help_cb (GtkAction *action,
- GWeatherApplet *gw_applet)
+static void help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GWeatherApplet *gw_applet = (GWeatherApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (gw_applet->applet)),
@@ -71,9 +74,12 @@ static void help_cb (GtkAction *action,
}
}
-static void pref_cb (GtkAction *action,
- GWeatherApplet *gw_applet)
+static void pref_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GWeatherApplet *gw_applet = (GWeatherApplet *) user_data;
+
if (gw_applet->pref_dialog) {
gtk_window_present (GTK_WINDOW (gw_applet->pref_dialog));
} else {
@@ -84,9 +90,12 @@ static void pref_cb (GtkAction *action,
}
}
-static void details_cb (GtkAction *action,
- GWeatherApplet *gw_applet)
+static void details_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GWeatherApplet *gw_applet = (GWeatherApplet *) user_data;
+
if (gw_applet->details_dialog) {
gtk_window_present (GTK_WINDOW (gw_applet->details_dialog));
} else {
@@ -98,29 +107,20 @@ static void details_cb (GtkAction *action,
}
}
-static void update_cb (GtkAction *action,
- GWeatherApplet *gw_applet)
+static void update_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GWeatherApplet *gw_applet = (GWeatherApplet *) user_data;
gweather_update (gw_applet);
}
-
-static const GtkActionEntry weather_applet_menu_actions [] = {
- { "Details", NULL, N_("_Details"),
- NULL, NULL,
- G_CALLBACK (details_cb) },
- { "Update", GTK_STOCK_REFRESH, N_("_Update"),
- NULL, NULL,
- G_CALLBACK (update_cb) },
- { "Props", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (pref_cb) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_cb) }
+static const GActionEntry weather_applet_menu_actions [] = {
+ { "details", details_cb, NULL, NULL, NULL },
+ { "update", update_cb, NULL, NULL, NULL },
+ { "preferences", pref_cb, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
};
static void place_widgets (GWeatherApplet *gw_applet)
@@ -234,7 +234,7 @@ static gboolean clicked_cb (GtkWidget *widget, GdkEventButton *ev, gpointer data
if (ev->type == GDK_BUTTON_PRESS) {
if (!gw_applet->details_dialog)
- details_cb (NULL, gw_applet);
+ details_cb (NULL, NULL, gw_applet);
else
gtk_widget_destroy (GTK_WIDGET (gw_applet->details_dialog));
@@ -256,7 +256,7 @@ key_press_cb (GtkWidget *widget, GdkEventKey *event, GWeatherApplet *gw_applet)
break;
case GDK_KEY_d:
if (event->state == GDK_CONTROL_MASK) {
- details_cb (NULL, gw_applet);
+ details_cb (NULL, NULL, gw_applet);
return TRUE;
}
break;
@@ -266,7 +266,7 @@ key_press_cb (GtkWidget *widget, GdkEventKey *event, GWeatherApplet *gw_applet)
case GDK_KEY_Return:
case GDK_KEY_space:
case GDK_KEY_KP_Space:
- details_cb (NULL, gw_applet);
+ details_cb (NULL, NULL, gw_applet);
return TRUE;
default:
break;
@@ -319,7 +319,8 @@ applet_destroy (GtkWidget *widget, GWeatherApplet *gw_applet)
void gweather_applet_create (GWeatherApplet *gw_applet)
{
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
AtkObject *atk_obj;
GWeatherForecastType type;
@@ -356,23 +357,24 @@ void gweather_applet_create (GWeatherApplet *gw_applet)
gw_applet->orient = panel_applet_get_orient (gw_applet->applet);
- action_group = gtk_action_group_new ("GWeather Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- weather_applet_menu_actions,
- G_N_ELEMENTS (weather_applet_menu_actions),
- gw_applet);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ weather_applet_menu_actions,
+ G_N_ELEMENTS (weather_applet_menu_actions),
+ gw_applet);
ui_path = g_build_filename (GWEATHER_MENU_UI_DIR, "gweather-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (gw_applet->applet,
- ui_path, action_group);
+ ui_path, action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (gw_applet->applet)) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (gw_applet->applet), "gweather",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (gw_applet->applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "Props");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
type = g_settings_get_boolean (gw_applet->applet_settings, "detailed") ?
diff --git a/invest-applet/data/invest-applet-menu.xml b/invest-applet/data/invest-applet-menu.xml
index d4a3e61..12dd094 100644
--- a/invest-applet/data/invest-applet-menu.xml
+++ b/invest-applet/data/invest-applet-menu.xml
@@ -1,5 +1,20 @@
-<menuitem name="Refresh" action="Refresh" />
-<menuitem name="Prefs" action="Prefs" />
-<separator/>
-<menuitem name="About" action="About" />
-<menuitem name="Help" action="Help" />
+<section>
+ <item>
+ <attribute name="label" translatable="yes">Refresh</attribute>
+ <attribute name="action">invest.refresh</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Preferences</attribute>
+ <attribute name="action">invest.preferences</attribute>
+ </item>
+ </section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">Help</attribute>
+ <attribute name="action">invest.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">About</attribute>
+ <attribute name="action">invest.about</attribute>
+ </item>
+</section>
diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py
index 7b9fe55..e5ea796 100644
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@ -1,7 +1,7 @@
import os, time
from os.path import *
-from gi.repository import GObject, Gtk, Gdk, GdkPixbuf, PanelApplet
+from gi.repository import GObject, Gio, Gtk, Gdk, GdkPixbuf, PanelApplet
GObject.threads_init()
from gettext import gettext as _
@@ -20,17 +20,28 @@ class InvestApplet(PanelApplet.Applet):
invest.debug("init applet");
self.applet = applet
- # name, stock_id, label, accellerator, tooltip, callback
- menu_actions = [("About", Gtk.STOCK_HELP, _("About"), None, None, self.on_about),
- ("Help", Gtk.STOCK_HELP, _("Help"), None, None, self.on_help),
- ("Prefs", Gtk.STOCK_PREFERENCES, _("Preferences"), None, None,
self.on_preferences),
- ("Refresh", Gtk.STOCK_REFRESH, _("Refresh"), None, None, self.on_refresh)
- ]
- actiongroup = Gtk.ActionGroup.new("InvestAppletActions")
- actiongroup.set_translation_domain(invest.defs.GETTEXT_PACKAGE)
- actiongroup.add_actions(menu_actions, None)
+ actiongroup = Gio.SimpleActionGroup.new()
+
+ action = Gio.SimpleAction.new("about", None)
+ action.connect("activate", self.on_about)
+ actiongroup.add_action(action)
+
+ action = Gio.SimpleAction.new("help", None)
+ action.connect("activate", self.on_help)
+ actiongroup.add_action(action)
+
+ action = Gio.SimpleAction.new("preferences", None)
+ action.connect("activate", self.on_preferences)
+ actiongroup.add_action(action)
+
+ action = Gio.SimpleAction.new("refresh", None)
+ action.connect("activate", self.on_refresh)
+ actiongroup.add_action(action)
+
self.applet.setup_menu_from_file (join(invest.defs.PKGDATADIR, "ui/invest-applet-menu.xml"),
- actiongroup);
+ actiongroup, invest.defs.GETTEXT_PACKAGE);
+
+ self.applet.insert_action_group ("invest", actiongroup);
evbox = Gtk.HBox()
self.applet_icon = Gtk.Image()
@@ -70,17 +81,17 @@ class InvestApplet(PanelApplet.Applet):
# c) Everything is normal: pop-up the window
self.ilw.toggle_show()
- def on_about(self, action):
+ def on_about(self, action, parameter):
invest.about.show_about()
- def on_help(self, action):
+ def on_help(self, action, parameter):
invest.help.show_help()
- def on_preferences(self, action):
+ def on_preferences(self, action, parameter):
invest.preferences.show_preferences(self)
self.reload_ilw()
- def on_refresh(self, action):
+ def on_refresh(self, action, parameter):
self.quotes_updater.refresh()
def set_applet_icon(self, change):
diff --git a/mini-commander/src/about.c b/mini-commander/src/about.c
index 2832127..3ee01b9 100644
--- a/mini-commander/src/about.c
+++ b/mini-commander/src/about.c
@@ -26,8 +26,9 @@
#include "about.h"
-void about_box (GtkAction *action,
- MCData *mcdata)
+void about_box (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
static const gchar *authors[] = {
"Oliver Maruhn <oliver maruhn com>",
diff --git a/mini-commander/src/about.h b/mini-commander/src/about.h
index 875ea62..cf56872 100644
--- a/mini-commander/src/about.h
+++ b/mini-commander/src/about.h
@@ -1,4 +1,5 @@
#include "mini-commander_applet.h"
-void about_box (GtkAction *action,
- MCData *mcdata);
+void about_box (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
diff --git a/mini-commander/src/help.c b/mini-commander/src/help.c
index b5c4b66..608828e 100644
--- a/mini-commander/src/help.c
+++ b/mini-commander/src/help.c
@@ -24,9 +24,11 @@
#include "help.h"
void
-show_help (GtkAction *action,
- MCData *mcdata)
+show_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ MCData *mcdata = (MCData *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (mcdata->applet)),
diff --git a/mini-commander/src/help.h b/mini-commander/src/help.h
index 495984a..3daac03 100644
--- a/mini-commander/src/help.h
+++ b/mini-commander/src/help.h
@@ -1,4 +1,5 @@
#include "mini-commander_applet.h"
-void show_help (GtkAction *action,
- MCData *mcdata);
+void show_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
diff --git a/mini-commander/src/mini-commander-applet-menu.xml
b/mini-commander/src/mini-commander-applet-menu.xml
index 5cef44f..8ed4bcf 100644
--- a/mini-commander/src/mini-commander-applet-menu.xml
+++ b/mini-commander/src/mini-commander-applet-menu.xml
@@ -1,4 +1,14 @@
-<menuitem name="Item 1" action="Props" />
-<menuitem name="Item 2" action="Help" />
-<menuitem name="Item 3" action="About" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">mc.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">mc.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">mc.about</attribute>
+ </item>
+</section>
diff --git a/mini-commander/src/mini-commander_applet.c b/mini-commander/src/mini-commander_applet.c
index e6313a8..f059ee4 100644
--- a/mini-commander/src/mini-commander_applet.c
+++ b/mini-commander/src/mini-commander_applet.c
@@ -49,16 +49,10 @@
static gboolean icons_initialized = FALSE;
static GtkIconSize button_icon_size = 0;
-static const GtkActionEntry mini_commander_menu_actions [] = {
- { "Props", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (mc_show_preferences) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (show_help) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_box) }
+static const GActionEntry mini_commander_menu_actions [] = {
+ { "preferences", mc_show_preferences, NULL, NULL, NULL },
+ { "help", show_help, NULL, NULL, NULL },
+ { "about", about_box, NULL, NULL, NULL }
};
typedef struct {
@@ -340,7 +334,8 @@ mini_commander_applet_fill (PanelApplet *applet)
{
MCData *mc;
GSettings *settings;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
settings = g_settings_new (GNOME_DESKTOP_LOCKDOWN_SCHEMA);
@@ -395,21 +390,22 @@ mini_commander_applet_fill (PanelApplet *applet)
g_signal_connect (mc->applet, "key_press_event",
G_CALLBACK (key_press_cb), mc);
- action_group = gtk_action_group_new ("MiniCommander Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- mini_commander_menu_actions,
- G_N_ELEMENTS (mini_commander_menu_actions),
- mc);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ mini_commander_menu_actions,
+ G_N_ELEMENTS (mini_commander_menu_actions),
+ mc);
ui_path = g_build_filename (MC_MENU_UI_DIR, "mini-commander-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (mc->applet, ui_path, action_group);
+ panel_applet_setup_menu_from_file (mc->applet, ui_path, action_group, GETTEXT_PACKAGE);
- if (panel_applet_get_locked_down (mc->applet)) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "mc",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down",
+ action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
- action = gtk_action_group_get_action (action_group, "Props");
- gtk_action_set_visible (action, FALSE);
- }
g_object_unref (action_group);
set_atk_name_description (GTK_WIDGET (applet),
diff --git a/mini-commander/src/preferences.c b/mini-commander/src/preferences.c
index ead7811..11e086f 100644
--- a/mini-commander/src/preferences.c
+++ b/mini-commander/src/preferences.c
@@ -678,9 +678,12 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
}
void
-mc_show_preferences (GtkAction *action,
- MCData *mc)
+mc_show_preferences (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ MCData *mc = (MCData *) user_data;
+
if (!mc->prefs_dialog.dialog) {
GtkBuilder *builder;
diff --git a/mini-commander/src/preferences.h b/mini-commander/src/preferences.h
index 2ebc10b..2645006 100644
--- a/mini-commander/src/preferences.h
+++ b/mini-commander/src/preferences.h
@@ -77,8 +77,9 @@ typedef struct {
#include "mini-commander_applet.h"
void mc_load_preferences (MCData *mc);
-void mc_show_preferences (GtkAction *action,
- MCData *mc);
+void mc_show_preferences (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
void mc_macros_free (GSList *macros);
G_END_DECLS
diff --git a/mixer/applet.c b/mixer/applet.c
index ba0327b..ffe9fb5 100644
--- a/mixer/applet.c
+++ b/mixer/applet.c
@@ -84,8 +84,9 @@ static void cb_gsettings (GSettings *settings,
const gchar *key,
gpointer user_data);
-static void cb_verb (GtkAction *action,
- gpointer data);
+static void cb_verb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
static void cb_theme_change (GtkIconTheme *icon_theme,
gpointer data);
@@ -363,28 +364,26 @@ gnome_volume_applet_setup_timeout (GnomeVolumeApplet *applet)
}
}
+static void
+cb_activate (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GVariant *state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_variant_unref (state);
+}
+
gboolean
gnome_volume_applet_setup (GnomeVolumeApplet *applet,
GList *elements)
{
- static const GtkActionEntry actions[] = {
- { "RunMixer", NULL, N_("_Open Volume Control"),
- NULL, NULL,
- G_CALLBACK (cb_verb) },
- { "Help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (cb_verb) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (cb_verb) },
- { "Pref", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (cb_verb) }
- };
- static const GtkToggleActionEntry toggle_actions[] = {
- { "Mute", NULL, N_("Mu_te"),
- NULL, NULL,
- G_CALLBACK (cb_verb), FALSE }
+ static const GActionEntry actions [] = {
+ { "mute", cb_activate, NULL, "false", cb_verb },
+ { "run", cb_verb, NULL, NULL, NULL },
+ { "preferences", cb_verb, NULL, NULL, NULL },
+ { "help", cb_verb, NULL, NULL, NULL },
+ { "about", cb_verb, NULL, NULL, NULL }
};
gchar *active_element_name;
@@ -424,21 +423,20 @@ gnome_volume_applet_setup (GnomeVolumeApplet *applet,
panel_applet_get_orient (PANEL_APPLET (applet)));
/* menu */
- applet->action_group = gtk_action_group_new ("Mixer Applet Actions");
- gtk_action_group_set_translation_domain (applet->action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (applet->action_group,
+ applet->action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (applet->action_group),
actions,
G_N_ELEMENTS (actions),
applet);
- gtk_action_group_add_toggle_actions (applet->action_group,
- toggle_actions,
- G_N_ELEMENTS (toggle_actions),
- applet);
ui_path = g_build_filename (MIXER_MENU_UI_DIR, "mixer-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (applet),
- ui_path, applet->action_group);
+ ui_path, applet->action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "mixer",
+ G_ACTION_GROUP (applet->action_group));
+
gnome_volume_applet_refresh (applet, TRUE, -1, -1);
if (res) {
gnome_volume_applet_setup_timeout (applet);
@@ -667,18 +665,16 @@ static void
gnome_volume_applet_update_mute_action (GnomeVolumeApplet *applet,
gboolean newmute)
{
- GtkAction *action;
+ GSimpleAction *action;
if (!applet->action_group)
return;
- action = gtk_action_group_get_action (applet->action_group, "Mute");
- if (newmute == gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ action = (GSimpleAction *) g_action_map_lookup_action (G_ACTION_MAP (applet->action_group), "mute");
+ if (newmute == g_variant_get_boolean (g_action_get_state (G_ACTION (action))))
return;
- gtk_action_block_activate (action);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), newmute);
- gtk_action_unblock_activate (action);
+ g_simple_action_set_state (action, g_variant_new_boolean (newmute));
}
gboolean
@@ -1357,15 +1353,16 @@ cb_prefs_destroy (GtkWidget *widget,
}
static void
-cb_verb (GtkAction *action,
- gpointer data)
+cb_verb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (data);
- const gchar *verbname = gtk_action_get_name (action);
+ GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (user_data);
+ const gchar *verbname = g_action_get_name (G_ACTION (action));
- if (!strcmp (verbname, "RunMixer")) {
+ if (!strcmp (verbname, "run")) {
gnome_volume_applet_run_mixer (applet);
- } else if (!strcmp (verbname, "Help")) {
+ } else if (!strcmp (verbname, "help")) {
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (applet)),
@@ -1385,7 +1382,7 @@ cb_verb (GtkAction *action,
gtk_widget_show (dialog);
g_error_free (error);
}
- } else if (!strcmp (verbname, "About")) {
+ } else if (!strcmp (verbname, "about")) {
const gchar *authors[] = { "Ronald Bultje <rbultje ronald bitfreak net>",
NULL };
@@ -1406,7 +1403,7 @@ cb_verb (GtkAction *action,
g_free (comments);
- } else if (!strcmp (verbname, "Pref")) {
+ } else if (!strcmp (verbname, "preferences")) {
if (!applet->mixer) {
show_no_mixer_dialog (applet);
} else {
@@ -1424,12 +1421,12 @@ cb_verb (GtkAction *action,
G_CALLBACK (cb_prefs_destroy), applet);
gtk_widget_show (applet->prefs);
}
- } else if (!strcmp (verbname, "Mute")) {
+ } else if (!strcmp (verbname, "mute")) {
if (!applet->mixer) {
show_no_mixer_dialog (applet);
} else {
gboolean mute = applet->state & 1,
- want_mute = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ want_mute = g_variant_get_boolean (parameter);
if (mute != want_mute)
gnome_volume_applet_toggle_mute (applet);
}
diff --git a/mixer/applet.h b/mixer/applet.h
index 9657c77..c7cda6b 100644
--- a/mixer/applet.h
+++ b/mixer/applet.h
@@ -52,7 +52,7 @@ struct _GnomeVolumeApplet {
PanelApplet parent;
/* menu actions */
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
/* our main icon, which is our panel user interface */
GtkImage *image;
diff --git a/mixer/mixer-applet-menu.xml b/mixer/mixer-applet-menu.xml
index d0d2ab6..a4c7d4d 100644
--- a/mixer/mixer-applet-menu.xml
+++ b/mixer/mixer-applet-menu.xml
@@ -1,7 +1,24 @@
-<menuitem name="Mute" action="Mute" />
-<menuitem name="RunMixer" action="RunMixer" />
-<separator/>
-<menuitem name="Pref" action="Pref" />
-<menuitem name="Help" action="Help" />
-<menuitem name="About" action="About" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Open Volume Control</attribute>
+ <attribute name="action">mixer.run</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Mu_te</attribute>
+ <attribute name="action">mixer.mute</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">mixer.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">mixer.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">mixer.about</attribute>
+ </item>
+</section>
diff --git a/modemlights/modem-applet-menu.xml b/modemlights/modem-applet-menu.xml
index 5a70c09..052f5ff 100644
--- a/modemlights/modem-applet-menu.xml
+++ b/modemlights/modem-applet-menu.xml
@@ -1,5 +1,20 @@
-<menuitem name="Activate" action="Activate" />
-<menuitem name="Deactivate" action="Deactivate" />
-<separator/>
-<menuitem name="Properties" action="Properties" />
-<menuitem name="About" action="About" />
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Activate</attribute>
+ <attribute name="action">modem.activate</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Deactivate</attribute>
+ <attribute name="action">modem.deactivate</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Properties</attribute>
+ <attribute name="action">modem.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">modem.about</attribute>
+ </item>
+</section>
diff --git a/modemlights/modem-applet.c b/modemlights/modem-applet.c
index b072f32..aff7ba0 100644
--- a/modemlights/modem-applet.c
+++ b/modemlights/modem-applet.c
@@ -57,7 +57,7 @@ struct _ModemAppletPrivate
GtkIconTheme *icon_theme;
GdkPixbuf *icon;
GtkWidget *image;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
/* auth dialog */
GtkWidget *auth_dialog;
@@ -116,14 +116,18 @@ static void modem_applet_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
gpointer user_data);
-static void on_modem_applet_about_clicked (GtkAction *action,
- ModemApplet *applet);
-static void on_modem_applet_activate (GtkAction *action,
- ModemApplet *applet);
-static void on_modem_applet_deactivate (GtkAction *action,
- ModemApplet *applet);
-static void on_modem_applet_properties_clicked (GtkAction *action,
- ModemApplet *applet);
+static void on_modem_applet_about_clicked (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_modem_applet_activate (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_modem_applet_deactivate (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_modem_applet_properties_clicked (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
static void launch_backend (ModemApplet *applet,
gboolean root_auth);
@@ -131,19 +135,11 @@ static void shutdown_backend (ModemApplet *applet,
gboolean backend_alive,
gboolean already_waiting);
-static const GtkActionEntry menu_actions[] = {
- { "Activate", GTK_STOCK_EXECUTE, N_("_Activate"),
- NULL, NULL,
- G_CALLBACK (on_modem_applet_activate) },
- { "Deactivate", GTK_STOCK_STOP, N_("_Deactivate"),
- NULL, NULL,
- G_CALLBACK (on_modem_applet_deactivate) },
- { "Properties", GTK_STOCK_PROPERTIES, N_("_Properties"),
- NULL, NULL,
- G_CALLBACK (on_modem_applet_properties_clicked) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (on_modem_applet_about_clicked) }
+static const GActionEntry menu_actions [] = {
+ { "activate", on_modem_applet_activate, NULL, NULL, NULL },
+ { "deactivate", on_modem_applet_deactivate, NULL, NULL, NULL },
+ { "preferences", on_modem_applet_properties_clicked, NULL, NULL, NULL },
+ { "about", on_modem_applet_about_clicked, NULL, NULL, NULL }
};
G_DEFINE_TYPE_WITH_PRIVATE (ModemApplet, modem_applet, PANEL_TYPE_APPLET)
@@ -588,16 +584,16 @@ shutdown_backend (ModemApplet *applet, gboolean backend_alive, gboolean already_
static void
update_popup_buttons (ModemApplet *applet)
{
- GtkAction *action;
+ GSimpleAction *action;
ModemAppletPrivate *priv;
priv = MODEM_APPLET_GET_PRIVATE (applet);
- action = gtk_action_group_get_action (priv->action_group, "Activate");
- gtk_action_set_sensitive (action, priv->configured && !priv->enabled);
+ action = (GSimpleAction *) g_action_map_lookup_action (G_ACTION_MAP (priv->action_group), "activate");
+ g_simple_action_set_enabled (action, priv->configured && !priv->enabled);
- action = gtk_action_group_get_action (priv->action_group, "Deactivate");
- gtk_action_set_sensitive (action, priv->configured && priv->enabled);
+ action = (GSimpleAction *) g_action_map_lookup_action (G_ACTION_MAP (priv->action_group), "deactivate");
+ g_simple_action_set_enabled (action, priv->configured && !priv->enabled);
}
static void
@@ -933,23 +929,29 @@ toggle_interface (ModemApplet *applet, gboolean enable)
}
static void
-on_modem_applet_activate (GtkAction *action,
- ModemApplet *applet)
+on_modem_applet_activate (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ModemApplet *applet = (ModemApplet *) user_data;
toggle_interface (applet, TRUE);
}
static void
-on_modem_applet_deactivate (GtkAction *action,
- ModemApplet *applet)
+on_modem_applet_deactivate (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ModemApplet *applet = (ModemApplet *) user_data;
toggle_interface (applet, FALSE);
}
static void
-on_modem_applet_properties_clicked (GtkAction *action,
- ModemApplet *applet)
+on_modem_applet_properties_clicked (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ ModemApplet *applet = (ModemApplet *) user_data;
ModemAppletPrivate *priv = MODEM_APPLET_GET_PRIVATE (applet);
GdkScreen *screen;
GtkWidget *dialog;
@@ -972,8 +974,9 @@ on_modem_applet_properties_clicked (GtkAction *action,
}
static void
-on_modem_applet_about_clicked (GtkAction *action,
- ModemApplet *applet)
+on_modem_applet_about_clicked (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
const gchar *authors[] = {
"Carlos Garnacho Parro <carlosg gnome org>",
@@ -1005,18 +1008,20 @@ modem_applet_fill (ModemApplet *applet)
gtk_widget_show_all (GTK_WIDGET (applet));
- priv->action_group = gtk_action_group_new ("ModemLights Applet Actions");
- gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (priv->action_group,
- menu_actions,
- G_N_ELEMENTS (menu_actions),
- applet);
+ priv->action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (priv->action_group),
+ menu_actions, G_N_ELEMENTS (menu_actions),
+ applet);
update_popup_buttons (applet);
ui_path = g_build_filename (MODEM_MENU_UI_DIR, "modem-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (applet),
- ui_path, priv->action_group);
+ ui_path, priv->action_group,
+ GETTEXT_PACKAGE);
g_free (ui_path);
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "modem",
+ G_ACTION_GROUP (priv->action_group));
+
panel_applet_set_background_widget (PANEL_APPLET (applet),
GTK_WIDGET (applet));
diff --git a/multiload/global.h b/multiload/global.h
index a2651cc..43bab32 100644
--- a/multiload/global.h
+++ b/multiload/global.h
@@ -131,8 +131,9 @@ struct _MultiloadApplet
/* show properties dialog */
G_GNUC_INTERNAL void
-multiload_properties_cb (GtkAction *action,
- MultiloadApplet *ma);
+multiload_properties_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
/* remove the old graphs and rebuild them */
G_GNUC_INTERNAL void
diff --git a/multiload/main.c b/multiload/main.c
index 161599e..5b2161f 100644
--- a/multiload/main.c
+++ b/multiload/main.c
@@ -28,9 +28,12 @@
#include "global.h"
static void
-about_cb (GtkAction *action,
- MultiloadApplet *ma)
+about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ MultiloadApplet *ma = (MultiloadApplet *) user_data;
+
const gchar * const authors[] =
{
"Martin Baulig <martin home-of-linux org>",
@@ -62,10 +65,11 @@ about_cb (GtkAction *action,
}
static void
-help_cb (GtkAction *action,
- MultiloadApplet *ma)
+help_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
-
+ MultiloadApplet *ma = (MultiloadApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
@@ -164,9 +168,11 @@ start_procman (MultiloadApplet *ma)
}
static void
-start_procman_cb (GtkAction *action,
- MultiloadApplet *ma)
+start_procman_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ MultiloadApplet *ma = (MultiloadApplet *) user_data;
start_procman (ma);
}
@@ -456,20 +462,12 @@ multiload_applet_refresh(MultiloadApplet *ma)
return;
}
-static const GtkActionEntry multiload_menu_actions [] = {
- { "MultiLoadProperties", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (multiload_properties_cb) },
- { "MultiLoadRunProcman", GTK_STOCK_EXECUTE, N_("_Open System Monitor"),
- NULL, NULL,
- G_CALLBACK (start_procman_cb) },
- { "MultiLoadHelp", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (help_cb) },
- { "MultiLoadAbout", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (about_cb) }
-};
+static const GActionEntry multiload_menu_actions [] = {
+ { "run", start_procman_cb, NULL, NULL, NULL },
+ { "preferences", multiload_properties_cb, NULL, NULL, NULL },
+ { "help", help_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
+};
/* create a box and stuff the load graphs inside of it */
static gboolean
@@ -477,7 +475,8 @@ multiload_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
{
MultiloadApplet *ma;
GSettings *settings;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
+ GAction *action;
gchar *ui_path;
ma = g_new0(MultiloadApplet, 1);
@@ -496,34 +495,30 @@ multiload_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
ma->settings = panel_applet_settings_new (applet, MULTILOAD_SCHEMA);
panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
- action_group = gtk_action_group_new ("Multiload Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- multiload_menu_actions,
- G_N_ELEMENTS (multiload_menu_actions),
- ma);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ multiload_menu_actions,
+ G_N_ELEMENTS (multiload_menu_actions),
+ ma);
ui_path = g_build_filename (MULTILOAD_MENU_UI_DIR, "multiload-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (applet, ui_path, action_group);
+ panel_applet_setup_menu_from_file (applet, ui_path, action_group, GETTEXT_PACKAGE);
g_free (ui_path);
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "multiload",
+ G_ACTION_GROUP (action_group));
- if (panel_applet_get_locked_down (applet)) {
- GtkAction *action;
-
- action = gtk_action_group_get_action (action_group, "MultiLoadProperties");
- gtk_action_set_visible (action, FALSE);
- }
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (applet, "locked-down", action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
settings = g_settings_new (GNOME_DESKTOP_LOCKDOWN_SCHEMA);
if (g_settings_get_boolean (settings, DISABLE_COMMAND_LINE) ||
panel_applet_get_locked_down (applet)) {
- GtkAction *action;
-
/* When the panel is locked down or when the command line is inhibited,
it seems very likely that running the procman would be at least harmful */
- action = gtk_action_group_get_action (action_group, "MultiLoadRunProcman");
- gtk_action_set_visible (action, FALSE);
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "run");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
}
g_object_unref (settings);
diff --git a/multiload/multiload-applet-menu.xml b/multiload/multiload-applet-menu.xml
index 88d28dd..9866441 100644
--- a/multiload/multiload-applet-menu.xml
+++ b/multiload/multiload-applet-menu.xml
@@ -1,6 +1,20 @@
-<menuitem name="Procman Item" action="MultiLoadRunProcman" />
-<separator/>
-<menuitem name="Properties Item" action="MultiLoadProperties" />
-<menuitem name="Help" action="MultiLoadHelp" />
-<menuitem name="About Item" action="MultiLoadAbout" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Open System Monitor</attribute>
+ <attribute name="action">multiload.run</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">multiload.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">multiload.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">multiload.about</attribute>
+ </item>
+</section>
diff --git a/multiload/properties.c b/multiload/properties.c
index 5ae1821..700582b 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -591,9 +591,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
/* show properties dialog */
void
-multiload_properties_cb (GtkAction *action,
- MultiloadApplet *ma)
+multiload_properties_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ MultiloadApplet *ma = (MultiloadApplet *) user_data;
GtkWidget *dialog = NULL;
if (ma->prop_dialog) {
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 31e6be1..6aaf1e7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,18 +2,22 @@
# Please keep this file sorted alphabetically.
#
[encoding: UTF-8]
+[type: gettext/glade]accessx-status/accessx-status-applet-menu.xml
accessx-status/applet.c
[type: gettext/ini]accessx-status/org.gnome.applets.AccessxStatusApplet.panel-applet.in.in
battstat/battstat_applet.c
[type: gettext/glade]battstat/battstat_applet.ui
+[type: gettext/glade]battstat/battstat-applet-menu.xml
[type: gettext/ini]battstat/org.gnome.applets.BattstatApplet.panel-applet.in.in
battstat/org.gnome.gnome-applets.battstat.gschema.xml.in.in
battstat/properties.c
battstat/sounds/battstat_applet.soundlist.in
charpick/charpick.c
+[type: gettext/glade]charpick/charpick-applet-menu.xml
[type: gettext/ini]charpick/org.gnome.applets.CharpickerApplet.panel-applet.in.in
charpick/org.gnome.gnome-applets.charpick.gschema.xml.in.in
charpick/properties.c
+[type: gettext/glade]cpufreq/cpufreq-applet-menu.xml
[type: gettext/glade]cpufreq/cpufreq-preferences.ui
[type: gettext/ini]cpufreq/org.gnome.applets.CPUFreqApplet.panel-applet.in.in
cpufreq/org.gnome.gnome-applets.cpufreq.gschema.xml.in.in
@@ -26,19 +30,23 @@ cpufreq/src/cpufreq-popup.c
cpufreq/src/cpufreq-selector/org.gnome.cpufreqselector.policy.in
drivemount/drive-button.c
drivemount/drivemount.c
+[type: gettext/glade]drivemount/drivemount-applet-menu.xml
[type: gettext/ini]drivemount/org.gnome.applets.DriveMountApplet.panel-applet.in.in
geyes/geyes.c
+[type: gettext/glade]geyes/geyes-applet-menu.xml
[type: gettext/ini]geyes/org.gnome.applets.GeyesApplet.panel-applet.in.in
geyes/org.gnome.gnome-applets.geyes.gschema.xml.in.in
geyes/themes.c
gweather/gweather-about.c
gweather/gweather-applet.c
+[type: gettext/glade]gweather/gweather-applet-menu.xml
gweather/gweather-dialog.c
gweather/gweather-pref.c
gweather/main.c
gweather/org.gnome.gnome-applets.gweather.gschema.xml.in.in
[type: gettext/ini]gweather/org.gnome.applets.GWeatherApplet.panel-applet.in.in
[type: gettext/ini]invest-applet/data/org.gnome.applets.InvestApplet.panel-applet.in.in
+[type: gettext/glade]invest-applet/data/invest-applet-menu.xml
[type: gettext/glade]invest-applet/data/financialchart.ui
[type: gettext/glade]invest-applet/data/prefs-dialog.ui
invest-applet/invest/about.py
@@ -55,6 +63,7 @@ mini-commander/src/exec.c
mini-commander/src/help.c
mini-commander/src/history.c
mini-commander/src/macro.c
+[type: gettext/glade]mini-commander/src/mini-commander-applet-menu.xml
[type: gettext/glade]mini-commander/src/mini-commander.ui
mini-commander/src/mini-commander_applet.c
[type: gettext/ini]mini-commander/src/org.gnome.applets.MiniCommanderApplet.panel-applet.in.in
@@ -63,15 +72,18 @@ mini-commander/src/preferences.c
mixer/applet.c
mixer/dock.c
mixer/load.c
+[type: gettext/glade]mixer/mixer-applet-menu.xml
[type: gettext/ini]mixer/org.gnome.applets.MixerApplet.panel-applet.in.in
mixer/org.gnome.gnome-applets.mixer.gschema.xml.in.in
mixer/preferences.c
modemlights/modem-applet.c
+[type: gettext/glade]modemlights/modem-applet-menu.xml
[type: gettext/glade]modemlights/modemlights.ui
[type: gettext/ini]modemlights/org.gnome.applets.ModemApplet.panel-applet.in.in
multiload/linux-proc.c
multiload/load-graph.c
multiload/main.c
+[type: gettext/glade]multiload/multiload-applet-menu.xml
multiload/netspeed.c
[type: gettext/ini]multiload/org.gnome.applets.MultiLoadApplet.panel-applet.in.in
multiload/org.gnome.gnome-applets.multiload.gschema.xml.in.in
@@ -82,11 +94,14 @@ stickynotes/stickynotes.c
stickynotes/stickynotes_applet.c
stickynotes/stickynotes_applet_callbacks.c
stickynotes/stickynotes_callbacks.c
+[type: gettext/glade]stickynotes/stickynotes-applet-menu.xml
[type: gettext/ini]trashapplet/org.gnome.applets.TrashApplet.panel-applet.in.in
stickynotes/org.gnome.gnome-applets.stickynotes.gschema.xml.in.in
trashapplet/src/trashapplet.c
trashapplet/src/trash-empty.c
+[type: gettext/glade]trashapplet/trashapplet-menu.xml
[type: gettext/glade]trashapplet/trashapplet-empty-progress.ui
+[type: gettext/glade]windowpicker/data/menu.xml
windowpicker/src/applet.c
windowpicker/src/task-title.c
windowpicker/src/task-item.c
diff --git a/stickynotes/stickynotes-applet-menu.xml b/stickynotes/stickynotes-applet-menu.xml
index 95d5659..12cd779 100644
--- a/stickynotes/stickynotes-applet-menu.xml
+++ b/stickynotes/stickynotes-applet-menu.xml
@@ -1,10 +1,32 @@
-<menuitem name="new_note" action="new_note" />
-<menuitem name="hide_notes" action="hide_notes" />
-<menuitem name="lock" action="lock" />
-<menuitem name="destroy_all" action="destroy_all" />
-<separator/>
-<menuitem name="preferences" action="preferences" />
-<menuitem name="help" action="help" />
-<menuitem name="about" action="about" />
-
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_New Note</attribute>
+ <attribute name="action">stickynotes.new-note</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Hi_de Notes</attribute>
+ <attribute name="action">stickynotes.hide-notes</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Lock Notes</attribute>
+ <attribute name="action">stickynotes.lock</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Delete Notes</attribute>
+ <attribute name="action">stickynotes.destroy-all</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">stickynotes.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">stickynotes.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">stickynotes.about</attribute>
+ </item>
+</section>
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 0e52750..b0cd57c 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -29,33 +29,14 @@
StickyNotes *stickynotes = NULL;
/* Popup menu on the applet */
-static const GtkActionEntry stickynotes_applet_menu_actions[] =
-{
- { "new_note", GTK_STOCK_NEW, N_("_New Note"),
- NULL, NULL,
- G_CALLBACK (menu_new_note_cb) },
- { "hide_notes", NULL, N_("Hi_de Notes"),
- NULL, NULL,
- G_CALLBACK (menu_hide_notes_cb) },
- { "destroy_all", GTK_STOCK_DELETE, N_("_Delete Notes"),
- NULL, NULL,
- G_CALLBACK (menu_destroy_all_cb) },
- { "preferences", GTK_STOCK_PROPERTIES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (menu_preferences_cb) },
- { "help", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (menu_help_cb) },
- { "about", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (menu_about_cb) }
-};
-
-static const GtkToggleActionEntry stickynotes_applet_menu_toggle_actions[] =
-{
- { "lock", NULL, N_("_Lock Notes"),
- NULL, NULL,
- G_CALLBACK (menu_toggle_lock_cb), FALSE }
+static const GActionEntry stickynotes_applet_menu_actions [] = {
+ { "new-note", menu_new_note_cb, NULL, NULL, NULL },
+ { "hide-notes", menu_hide_notes_cb, NULL, NULL, NULL },
+ { "lock", menu_toggle_lock_cb, NULL, "false", menu_toggle_lock_state },
+ { "destroy-all", menu_destroy_all_cb, NULL, NULL, NULL },
+ { "preferences", menu_preferences_cb, NULL, NULL, NULL },
+ { "help", menu_help_cb, NULL, NULL, NULL },
+ { "about", menu_about_cb, NULL, NULL, NULL }
};
/* Sticky Notes Icons */
@@ -342,6 +323,7 @@ StickyNotesApplet * stickynotes_applet_new(PanelApplet *panel_applet)
{
AtkObject *atk_obj;
gchar *ui_path;
+ GAction *action;
/* Create Sticky Notes Applet */
StickyNotesApplet *applet = g_new(StickyNotesApplet, 1);
@@ -364,26 +346,22 @@ StickyNotesApplet * stickynotes_applet_new(PanelApplet *panel_applet)
stickynotes_applet_update_icon(applet);
/* Add the popup menu */
- applet->action_group = gtk_action_group_new ("StickyNotes Applet Actions");
- gtk_action_group_set_translation_domain (applet->action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (applet->action_group,
- stickynotes_applet_menu_actions,
- G_N_ELEMENTS (stickynotes_applet_menu_actions),
- applet);
- gtk_action_group_add_toggle_actions (applet->action_group,
- stickynotes_applet_menu_toggle_actions,
- G_N_ELEMENTS (stickynotes_applet_menu_toggle_actions),
- applet);
+ applet->action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (applet->action_group),
+ stickynotes_applet_menu_actions,
+ G_N_ELEMENTS (stickynotes_applet_menu_actions),
+ applet);
ui_path = g_build_filename (STICKYNOTES_MENU_UI_DIR, "stickynotes-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file(panel_applet, ui_path, applet->action_group);
+ panel_applet_setup_menu_from_file(panel_applet, ui_path, applet->action_group, GETTEXT_PACKAGE);
g_free (ui_path);
- if (panel_applet_get_locked_down (panel_applet)) {
- GtkAction *action;
+ gtk_widget_insert_action_group (GTK_WIDGET (panel_applet), "stickynotes",
+ G_ACTION_GROUP (applet->action_group));
- action = gtk_action_group_get_action (applet->action_group, "preferences");
- gtk_action_set_visible (action, FALSE);
- }
+ action = g_action_map_lookup_action (G_ACTION_MAP (applet->action_group), "preferences");
+ g_object_bind_property (panel_applet, "locked-down",
+ action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
/* Connect all signals for applet management */
g_signal_connect(G_OBJECT(applet->w_applet), "button-press-event",
@@ -557,22 +535,10 @@ void stickynotes_applet_update_menus(void)
for (l = stickynotes->applets; l != NULL; l = l->next) {
StickyNotesApplet *applet = l->data;
- GSList *proxies, *p;
-
- GtkAction *action = gtk_action_group_get_action (applet->action_group, "lock");
- g_object_set (action,
- "active", locked,
- "sensitive", locked_writable,
- NULL);
-
- proxies = gtk_action_get_proxies (action);
- for (p = proxies; p; p = g_slist_next (p)) {
- if (GTK_IS_CHECK_MENU_ITEM (p->data)) {
- gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (p->data),
- inconsistent);
- }
- }
+ GSimpleAction *action = (GSimpleAction *) g_action_map_lookup_action (G_ACTION_MAP
(applet->action_group), "lock");
+ g_simple_action_set_enabled (action, locked_writable);
+ g_simple_action_set_state (action, g_variant_new_boolean (locked));
}
}
diff --git a/stickynotes/stickynotes_applet.h b/stickynotes/stickynotes_applet.h
index c14eac0..ee1bece 100644
--- a/stickynotes/stickynotes_applet.h
+++ b/stickynotes/stickynotes_applet.h
@@ -91,7 +91,7 @@ typedef struct
gint panel_size;
PanelAppletOrient panel_orient;
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
GtkWidget *menu_tip;
} StickyNotesApplet;
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index fb74e4a..d426e1d 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -278,20 +278,22 @@ destroy_all_response_cb (GtkDialog *dialog, gint id, StickyNotesApplet *applet)
}
/* Menu Callback : New Note */
-void menu_new_note_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_new_note_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
+ StickyNotesApplet *applet = (StickyNotesApplet *) user_data;
popup_add_note (applet, NULL);
}
/* Menu Callback : Hide Notes */
-void menu_hide_notes_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_hide_notes_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
stickynote_show_notes (FALSE);
}
/* Menu Callback : Destroy all sticky notes */
-void menu_destroy_all_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_destroy_all_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
+ StickyNotesApplet *applet = (StickyNotesApplet *) user_data;
GtkBuilder *builder;
builder = gtk_builder_new ();
@@ -320,25 +322,34 @@ void menu_destroy_all_cb(GtkAction *action, StickyNotesApplet *applet)
}
/* Menu Callback: Lock/Unlock sticky notes */
-void menu_toggle_lock_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_toggle_lock_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
- gboolean locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ GVariant *state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_variant_unref (state);
+}
+
+void menu_toggle_lock_state(GSimpleAction *action, GVariant *value, gpointer user_data)
+{
+ gboolean locked = g_variant_get_boolean (value);
if (g_settings_is_writable (stickynotes->settings, KEY_LOCKED))
g_settings_set_boolean (stickynotes->settings, KEY_LOCKED, locked);
}
/* Menu Callback : Configure preferences */
-void menu_preferences_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_preferences_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
+ StickyNotesApplet *applet = (StickyNotesApplet *) user_data;
stickynotes_applet_update_prefs();
gtk_window_set_screen(GTK_WINDOW(stickynotes->w_prefs), gtk_widget_get_screen(applet->w_applet));
gtk_window_present(GTK_WINDOW(stickynotes->w_prefs));
}
/* Menu Callback : Show help */
-void menu_help_cb(GtkAction *action, StickyNotesApplet *applet)
+void menu_help_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
+ StickyNotesApplet *applet = (StickyNotesApplet *) user_data;
GError *error = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (applet->w_applet)),
"help:stickynotes_applet",
@@ -357,8 +368,7 @@ void menu_help_cb(GtkAction *action, StickyNotesApplet *applet)
/* Menu Callback : Display About window */
void
-menu_about_cb (GtkAction *action,
- StickyNotesApplet *applet)
+menu_about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
static const gchar *authors[] = {
"Loban A Rahman <loban earthling net>",
diff --git a/stickynotes/stickynotes_applet_callbacks.h b/stickynotes/stickynotes_applet_callbacks.h
index 4f5eb48..034cdf5 100644
--- a/stickynotes/stickynotes_applet_callbacks.h
+++ b/stickynotes/stickynotes_applet_callbacks.h
@@ -32,14 +32,15 @@ void applet_change_orient_cb(PanelApplet *panel_applet, PanelAppletOrient orient
void applet_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, StickyNotesApplet *applet);
void applet_destroy_cb (PanelApplet *panel_applet, StickyNotesApplet *applet);
/* Callbacks for sticky notes applet menu */
-void menu_create_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_new_note_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_hide_notes_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_destroy_all_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_toggle_lock_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_preferences_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_help_cb(GtkAction *action, StickyNotesApplet *applet);
-void menu_about_cb(GtkAction *action, StickyNotesApplet *applet);
+void menu_create_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_new_note_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_hide_notes_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_destroy_all_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_toggle_lock_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_toggle_lock_state(GSimpleAction *action, GVariant *value, gpointer user_data);
+void menu_preferences_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_help_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
+void menu_about_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
/* Callbacks for sticky notes preferences dialog */
void preferences_save_cb(gpointer data);
diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c
index 5c0ac94..6e700f5 100644
--- a/trashapplet/src/trashapplet.c
+++ b/trashapplet/src/trashapplet.c
@@ -55,28 +55,24 @@ G_DEFINE_TYPE (TrashApplet, trash_applet, PANEL_TYPE_APPLET);
#define TRASH_APPLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TRASH_TYPE_APPLET, TrashApplet))
-static void trash_applet_do_empty (GtkAction *action,
- TrashApplet *applet);
-static void trash_applet_show_about (GtkAction *action,
- TrashApplet *applet);
-static void trash_applet_open_folder (GtkAction *action,
- TrashApplet *applet);
-static void trash_applet_show_help (GtkAction *action,
- TrashApplet *applet);
-
-static const GtkActionEntry trash_applet_menu_actions [] = {
- { "EmptyTrash", GTK_STOCK_CLEAR, N_("_Empty Trash"),
- NULL, NULL,
- G_CALLBACK (trash_applet_do_empty) },
- { "OpenTrash", GTK_STOCK_OPEN, N_("_Open Trash"),
- NULL, NULL,
- G_CALLBACK (trash_applet_open_folder) },
- { "HelpTrash", GTK_STOCK_HELP, N_("_Help"),
- NULL, NULL,
- G_CALLBACK (trash_applet_show_help) },
- { "AboutTrash", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (trash_applet_show_about) }
+static void trash_applet_do_empty (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void trash_applet_show_about (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void trash_applet_open_folder (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void trash_applet_show_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+
+static const GActionEntry trash_applet_menu_actions [] = {
+ { "open", trash_applet_open_folder, NULL, NULL, NULL },
+ { "empty", trash_applet_do_empty, NULL, NULL, NULL },
+ { "help", trash_applet_show_help, NULL, NULL, NULL },
+ { "about", trash_applet_show_about, NULL, NULL, NULL }
};
static void
@@ -250,7 +246,7 @@ trash_applet_button_release (GtkWidget *widget,
if (event->button == 1)
{
- trash_applet_open_folder (NULL, applet);
+ trash_applet_open_folder (NULL, NULL, applet);
return TRUE;
}
@@ -275,7 +271,7 @@ trash_applet_key_press (GtkWidget *widget,
case GDK_KEY_Return:
case GDK_KEY_space:
case GDK_KEY_KP_Space:
- trash_applet_open_folder (NULL, applet);
+ trash_applet_open_folder (NULL, NULL, applet);
return TRUE;
default:
@@ -346,16 +342,20 @@ error_dialog (TrashApplet *applet, const gchar *error, ...)
}
static void
-trash_applet_do_empty (GtkAction *action,
- TrashApplet *applet)
+trash_applet_do_empty (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ TrashApplet *applet = (TrashApplet *) user_data;
trash_empty (GTK_WIDGET (applet));
}
static void
-trash_applet_open_folder (GtkAction *action,
- TrashApplet *applet)
+trash_applet_open_folder (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ TrashApplet *applet = (TrashApplet *) user_data;
GError *err = NULL;
gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (applet)),
@@ -372,9 +372,11 @@ trash_applet_open_folder (GtkAction *action,
}
static void
-trash_applet_show_help (GtkAction *action,
- TrashApplet *applet)
+trash_applet_show_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ TrashApplet *applet = (TrashApplet *) user_data;
GError *err = NULL;
/* FIXME - Actually, we need a user guide */
@@ -394,8 +396,9 @@ trash_applet_show_help (GtkAction *action,
static void
-trash_applet_show_about (GtkAction *action,
- TrashApplet *applet)
+trash_applet_show_about (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
static const char *authors[] = {
"Michiel Sikkes <michiel eyesopened nl>",
@@ -599,7 +602,7 @@ trash_applet_factory (PanelApplet *applet,
if (!strcmp (iid, "TrashApplet"))
{
- GtkActionGroup *action_group;
+ GSimpleActionGroup *action_group;
gchar *ui_path;
g_set_application_name (_("Trash Applet"));
@@ -607,15 +610,18 @@ trash_applet_factory (PanelApplet *applet,
gtk_window_set_default_icon_name ("user-trash");
/* Set up the menu */
- action_group = gtk_action_group_new ("Trash Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- trash_applet_menu_actions,
- G_N_ELEMENTS (trash_applet_menu_actions),
- applet);
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ trash_applet_menu_actions,
+ G_N_ELEMENTS (trash_applet_menu_actions),
+ applet);
ui_path = g_build_filename (TRASH_MENU_UI_DIR, "trashapplet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (applet, ui_path, action_group);
+ panel_applet_setup_menu_from_file (applet, ui_path, action_group, GETTEXT_PACKAGE);
g_free (ui_path);
+
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "trash",
+ G_ACTION_GROUP (action_group));
+
g_object_unref (action_group);
gtk_widget_show (GTK_WIDGET (applet));
diff --git a/trashapplet/trashapplet-menu.xml b/trashapplet/trashapplet-menu.xml
index e2bc535..a1a85c6 100644
--- a/trashapplet/trashapplet-menu.xml
+++ b/trashapplet/trashapplet-menu.xml
@@ -1,6 +1,20 @@
-<menuitem name="Open Trash Item" action="OpenTrash" />
-<menuitem name="Empty Trash Item" action="EmptyTrash" />
-<separator/>
-<menuitem name="Open Help Item" action="HelpTrash" />
-<menuitem name="About Item" action="AboutTrash" />
-
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Open Trash</attribute>
+ <attribute name="action">trash.open</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Empty Trash</attribute>
+ <attribute name="action">trash.empty</attribute>
+ </item>
+</section>
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">trash.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">trash.about</attribute>
+ </item>
+</section>
diff --git a/windowpicker/data/menu.xml b/windowpicker/data/menu.xml
index bbce6f0..227f5a9 100644
--- a/windowpicker/data/menu.xml
+++ b/windowpicker/data/menu.xml
@@ -1,2 +1,10 @@
-<menuitem name="Preferences" action="Preferences" />
-<menuitem name="About" action="About" />
+<section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">window-picker-applet.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">window-picker-applet.about</attribute>
+ </item>
+</section>
diff --git a/windowpicker/src/applet.c b/windowpicker/src/applet.c
index 435e724..ba8188a 100644
--- a/windowpicker/src/applet.c
+++ b/windowpicker/src/applet.c
@@ -66,16 +66,16 @@ enum {
G_DEFINE_TYPE_WITH_PRIVATE(WindowPickerApplet, window_picker_applet, PANEL_TYPE_APPLET);
-static void display_about_dialog (GtkAction *action, WindowPickerApplet *applet);
-static void display_prefs_dialog (GtkAction *action, WindowPickerApplet *applet);
-
-static const GtkActionEntry menuActions [] = {
- {"Preferences", GTK_STOCK_PREFERENCES, N_("_Preferences"),
- NULL, NULL,
- G_CALLBACK (display_prefs_dialog) },
- { "About", GTK_STOCK_ABOUT, N_("_About"),
- NULL, NULL,
- G_CALLBACK (display_about_dialog) }
+static void display_about_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void display_prefs_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+
+static const GActionEntry menu_actions[] = {
+ { "preferences", display_prefs_dialog },
+ { "about", display_about_dialog }
};
static const gchar *windowPickerAppletAuthors[] = {
@@ -110,19 +110,24 @@ static inline void loadAppletStyle (GtkWidget *widget) {
}
}
-static void setupPanelContextMenu(WindowPickerApplet *windowPickerApplet) {
- GtkActionGroup* action_group = gtk_action_group_new ("Window Picker Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- menuActions,
- G_N_ELEMENTS (menuActions),
- windowPickerApplet);
- char *ui_path = g_build_filename (WINDOW_PICKER_MENU_UI_DIR, "menu.xml", NULL);
- panel_applet_setup_menu_from_file(
- PANEL_APPLET(windowPickerApplet),
- ui_path,
- action_group
- );
+static void
+setupPanelContextMenu (WindowPickerApplet *windowPickerApplet)
+{
+ GSimpleActionGroup *action_group;
+ gchar *ui_path;
+
+ action_group = g_simple_action_group_new ();
+ ui_path = g_build_filename (WINDOW_PICKER_MENU_UI_DIR, "menu.xml", NULL);
+
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group), menu_actions,
+ G_N_ELEMENTS (menu_actions), windowPickerApplet);
+
+ panel_applet_setup_menu_from_file (PANEL_APPLET (windowPickerApplet), ui_path,
+ action_group, GETTEXT_PACKAGE);
+
+ gtk_widget_insert_action_group (GTK_WIDGET (windowPickerApplet), "window-picker-applet",
+ G_ACTION_GROUP (action_group));
+
g_free(ui_path);
g_object_unref (action_group);
}
@@ -184,8 +189,10 @@ load_window_picker (PanelApplet *applet) {
return TRUE;
}
-static void display_about_dialog (GtkAction *action,
- WindowPickerApplet *windowPickerApplet)
+static void
+display_about_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GtkWidget *panel_about_dialog = gtk_about_dialog_new ();
g_object_set (panel_about_dialog,
@@ -230,9 +237,12 @@ prepareCheckBox (WindowPickerApplet *windowPickerApplet,
}
static void
-display_prefs_dialog (GtkAction *action,
- WindowPickerApplet *windowPickerApplet)
+display_prefs_dialog (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ WindowPickerApplet *windowPickerApplet = WINDOW_PICKER_APPLET (user_data);
+
//Setup the Preferences window
GtkWidget *window, *notebook, *check, *button, *grid;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]