~ps-jenkins/ido/latestsnapshot-13.10.0+13.10.20130930-0ubuntu1

« back to all changes in this revision

Viewing changes to src/idoactionhelper.h

  • Committer: Tarmac
  • Author(s): Charles Kerr, Lars Uebernickel
  • Date: 2013-05-31 19:51:15 UTC
  • mfrom: (126.1.12 support-slider)
  • Revision ID: tarmac-20130531195115-c2c11w551db984km
Put a framework in place to move custom menu items from the indicator packages into ido. It depends on a vendor-patch to gtk (see bug #1183505), because gtk+ does not yet have an API for inserting arbitrary menu items into menus created with gtk_menu_new_from_model().

IdoMenuItemFactory implements the GtkMenuItemFactory interface, which is used by (the patched) gtk+ to create menu items that have an "x-canonical-type" attribute.

IdoActionHelper contains some common functionality that all menu items need (watching the action group for action additions and removals, as well es enabled and state changes). It can be used to glue a menu item widget to an action in IdoMenuItemFactory.

This changeset also adds the first widget: IdoUserMenuItem (merged from lp:~charlesk/ido/add-idousermenuitem). Please follow this example when adding additional widgets.

Approved by PS Jenkins bot, Ted Gould.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Copyright 2013 Canonical Ltd.
 
3
*
 
4
* This program is free software: you can redistribute it and/or modify it
 
5
* under the terms of the GNU General Public License version 3, as published
 
6
* by the Free Software Foundation.
 
7
*
 
8
* This program is distributed in the hope that it will be useful, but
 
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
* PURPOSE.  See the GNU General Public License for more details.
 
12
*
 
13
* You should have received a copy of the GNU General Public License along
 
14
* with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
*
 
16
* Authors:
 
17
*     Lars Uebernickel <lars.uebernickel@canonical.com>
 
18
*/
 
19
 
 
20
#ifndef __IDO_ACTION_HELPER_H__
 
21
#define __IDO_ACTION_HELPER_H__
 
22
 
 
23
#include <gtk/gtk.h>
 
24
 
 
25
#define IDO_TYPE_ACTION_HELPER  (ido_action_helper_get_type ())
 
26
#define IDO_ACTION_HELPER(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), IDO_TYPE_ACTION_HELPER, IdoActionHelper))
 
27
#define IDO_IS_ACTION_HELPER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), IDO_TYPE_ACTION_HELPER))
 
28
 
 
29
typedef struct _IdoActionHelper IdoActionHelper;
 
30
 
 
31
GType               ido_menu_item_get_type              (void);
 
32
 
 
33
IdoActionHelper *   ido_action_helper_new               (GtkWidget    *widget,
 
34
                                                         GActionGroup *action_group,
 
35
                                                         const gchar  *action_name,
 
36
                                                         GVariant     *target);
 
37
 
 
38
GtkWidget *         ido_action_helper_get_widget        (IdoActionHelper *helper);
 
39
 
 
40
GVariant *          ido_action_helper_get_action_target (IdoActionHelper *helper);
 
41
 
 
42
void                ido_action_helper_activate          (IdoActionHelper *helper);
 
43
 
 
44
#endif