diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-05-22 23:19:50 -0400 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-05-22 23:19:50 -0400 |
commit | 12a5f15581d2c8ba5e6b4ec4baa19bd436e4fd8d (patch) | |
tree | db7b5c3a4ed464a8445de8ae4e8a21ab604d8b6a /src/idoactionhelper.h | |
parent | 3f3aa147ac8ee224f40d9c4e9800b4c5825fde59 (diff) | |
download | ayatana-ido-12a5f15581d2c8ba5e6b4ec4baa19bd436e4fd8d.tar.gz ayatana-ido-12a5f15581d2c8ba5e6b4ec4baa19bd436e4fd8d.tar.bz2 ayatana-ido-12a5f15581d2c8ba5e6b4ec4baa19bd436e4fd8d.zip |
Add IdoActionHelper
This class contains some functionality that all menu items that are bound to
an action need. It listens for action additions and removals, changes in
enabled state, and state changes. It is _not_ intended to be used by specific
menu items, but rather as the glue in IdoMenuItemFactory, to bind a widget to
an action.
An alternative way to reach the same goal is to have an IdoMenuItem base class
which contains the common functionality. This would have required touching
all existing menu items (slider, user menu item, media player items) and
would have added more complexity to them.
It is similar in spirit to GtkActionHelper (a private class in gtk), but very
different in API and implementation.
Diffstat (limited to 'src/idoactionhelper.h')
-rw-r--r-- | src/idoactionhelper.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/idoactionhelper.h b/src/idoactionhelper.h new file mode 100644 index 0000000..22cdcae --- /dev/null +++ b/src/idoactionhelper.h @@ -0,0 +1,44 @@ +/* +* Copyright 2013 Canonical Ltd. +* +* This program is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 3, as published +* by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranties of +* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +* +* Authors: +* Lars Uebernickel <lars.uebernickel@canonical.com> +*/ + +#ifndef __IDO_ACTION_HELPER_H__ +#define __IDO_ACTION_HELPER_H__ + +#include <gtk/gtk.h> + +#define IDO_TYPE_ACTION_HELPER (ido_action_helper_get_type ()) +#define IDO_ACTION_HELPER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), IDO_TYPE_ACTION_HELPER, IdoActionHelper)) +#define IDO_IS_ACTION_HELPER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), IDO_TYPE_ACTION_HELPER)) + +typedef struct _IdoActionHelper IdoActionHelper; + +GType ido_menu_item_get_type (void); + +IdoActionHelper * ido_action_helper_new (GtkWidget *widget, + GActionGroup *action_group, + const gchar *action_name, + GVariant *target); + +GtkWidget * ido_action_helper_get_widget (IdoActionHelper *helper); + +GVariant * ido_action_helper_get_action_target (IdoActionHelper *helper); + +void ido_action_helper_activate (IdoActionHelper *helper); + +#endif |