2003-08-24 19:58:30 +00:00
|
|
|
/*
|
2008-07-01 22:57:50 +00:00
|
|
|
* GTK - The GIMP Toolkit
|
2003-08-24 19:58:30 +00:00
|
|
|
* Copyright (C) 1998, 1999 Red Hat, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This Library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This Library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
|
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Author: James Henstridge <james@daa.com.au>
|
|
|
|
*
|
|
|
|
* Modified by the GTK+ Team and others 2003. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
#include "gtkaction.h"
|
2004-01-12 22:45:45 +00:00
|
|
|
#include "gtkactiongroup.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
#include "gtkaccellabel.h"
|
2003-09-04 21:34:15 +00:00
|
|
|
#include "gtkbutton.h"
|
2006-06-22 15:56:55 +00:00
|
|
|
#include "gtkiconfactory.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
#include "gtkimage.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
#include "gtkimagemenuitem.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
#include "gtkintl.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
#include "gtklabel.h"
|
2003-09-26 23:01:32 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
#include "gtkmenuitem.h"
|
|
|
|
#include "gtkstock.h"
|
2003-09-30 20:55:24 +00:00
|
|
|
#include "gtktearoffmenuitem.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
#include "gtktoolbutton.h"
|
|
|
|
#include "gtktoolbar.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
#include "gtkprivate.h"
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
#include "gtkbuildable.h"
|
2009-01-23 15:15:28 +00:00
|
|
|
#include "gtkactivatable.h"
|
2005-03-20 07:01:23 +00:00
|
|
|
#include "gtkalias.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define GTK_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION, GtkActionPrivate))
|
|
|
|
|
|
|
|
struct _GtkActionPrivate
|
|
|
|
{
|
2007-07-10 22:18:08 +00:00
|
|
|
const gchar *name; /* interned */
|
2003-08-24 19:58:30 +00:00
|
|
|
gchar *label;
|
|
|
|
gchar *short_label;
|
|
|
|
gchar *tooltip;
|
2006-03-13 05:11:23 +00:00
|
|
|
gchar *stock_id; /* stock icon */
|
|
|
|
gchar *icon_name; /* themed icon */
|
2009-01-08 05:37:39 +00:00
|
|
|
GIcon *gicon;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2004-08-04 05:06:59 +00:00
|
|
|
guint sensitive : 1;
|
|
|
|
guint visible : 1;
|
|
|
|
guint label_set : 1; /* these two used so we can set label */
|
|
|
|
guint short_label_set : 1; /* based on stock id */
|
2004-01-02 23:14:28 +00:00
|
|
|
guint visible_horizontal : 1;
|
|
|
|
guint visible_vertical : 1;
|
2004-08-04 05:06:59 +00:00
|
|
|
guint is_important : 1;
|
|
|
|
guint hide_if_empty : 1;
|
|
|
|
guint visible_overflown : 1;
|
2009-08-16 20:57:49 +00:00
|
|
|
guint always_show_image : 1;
|
2009-01-23 15:15:28 +00:00
|
|
|
guint recursion_guard : 1;
|
|
|
|
guint activate_blocked : 1;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
/* accelerator */
|
2003-09-17 23:58:28 +00:00
|
|
|
guint accel_count;
|
|
|
|
GtkAccelGroup *accel_group;
|
|
|
|
GClosure *accel_closure;
|
|
|
|
GQuark accel_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
GtkActionGroup *action_group;
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/* list of proxy widgets */
|
|
|
|
GSList *proxies;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACTIVATE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_NAME,
|
|
|
|
PROP_LABEL,
|
|
|
|
PROP_SHORT_LABEL,
|
|
|
|
PROP_TOOLTIP,
|
|
|
|
PROP_STOCK_ID,
|
2006-03-13 05:11:23 +00:00
|
|
|
PROP_ICON_NAME,
|
2009-01-08 05:37:39 +00:00
|
|
|
PROP_GICON,
|
2004-01-02 23:14:28 +00:00
|
|
|
PROP_VISIBLE_HORIZONTAL,
|
|
|
|
PROP_VISIBLE_VERTICAL,
|
2004-08-04 05:06:59 +00:00
|
|
|
PROP_VISIBLE_OVERFLOWN,
|
2003-08-31 23:36:37 +00:00
|
|
|
PROP_IS_IMPORTANT,
|
2003-10-01 19:07:36 +00:00
|
|
|
PROP_HIDE_IF_EMPTY,
|
2003-08-24 19:58:30 +00:00
|
|
|
PROP_SENSITIVE,
|
2004-01-12 22:45:45 +00:00
|
|
|
PROP_VISIBLE,
|
2009-08-16 20:57:49 +00:00
|
|
|
PROP_ACTION_GROUP,
|
|
|
|
PROP_ALWAYS_SHOW_IMAGE
|
2003-08-24 19:58:30 +00:00
|
|
|
};
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
/* GtkBuildable */
|
|
|
|
static void gtk_action_buildable_init (GtkBuildableIface *iface);
|
|
|
|
static void gtk_action_buildable_set_name (GtkBuildable *buildable,
|
|
|
|
const gchar *name);
|
|
|
|
static const gchar* gtk_action_buildable_get_name (GtkBuildable *buildable);
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkAction, gtk_action, G_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
|
|
gtk_action_buildable_init))
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
static void gtk_action_finalize (GObject *object);
|
|
|
|
static void gtk_action_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_action_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2006-01-03 06:19:00 +00:00
|
|
|
static void gtk_action_set_action_group (GtkAction *action,
|
2004-01-12 22:45:45 +00:00
|
|
|
GtkActionGroup *action_group);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
static GtkWidget *create_menu_item (GtkAction *action);
|
|
|
|
static GtkWidget *create_tool_item (GtkAction *action);
|
2007-03-15 19:33:57 +00:00
|
|
|
static void connect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy);
|
2003-08-24 19:58:30 +00:00
|
|
|
static void disconnect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy);
|
2009-01-23 15:15:28 +00:00
|
|
|
|
2003-09-17 23:58:28 +00:00
|
|
|
static void closure_accel_activate (GClosure *closure,
|
|
|
|
GValue *return_value,
|
|
|
|
guint n_param_values,
|
|
|
|
const GValue *param_values,
|
|
|
|
gpointer invocation_hint,
|
|
|
|
gpointer marshal_data);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
static guint action_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_action_class_init (GtkActionClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->finalize = gtk_action_finalize;
|
|
|
|
gobject_class->set_property = gtk_action_set_property;
|
|
|
|
gobject_class->get_property = gtk_action_get_property;
|
|
|
|
|
|
|
|
klass->activate = NULL;
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
klass->create_menu_item = create_menu_item;
|
|
|
|
klass->create_tool_item = create_tool_item;
|
|
|
|
klass->create_menu = NULL;
|
|
|
|
klass->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
|
2003-08-24 19:58:30 +00:00
|
|
|
klass->toolbar_item_type = GTK_TYPE_TOOL_BUTTON;
|
2009-01-23 15:15:28 +00:00
|
|
|
klass->connect_proxy = connect_proxy;
|
|
|
|
klass->disconnect_proxy = disconnect_proxy;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_NAME,
|
|
|
|
g_param_spec_string ("name",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Name"),
|
|
|
|
P_("A unique name for the action."),
|
2003-08-24 19:58:30 +00:00
|
|
|
NULL,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2006-12-31 04:14:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkAction:label:
|
|
|
|
*
|
|
|
|
* The label used for menu items and buttons that activate
|
|
|
|
* this action. If the label is %NULL, GTK+ uses the stock
|
|
|
|
* label specified via the stock-id property.
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
|
|
|
* This is an appearance property and thus only applies if
|
|
|
|
* #GtkActivatable:use-action-appearance is %TRUE.
|
2006-12-31 04:14:28 +00:00
|
|
|
*/
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_LABEL,
|
|
|
|
g_param_spec_string ("label",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Label"),
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("The label used for menu items and buttons "
|
|
|
|
"that activate this action."),
|
2003-08-24 19:58:30 +00:00
|
|
|
NULL,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2009-01-21 02:53:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkAction:short-label:
|
|
|
|
*
|
|
|
|
* A shorter label that may be used on toolbar buttons.
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
|
|
|
* This is an appearance property and thus only applies if
|
|
|
|
* #GtkActivatable:use-action-appearance is %TRUE.
|
2009-01-21 02:53:45 +00:00
|
|
|
*/
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SHORT_LABEL,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_string ("short-label",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Short label"),
|
|
|
|
P_("A shorter label that may be used on toolbar buttons."),
|
2003-08-24 19:58:30 +00:00
|
|
|
NULL,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2009-01-21 02:53:45 +00:00
|
|
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_TOOLTIP,
|
|
|
|
g_param_spec_string ("tooltip",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Tooltip"),
|
|
|
|
P_("A tooltip for this action."),
|
2003-08-24 19:58:30 +00:00
|
|
|
NULL,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2009-01-21 02:53:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkAction:stock-id:
|
|
|
|
*
|
|
|
|
* The stock icon displayed in widgets representing this action.
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
|
|
|
* This is an appearance property and thus only applies if
|
|
|
|
* #GtkActivatable:use-action-appearance is %TRUE.
|
2009-01-21 02:53:45 +00:00
|
|
|
*/
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_STOCK_ID,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_string ("stock-id",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Stock Icon"),
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("The stock icon displayed in widgets representing "
|
|
|
|
"this action."),
|
2003-08-24 19:58:30 +00:00
|
|
|
NULL,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2009-01-08 05:37:39 +00:00
|
|
|
/**
|
|
|
|
* GtkAction:gicon:
|
|
|
|
*
|
|
|
|
* The #GIcon displayed in the #GtkAction.
|
|
|
|
*
|
|
|
|
* Note that the stock icon is preferred, if the #GtkAction:stock-id
|
|
|
|
* property holds the id of an existing stock icon.
|
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* This is an appearance property and thus only applies if
|
|
|
|
* #GtkActivatable:use-action-appearance is %TRUE.
|
|
|
|
*
|
2009-01-08 05:37:39 +00:00
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_GICON,
|
|
|
|
g_param_spec_object ("gicon",
|
|
|
|
P_("GIcon"),
|
|
|
|
P_("The GIcon being displayed"),
|
|
|
|
G_TYPE_ICON,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2006-03-13 05:11:23 +00:00
|
|
|
/**
|
2006-07-10 16:59:43 +00:00
|
|
|
* GtkAction:icon-name:
|
2006-03-13 05:11:23 +00:00
|
|
|
*
|
|
|
|
* The name of the icon from the icon theme.
|
2009-01-08 05:37:39 +00:00
|
|
|
*
|
|
|
|
* Note that the stock icon is preferred, if the #GtkAction:stock-id
|
|
|
|
* property holds the id of an existing stock icon, and the #GIcon is
|
|
|
|
* preferred if the #GtkAction:gicon property is set.
|
2006-03-13 05:11:23 +00:00
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* This is an appearance property and thus only applies if
|
|
|
|
* #GtkActivatable:use-action-appearance is %TRUE.
|
|
|
|
*
|
2006-03-13 05:11:23 +00:00
|
|
|
* Since: 2.10
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_ICON_NAME,
|
|
|
|
g_param_spec_string ("icon-name",
|
|
|
|
P_("Icon Name"),
|
|
|
|
P_("The name of the icon from the icon theme"),
|
|
|
|
NULL,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2009-01-08 05:37:39 +00:00
|
|
|
|
2004-01-02 23:14:28 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VISIBLE_HORIZONTAL,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("visible-horizontal",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Visible when horizontal"),
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("Whether the toolbar item is visible when the toolbar "
|
|
|
|
"is in a horizontal orientation."),
|
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-08-04 05:06:59 +00:00
|
|
|
/**
|
|
|
|
* GtkAction:visible-overflown:
|
|
|
|
*
|
|
|
|
* When %TRUE, toolitem proxies for this action are represented in the
|
|
|
|
* toolbar overflow menu.
|
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VISIBLE_OVERFLOWN,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("visible-overflown",
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("Visible when overflown"),
|
|
|
|
P_("When TRUE, toolitem proxies for this action "
|
|
|
|
"are represented in the toolbar overflow menu."),
|
2004-01-02 23:14:28 +00:00
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-02 23:14:28 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VISIBLE_VERTICAL,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("visible-vertical",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Visible when vertical"),
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("Whether the toolbar item is visible when the toolbar "
|
|
|
|
"is in a vertical orientation."),
|
2004-01-02 23:14:28 +00:00
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-31 23:36:37 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_IS_IMPORTANT,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("is-important",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Is important"),
|
2004-08-04 05:06:59 +00:00
|
|
|
P_("Whether the action is considered important. "
|
|
|
|
"When TRUE, toolitem proxies for this action "
|
|
|
|
"show text in GTK_TOOLBAR_BOTH_HORIZ mode."),
|
2003-08-31 23:36:37 +00:00
|
|
|
FALSE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-10-01 19:07:36 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_HIDE_IF_EMPTY,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("hide-if-empty",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Hide if empty"),
|
|
|
|
P_("When TRUE, empty menu proxies for this action are hidden."),
|
2003-10-01 19:07:36 +00:00
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SENSITIVE,
|
|
|
|
g_param_spec_boolean ("sensitive",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Sensitive"),
|
|
|
|
P_("Whether the action is enabled."),
|
2003-08-24 19:58:30 +00:00
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-24 19:58:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VISIBLE,
|
|
|
|
g_param_spec_boolean ("visible",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Visible"),
|
|
|
|
P_("Whether the action is visible."),
|
2003-08-24 19:58:30 +00:00
|
|
|
TRUE,
|
2009-01-23 01:45:46 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-12 22:45:45 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_ACTION_GROUP,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_object ("action-group",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Action Group"),
|
|
|
|
P_("The GtkActionGroup this GtkAction is associated with, or NULL (for internal use)."),
|
2004-01-12 22:45:45 +00:00
|
|
|
GTK_TYPE_ACTION_GROUP,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2009-08-16 20:57:49 +00:00
|
|
|
/**
|
|
|
|
* GtkAction:always-show-image:
|
|
|
|
*
|
|
|
|
* If %TRUE, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images
|
|
|
|
* setting and always show their image, if available.
|
|
|
|
*
|
|
|
|
* Use this property if the menu item would be useless or hard to use
|
|
|
|
* without their image.
|
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
**/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_ALWAYS_SHOW_IMAGE,
|
|
|
|
g_param_spec_boolean ("always-show-image",
|
|
|
|
P_("Always show image"),
|
|
|
|
P_("Whether the image will always be shown"),
|
|
|
|
FALSE,
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2003-08-31 00:27:15 +00:00
|
|
|
/**
|
|
|
|
* GtkAction::activate:
|
|
|
|
* @action: the #GtkAction
|
|
|
|
*
|
|
|
|
* The "activate" signal is emitted when the action is activated.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2003-08-24 19:58:30 +00:00
|
|
|
action_signals[ACTIVATE] =
|
2005-09-01 05:11:46 +00:00
|
|
|
g_signal_new (I_("activate"),
|
2003-08-24 19:58:30 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
G_STRUCT_OFFSET (GtkActionClass, activate), NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
g_type_class_add_private (gobject_class, sizeof (GtkActionPrivate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_action_init (GtkAction *action)
|
|
|
|
{
|
|
|
|
action->private_data = GTK_ACTION_GET_PRIVATE (action);
|
|
|
|
|
|
|
|
action->private_data->name = NULL;
|
|
|
|
action->private_data->label = NULL;
|
|
|
|
action->private_data->short_label = NULL;
|
|
|
|
action->private_data->tooltip = NULL;
|
|
|
|
action->private_data->stock_id = NULL;
|
2006-03-13 05:11:23 +00:00
|
|
|
action->private_data->icon_name = NULL;
|
2004-01-02 23:14:28 +00:00
|
|
|
action->private_data->visible_horizontal = TRUE;
|
|
|
|
action->private_data->visible_vertical = TRUE;
|
2004-08-04 05:06:59 +00:00
|
|
|
action->private_data->visible_overflown = TRUE;
|
2003-08-31 23:36:37 +00:00
|
|
|
action->private_data->is_important = FALSE;
|
2003-10-01 19:07:36 +00:00
|
|
|
action->private_data->hide_if_empty = TRUE;
|
2009-08-16 20:57:49 +00:00
|
|
|
action->private_data->always_show_image = FALSE;
|
2009-01-23 15:15:28 +00:00
|
|
|
action->private_data->activate_blocked = FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
action->private_data->sensitive = TRUE;
|
|
|
|
action->private_data->visible = TRUE;
|
|
|
|
|
|
|
|
action->private_data->label_set = FALSE;
|
|
|
|
action->private_data->short_label_set = FALSE;
|
|
|
|
|
2003-09-17 23:58:28 +00:00
|
|
|
action->private_data->accel_count = 0;
|
2004-04-29 21:36:30 +00:00
|
|
|
action->private_data->accel_group = NULL;
|
|
|
|
action->private_data->accel_quark = 0;
|
2003-09-17 23:58:28 +00:00
|
|
|
action->private_data->accel_closure =
|
|
|
|
g_closure_new_object (sizeof (GClosure), G_OBJECT (action));
|
|
|
|
g_closure_set_marshal (action->private_data->accel_closure,
|
|
|
|
closure_accel_activate);
|
|
|
|
g_closure_ref (action->private_data->accel_closure);
|
|
|
|
g_closure_sink (action->private_data->accel_closure);
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
action->private_data->action_group = NULL;
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
action->private_data->proxies = NULL;
|
2009-01-08 05:37:39 +00:00
|
|
|
action->private_data->gicon = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
static void
|
|
|
|
gtk_action_buildable_init (GtkBuildableIface *iface)
|
|
|
|
{
|
|
|
|
iface->set_name = gtk_action_buildable_set_name;
|
|
|
|
iface->get_name = gtk_action_buildable_get_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_action_buildable_set_name (GtkBuildable *buildable,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
GtkAction *action = GTK_ACTION (buildable);
|
|
|
|
|
2007-07-10 22:18:08 +00:00
|
|
|
action->private_data->name = g_intern_string (name);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gtk_action_buildable_get_name (GtkBuildable *buildable)
|
|
|
|
{
|
|
|
|
GtkAction *action = GTK_ACTION (buildable);
|
|
|
|
|
|
|
|
return action->private_data->name;
|
|
|
|
}
|
|
|
|
|
2004-01-07 21:54:33 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_new:
|
|
|
|
* @name: A unique name for the action
|
2010-02-19 16:53:17 +00:00
|
|
|
* @label: (allow-none): the label displayed in menu items and on buttons, or %NULL
|
|
|
|
* @tooltip: (allow-none): a tooltip for the action, or %NULL
|
2007-09-09 20:18:24 +00:00
|
|
|
* @stock_id: the stock icon to display in widgets representing the
|
|
|
|
* action, or %NULL
|
2004-01-07 21:54:33 +00:00
|
|
|
*
|
|
|
|
* Creates a new #GtkAction object. To add the action to a
|
|
|
|
* #GtkActionGroup and set the accelerator for the action,
|
|
|
|
* call gtk_action_group_add_action_with_accel().
|
2004-08-13 13:48:20 +00:00
|
|
|
* See <xref linkend="XML-UI"/> for information on allowed action
|
2004-08-12 04:03:54 +00:00
|
|
|
* names.
|
2004-01-07 21:54:33 +00:00
|
|
|
*
|
|
|
|
* Return value: a new #GtkAction
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
GtkAction *
|
|
|
|
gtk_action_new (const gchar *name,
|
|
|
|
const gchar *label,
|
|
|
|
const gchar *tooltip,
|
|
|
|
const gchar *stock_id)
|
|
|
|
{
|
2007-09-09 20:18:24 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
return g_object_new (GTK_TYPE_ACTION,
|
|
|
|
"name", name,
|
|
|
|
"label", label,
|
|
|
|
"tooltip", tooltip,
|
|
|
|
"stock-id", stock_id,
|
|
|
|
NULL);
|
2004-01-07 21:54:33 +00:00
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
static void
|
|
|
|
gtk_action_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkAction *action;
|
|
|
|
action = GTK_ACTION (object);
|
|
|
|
|
|
|
|
g_free (action->private_data->label);
|
|
|
|
g_free (action->private_data->short_label);
|
|
|
|
g_free (action->private_data->tooltip);
|
|
|
|
g_free (action->private_data->stock_id);
|
2006-03-13 05:11:23 +00:00
|
|
|
g_free (action->private_data->icon_name);
|
2009-01-08 05:37:39 +00:00
|
|
|
|
|
|
|
if (action->private_data->gicon)
|
|
|
|
g_object_unref (action->private_data->gicon);
|
2003-09-17 23:58:28 +00:00
|
|
|
|
2003-09-18 19:04:42 +00:00
|
|
|
g_closure_unref (action->private_data->accel_closure);
|
2003-09-17 23:58:28 +00:00
|
|
|
if (action->private_data->accel_group)
|
|
|
|
g_object_unref (action->private_data->accel_group);
|
2004-02-22 02:06:49 +00:00
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
G_OBJECT_CLASS (gtk_action_parent_class)->finalize (object);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_action_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
action = GTK_ACTION (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_NAME:
|
2007-07-10 22:18:08 +00:00
|
|
|
action->private_data->name = g_intern_string (g_value_get_string (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_LABEL:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_label (action, g_value_get_string (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_SHORT_LABEL:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_short_label (action, g_value_get_string (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_TOOLTIP:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_tooltip (action, g_value_get_string (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_STOCK_ID:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_stock_id (action, g_value_get_string (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
2009-01-08 05:37:39 +00:00
|
|
|
case PROP_GICON:
|
|
|
|
gtk_action_set_gicon (action, g_value_get_object (value));
|
|
|
|
break;
|
2006-03-13 05:11:23 +00:00
|
|
|
case PROP_ICON_NAME:
|
|
|
|
gtk_action_set_icon_name (action, g_value_get_string (value));
|
|
|
|
break;
|
2004-01-02 23:14:28 +00:00
|
|
|
case PROP_VISIBLE_HORIZONTAL:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_visible_horizontal (action, g_value_get_boolean (value));
|
2004-01-02 23:14:28 +00:00
|
|
|
break;
|
|
|
|
case PROP_VISIBLE_VERTICAL:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_visible_vertical (action, g_value_get_boolean (value));
|
2004-01-02 23:14:28 +00:00
|
|
|
break;
|
2004-08-04 05:06:59 +00:00
|
|
|
case PROP_VISIBLE_OVERFLOWN:
|
|
|
|
action->private_data->visible_overflown = g_value_get_boolean (value);
|
|
|
|
break;
|
2003-08-31 23:36:37 +00:00
|
|
|
case PROP_IS_IMPORTANT:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_is_important (action, g_value_get_boolean (value));
|
2003-08-31 23:36:37 +00:00
|
|
|
break;
|
2003-10-01 19:07:36 +00:00
|
|
|
case PROP_HIDE_IF_EMPTY:
|
|
|
|
action->private_data->hide_if_empty = g_value_get_boolean (value);
|
|
|
|
break;
|
2003-08-24 19:58:30 +00:00
|
|
|
case PROP_SENSITIVE:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_sensitive (action, g_value_get_boolean (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_VISIBLE:
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_visible (action, g_value_get_boolean (value));
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
2004-01-12 22:45:45 +00:00
|
|
|
case PROP_ACTION_GROUP:
|
|
|
|
gtk_action_set_action_group (action, g_value_get_object (value));
|
|
|
|
break;
|
2009-08-16 20:57:49 +00:00
|
|
|
case PROP_ALWAYS_SHOW_IMAGE:
|
|
|
|
gtk_action_set_always_show_image (action, g_value_get_boolean (value));
|
|
|
|
break;
|
2003-08-24 19:58:30 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_action_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
action = GTK_ACTION (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_NAME:
|
2007-07-10 22:18:08 +00:00
|
|
|
g_value_set_static_string (value, action->private_data->name);
|
2003-08-24 19:58:30 +00:00
|
|
|
break;
|
|
|
|
case PROP_LABEL:
|
|
|
|
g_value_set_string (value, action->private_data->label);
|
|
|
|
break;
|
|
|
|
case PROP_SHORT_LABEL:
|
|
|
|
g_value_set_string (value, action->private_data->short_label);
|
|
|
|
break;
|
|
|
|
case PROP_TOOLTIP:
|
|
|
|
g_value_set_string (value, action->private_data->tooltip);
|
|
|
|
break;
|
|
|
|
case PROP_STOCK_ID:
|
|
|
|
g_value_set_string (value, action->private_data->stock_id);
|
|
|
|
break;
|
2006-03-13 05:11:23 +00:00
|
|
|
case PROP_ICON_NAME:
|
|
|
|
g_value_set_string (value, action->private_data->icon_name);
|
|
|
|
break;
|
2009-01-08 05:37:39 +00:00
|
|
|
case PROP_GICON:
|
|
|
|
g_value_set_object (value, action->private_data->gicon);
|
|
|
|
break;
|
2004-01-02 23:14:28 +00:00
|
|
|
case PROP_VISIBLE_HORIZONTAL:
|
|
|
|
g_value_set_boolean (value, action->private_data->visible_horizontal);
|
|
|
|
break;
|
|
|
|
case PROP_VISIBLE_VERTICAL:
|
|
|
|
g_value_set_boolean (value, action->private_data->visible_vertical);
|
|
|
|
break;
|
2004-08-04 05:06:59 +00:00
|
|
|
case PROP_VISIBLE_OVERFLOWN:
|
|
|
|
g_value_set_boolean (value, action->private_data->visible_overflown);
|
|
|
|
break;
|
2003-08-31 23:36:37 +00:00
|
|
|
case PROP_IS_IMPORTANT:
|
|
|
|
g_value_set_boolean (value, action->private_data->is_important);
|
|
|
|
break;
|
2003-10-01 19:07:36 +00:00
|
|
|
case PROP_HIDE_IF_EMPTY:
|
|
|
|
g_value_set_boolean (value, action->private_data->hide_if_empty);
|
|
|
|
break;
|
2003-08-24 19:58:30 +00:00
|
|
|
case PROP_SENSITIVE:
|
|
|
|
g_value_set_boolean (value, action->private_data->sensitive);
|
|
|
|
break;
|
|
|
|
case PROP_VISIBLE:
|
|
|
|
g_value_set_boolean (value, action->private_data->visible);
|
|
|
|
break;
|
2004-01-12 22:45:45 +00:00
|
|
|
case PROP_ACTION_GROUP:
|
|
|
|
g_value_set_object (value, action->private_data->action_group);
|
|
|
|
break;
|
2009-08-16 20:57:49 +00:00
|
|
|
case PROP_ALWAYS_SHOW_IMAGE:
|
|
|
|
g_value_set_boolean (value, action->private_data->always_show_image);
|
|
|
|
break;
|
2003-08-24 19:58:30 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
create_menu_item (GtkAction *action)
|
|
|
|
{
|
|
|
|
GType menu_item_type;
|
|
|
|
|
|
|
|
menu_item_type = GTK_ACTION_GET_CLASS (action)->menu_item_type;
|
|
|
|
|
|
|
|
return g_object_new (menu_item_type, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
create_tool_item (GtkAction *action)
|
|
|
|
{
|
|
|
|
GType toolbar_item_type;
|
|
|
|
|
|
|
|
toolbar_item_type = GTK_ACTION_GET_CLASS (action)->toolbar_item_type;
|
|
|
|
|
|
|
|
return g_object_new (toolbar_item_type, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-01-05 17:30:44 +00:00
|
|
|
remove_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
2003-08-24 19:58:30 +00:00
|
|
|
{
|
2003-09-06 23:52:00 +00:00
|
|
|
action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
static void
|
|
|
|
connect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
action->private_data->proxies = g_slist_prepend (action->private_data->proxies, proxy);
|
|
|
|
|
|
|
|
if (action->private_data->action_group)
|
|
|
|
_gtk_action_group_emit_connect_proxy (action->private_data->action_group, action, proxy);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
disconnect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
remove_proxy (action, proxy);
|
|
|
|
|
|
|
|
if (action->private_data->action_group)
|
|
|
|
_gtk_action_group_emit_disconnect_proxy (action->private_data->action_group, action, proxy);
|
|
|
|
}
|
|
|
|
|
2003-09-30 20:55:24 +00:00
|
|
|
/**
|
|
|
|
* _gtk_action_sync_menu_visible:
|
2010-02-19 16:53:17 +00:00
|
|
|
* @action: (allow-none): a #GtkAction, or %NULL to determine the action from @proxy
|
2003-09-30 20:55:24 +00:00
|
|
|
* @proxy: a proxy menu item
|
|
|
|
* @empty: whether the submenu attached to @proxy is empty
|
|
|
|
*
|
|
|
|
* Updates the visibility of @proxy from the visibility of @action
|
|
|
|
* according to the following rules:
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem><para>if @action is invisible, @proxy is too
|
|
|
|
* </para></listitem>
|
2003-10-01 19:07:36 +00:00
|
|
|
* <listitem><para>if @empty is %TRUE, hide @proxy unless the "hide-if-empty"
|
|
|
|
* property of @action indicates otherwise
|
2003-09-30 20:55:24 +00:00
|
|
|
* </para></listitem>
|
|
|
|
* </itemizedlist>
|
|
|
|
*
|
|
|
|
* This function is used in the implementation of #GtkUIManager.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
_gtk_action_sync_menu_visible (GtkAction *action,
|
|
|
|
GtkWidget *proxy,
|
|
|
|
gboolean empty)
|
|
|
|
{
|
2008-02-08 00:25:50 +00:00
|
|
|
gboolean visible = TRUE;
|
|
|
|
gboolean hide_if_empty = TRUE;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU_ITEM (proxy));
|
|
|
|
g_return_if_fail (action == NULL || GTK_IS_ACTION (action));
|
2006-01-07 06:08:07 +00:00
|
|
|
|
2003-09-30 20:55:24 +00:00
|
|
|
if (action == NULL)
|
2009-01-23 15:15:28 +00:00
|
|
|
action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy));
|
2003-10-01 19:07:36 +00:00
|
|
|
|
2008-02-08 00:25:50 +00:00
|
|
|
if (action)
|
|
|
|
{
|
|
|
|
/* a GtkMenu for a <popup/> doesn't have to have an action */
|
|
|
|
visible = gtk_action_is_visible (action);
|
|
|
|
hide_if_empty = action->private_data->hide_if_empty;
|
|
|
|
}
|
2003-09-30 20:55:24 +00:00
|
|
|
|
2004-11-08 20:43:59 +00:00
|
|
|
if (visible && !(empty && hide_if_empty))
|
|
|
|
gtk_widget_show (proxy);
|
|
|
|
else
|
|
|
|
gtk_widget_hide (proxy);
|
2003-09-30 20:55:24 +00:00
|
|
|
}
|
|
|
|
|
2003-12-19 00:39:10 +00:00
|
|
|
void
|
|
|
|
_gtk_action_emit_activate (GtkAction *action)
|
|
|
|
{
|
2004-01-12 22:45:45 +00:00
|
|
|
GtkActionGroup *group = action->private_data->action_group;
|
|
|
|
|
2004-01-21 22:26:53 +00:00
|
|
|
if (group != NULL)
|
|
|
|
{
|
|
|
|
g_object_ref (group);
|
|
|
|
_gtk_action_group_emit_pre_activate (group, action);
|
|
|
|
}
|
2004-01-12 22:45:45 +00:00
|
|
|
|
2003-12-19 00:39:10 +00:00
|
|
|
g_signal_emit (action, action_signals[ACTIVATE], 0);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
2004-01-21 22:26:53 +00:00
|
|
|
if (group != NULL)
|
|
|
|
{
|
|
|
|
_gtk_action_group_emit_post_activate (group, action);
|
|
|
|
g_object_unref (group);
|
|
|
|
}
|
2003-12-19 00:39:10 +00:00
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_activate:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
2003-11-17 22:36:27 +00:00
|
|
|
* Emits the "activate" signal on the specified action, if it isn't
|
|
|
|
* insensitive. This gets called by the proxy widgets when they get
|
|
|
|
* activated.
|
2003-08-24 19:58:30 +00:00
|
|
|
*
|
|
|
|
* It can also be used to manually activate an action.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_activate (GtkAction *action)
|
|
|
|
{
|
2003-11-17 22:36:27 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2009-01-27 00:25:21 +00:00
|
|
|
if (action->private_data->activate_blocked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (gtk_action_is_sensitive (action))
|
2003-12-19 00:39:10 +00:00
|
|
|
_gtk_action_emit_activate (action);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_block_activate:
|
2009-02-03 01:55:28 +00:00
|
|
|
* @action: a #GtkAction
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
|
|
|
* Disable activation signals from the action
|
|
|
|
*
|
|
|
|
* This is needed when updating the state of your proxy
|
|
|
|
* #GtkActivatable widget could result in calling gtk_action_activate(),
|
|
|
|
* this is a convenience function to avoid recursing in those
|
|
|
|
* cases (updating toggle state for instance).
|
2009-02-03 01:55:28 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
2009-01-23 15:15:28 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_block_activate (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
action->private_data->activate_blocked = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_unblock_activate:
|
2009-02-03 01:55:28 +00:00
|
|
|
* @action: a #GtkAction
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
|
|
|
* Reenable activation signals from the action
|
2009-02-03 01:55:28 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
2009-01-23 15:15:28 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_unblock_activate (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
action->private_data->activate_blocked = FALSE;
|
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_create_icon:
|
|
|
|
* @action: the action object
|
2009-12-18 10:58:36 +00:00
|
|
|
* @icon_size: (type int): the size of the icon that should be created.
|
2003-08-24 19:58:30 +00:00
|
|
|
*
|
|
|
|
* This function is intended for use by action implementations to
|
|
|
|
* create icons displayed in the proxy widgets.
|
|
|
|
*
|
|
|
|
* Returns: a widget that displays the icon for this action.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
2008-06-03 00:31:10 +00:00
|
|
|
if (action->private_data->stock_id &&
|
|
|
|
gtk_icon_factory_lookup_default (action->private_data->stock_id))
|
2003-08-24 19:58:30 +00:00
|
|
|
return gtk_image_new_from_stock (action->private_data->stock_id, icon_size);
|
2009-01-08 05:37:39 +00:00
|
|
|
else if (action->private_data->gicon)
|
|
|
|
return gtk_image_new_from_gicon (action->private_data->gicon, icon_size);
|
2006-03-13 05:11:23 +00:00
|
|
|
else if (action->private_data->icon_name)
|
|
|
|
return gtk_image_new_from_icon_name (action->private_data->icon_name, icon_size);
|
2003-08-24 19:58:30 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_create_menu_item:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Creates a menu item widget that proxies for the given action.
|
|
|
|
*
|
|
|
|
* Returns: a menu item connected to the action.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gtk_action_create_menu_item (GtkAction *action)
|
|
|
|
{
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
2008-08-12 09:06:34 +00:00
|
|
|
menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (menu_item), TRUE);
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (menu_item), action);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
return menu_item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_create_tool_item:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Creates a toolbar item widget that proxies for the given action.
|
|
|
|
*
|
|
|
|
* Returns: a toolbar item connected to the action.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gtk_action_create_tool_item (GtkAction *action)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
2008-08-12 09:06:34 +00:00
|
|
|
button = GTK_ACTION_GET_CLASS (action)->create_tool_item (action);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), TRUE);
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
void
|
|
|
|
_gtk_action_add_to_proxy_list (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (proxy));
|
|
|
|
|
|
|
|
GTK_ACTION_GET_CLASS (action)->connect_proxy (action, proxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_action_remove_from_proxy_list (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (proxy));
|
|
|
|
|
|
|
|
GTK_ACTION_GET_CLASS (action)->disconnect_proxy (action, proxy);
|
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_connect_proxy:
|
|
|
|
* @action: the action object
|
|
|
|
* @proxy: the proxy widget
|
|
|
|
*
|
|
|
|
* Connects a widget to an action object as a proxy. Synchronises
|
|
|
|
* various properties of the action with the widget (such as label
|
|
|
|
* text, icon, tooltip, etc), and attaches a callback so that the
|
|
|
|
* action gets activated when the proxy widget does.
|
|
|
|
*
|
|
|
|
* If the widget is already connected to an action, it is disconnected
|
|
|
|
* first.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-02-28 19:26:14 +00:00
|
|
|
* Deprecated: 2.16: Use gtk_activatable_set_related_action() instead.
|
2003-08-24 19:58:30 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_connect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (proxy));
|
2009-01-23 15:15:28 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTIVATABLE (proxy));
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (proxy), TRUE);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (proxy), action);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_disconnect_proxy:
|
|
|
|
* @action: the action object
|
|
|
|
* @proxy: the proxy widget
|
|
|
|
*
|
|
|
|
* Disconnects a proxy widget from an action.
|
|
|
|
* Does <emphasis>not</emphasis> destroy the widget, however.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-02-28 19:26:14 +00:00
|
|
|
* Deprecated: 2.16: Use gtk_activatable_set_related_action() instead.
|
2003-08-24 19:58:30 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_disconnect_proxy (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (proxy));
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (proxy), NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_get_proxies:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns the proxy widgets for an action.
|
2006-01-09 18:07:14 +00:00
|
|
|
* See also gtk_widget_get_action().
|
2009-12-10 10:23:40 +00:00
|
|
|
*
|
|
|
|
* Return value: (element-type GtkWidget) (transfer none): a #GSList of proxy widgets. The list is owned by GTK+
|
2006-01-09 18:07:14 +00:00
|
|
|
* and must not be modified.
|
2003-08-24 19:58:30 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
GSList*
|
|
|
|
gtk_action_get_proxies (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->proxies;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-09 18:07:14 +00:00
|
|
|
/**
|
|
|
|
* gtk_widget_get_action:
|
|
|
|
* @widget: a #GtkWidget
|
|
|
|
*
|
|
|
|
* Returns the #GtkAction that @widget is a proxy for.
|
|
|
|
* See also gtk_action_get_proxies().
|
|
|
|
*
|
|
|
|
* Returns: the action that a widget is a proxy for, or
|
|
|
|
* %NULL, if it is not attached to an action.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-02-28 19:26:14 +00:00
|
|
|
* Deprecated: 2.16: Use gtk_activatable_get_related_action() instead.
|
2006-01-09 18:07:14 +00:00
|
|
|
*/
|
|
|
|
GtkAction*
|
|
|
|
gtk_widget_get_action (GtkWidget *widget)
|
|
|
|
{
|
2006-01-09 18:12:59 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
2006-01-09 18:07:14 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
if (GTK_IS_ACTIVATABLE (widget))
|
|
|
|
return gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget));
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-01-09 18:07:14 +00:00
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_name:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns the name of the action.
|
|
|
|
*
|
|
|
|
* Return value: the name of the action. The string belongs to GTK+ and should not
|
|
|
|
* be freed.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2004-11-09 19:15:44 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2003-08-24 19:58:30 +00:00
|
|
|
gtk_action_get_name (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->name;
|
|
|
|
}
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_is_sensitive:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns whether the action is effectively sensitive.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the action and its associated action group
|
|
|
|
* are both sensitive.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_action_is_sensitive (GtkAction *action)
|
|
|
|
{
|
|
|
|
GtkActionPrivate *priv;
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
priv = action->private_data;
|
|
|
|
return priv->sensitive &&
|
|
|
|
(priv->action_group == NULL ||
|
|
|
|
gtk_action_group_get_sensitive (priv->action_group));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_get_sensitive:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns whether the action itself is sensitive. Note that this doesn't
|
|
|
|
* necessarily mean effective sensitivity. See gtk_action_is_sensitive()
|
|
|
|
* for that.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the action itself is sensitive.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_action_get_sensitive (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->sensitive;
|
|
|
|
}
|
|
|
|
|
2004-08-12 03:25:49 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_sensitive:
|
|
|
|
* @action: the action object
|
|
|
|
* @sensitive: %TRUE to make the action sensitive
|
|
|
|
*
|
|
|
|
* Sets the ::sensitive property of the action to @sensitive. Note that
|
|
|
|
* this doesn't necessarily mean effective sensitivity. See
|
|
|
|
* gtk_action_is_sensitive()
|
|
|
|
* for that.
|
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_action_set_sensitive (GtkAction *action,
|
|
|
|
gboolean sensitive)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
sensitive = sensitive != FALSE;
|
|
|
|
|
|
|
|
if (action->private_data->sensitive != sensitive)
|
|
|
|
{
|
|
|
|
action->private_data->sensitive = sensitive;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "sensitive");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_is_visible:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns whether the action is effectively visible.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the action and its associated action group
|
|
|
|
* are both visible.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_action_is_visible (GtkAction *action)
|
|
|
|
{
|
|
|
|
GtkActionPrivate *priv;
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
priv = action->private_data;
|
|
|
|
return priv->visible &&
|
|
|
|
(priv->action_group == NULL ||
|
|
|
|
gtk_action_group_get_visible (priv->action_group));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_get_visible:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns whether the action itself is visible. Note that this doesn't
|
|
|
|
* necessarily mean effective visibility. See gtk_action_is_sensitive()
|
|
|
|
* for that.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the action itself is visible.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_action_get_visible (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->visible;
|
|
|
|
}
|
|
|
|
|
2004-08-12 03:25:49 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_visible:
|
|
|
|
* @action: the action object
|
|
|
|
* @visible: %TRUE to make the action visible
|
|
|
|
*
|
|
|
|
* Sets the ::visible property of the action to @visible. Note that
|
|
|
|
* this doesn't necessarily mean effective visibility. See
|
|
|
|
* gtk_action_is_visible()
|
|
|
|
* for that.
|
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_action_set_visible (GtkAction *action,
|
|
|
|
gboolean visible)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
visible = visible != FALSE;
|
|
|
|
|
|
|
|
if (action->private_data->visible != visible)
|
|
|
|
{
|
|
|
|
action->private_data->visible = visible;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "visible");
|
|
|
|
}
|
|
|
|
}
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_is_important:
|
|
|
|
* @action: the action object
|
|
|
|
* @is_important: %TRUE to make the action important
|
|
|
|
*
|
|
|
|
* Sets whether the action is important, this attribute is used
|
|
|
|
* primarily by toolbar items to decide whether to show a label
|
|
|
|
* or not.
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_is_important (GtkAction *action,
|
|
|
|
gboolean is_important)
|
|
|
|
{
|
2009-01-23 15:15:28 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
2006-01-03 06:19:00 +00:00
|
|
|
|
|
|
|
is_important = is_important != FALSE;
|
|
|
|
|
|
|
|
if (action->private_data->is_important != is_important)
|
|
|
|
{
|
|
|
|
action->private_data->is_important = is_important;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "is-important");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_is_important:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Checks whether @action is important or not
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-01-21 02:53:45 +00:00
|
|
|
* Returns: whether @action is important
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
gboolean
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_is_important (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->is_important;
|
|
|
|
}
|
|
|
|
|
2009-08-16 20:57:49 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_always_show_image:
|
2009-11-30 21:13:59 +00:00
|
|
|
* @action: a #GtkAction
|
2009-08-16 20:57:49 +00:00
|
|
|
* @always_show: %TRUE if menuitem proxies should always show their image
|
|
|
|
*
|
|
|
|
* Sets whether @action<!-- -->'s menu item proxies will ignore the
|
|
|
|
* #GtkSettings:gtk-menu-images setting and always show their image, if available.
|
|
|
|
*
|
|
|
|
* Use this if the menu item would be useless or hard to use
|
|
|
|
* without their image.
|
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_set_always_show_image (GtkAction *action,
|
|
|
|
gboolean always_show)
|
|
|
|
{
|
|
|
|
GtkActionPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
priv = action->private_data;
|
|
|
|
|
|
|
|
always_show = always_show != FALSE;
|
|
|
|
|
|
|
|
if (priv->always_show_image != always_show)
|
|
|
|
{
|
|
|
|
priv->always_show_image = always_show;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "always-show-image");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_get_always_show_image:
|
2009-11-30 21:13:59 +00:00
|
|
|
* @action: a #GtkAction
|
2009-08-16 20:57:49 +00:00
|
|
|
*
|
|
|
|
* Returns whether @action<!-- -->'s menu item proxies will ignore the
|
2009-11-30 21:13:59 +00:00
|
|
|
* #GtkSettings:gtk-menu-images setting and always show their image,
|
|
|
|
* if available.
|
2009-08-16 20:57:49 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE if the menu item proxies will always show their image
|
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gtk_action_get_always_show_image (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->always_show_image;
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_label:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
* @label: the label text to set
|
|
|
|
*
|
|
|
|
* Sets the label of @action.
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_label (GtkAction *action,
|
|
|
|
const gchar *label)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
tmp = action->private_data->label;
|
|
|
|
action->private_data->label = g_strdup (label);
|
|
|
|
g_free (tmp);
|
|
|
|
action->private_data->label_set = (action->private_data->label != NULL);
|
|
|
|
/* if label is unset, then use the label from the stock item */
|
|
|
|
if (!action->private_data->label_set && action->private_data->stock_id)
|
|
|
|
{
|
|
|
|
GtkStockItem stock_item;
|
|
|
|
|
|
|
|
if (gtk_stock_lookup (action->private_data->stock_id, &stock_item))
|
|
|
|
action->private_data->label = g_strdup (stock_item.label);
|
|
|
|
}
|
2009-01-23 15:15:28 +00:00
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
g_object_notify (G_OBJECT (action), "label");
|
|
|
|
|
|
|
|
/* if short_label is unset, set short_label=label */
|
|
|
|
if (!action->private_data->short_label_set)
|
|
|
|
{
|
|
|
|
gtk_action_set_short_label (action, action->private_data->label);
|
|
|
|
action->private_data->short_label_set = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_label:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Gets the label text of @action.
|
|
|
|
*
|
|
|
|
* Returns: the label text
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_label (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->label;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_short_label:
|
|
|
|
* @action: a #GtkAction
|
2009-02-03 01:55:28 +00:00
|
|
|
* @short_label: the label text to set
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* Sets a shorter label text on @action.
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2009-01-23 15:15:28 +00:00
|
|
|
gtk_action_set_short_label (GtkAction *action,
|
2009-02-03 01:55:28 +00:00
|
|
|
const gchar *short_label)
|
2006-01-03 06:19:00 +00:00
|
|
|
{
|
|
|
|
gchar *tmp;
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
tmp = action->private_data->short_label;
|
2009-02-03 01:55:28 +00:00
|
|
|
action->private_data->short_label = g_strdup (short_label);
|
2006-01-03 06:19:00 +00:00
|
|
|
g_free (tmp);
|
|
|
|
action->private_data->short_label_set = (action->private_data->short_label != NULL);
|
|
|
|
/* if short_label is unset, then use the value of label */
|
|
|
|
if (!action->private_data->short_label_set)
|
|
|
|
action->private_data->short_label = g_strdup (action->private_data->label);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "short-label");
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_short_label:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* Gets the short label text of @action.
|
|
|
|
*
|
|
|
|
* Returns: the short label text.
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_short_label (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->short_label;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_visible_horizontal:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
* @visible_horizontal: whether the action is visible horizontally
|
|
|
|
*
|
|
|
|
* Sets whether @action is visible when horizontal
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_visible_horizontal (GtkAction *action,
|
|
|
|
gboolean visible_horizontal)
|
|
|
|
{
|
2009-01-23 15:15:28 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
2006-01-03 06:19:00 +00:00
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
visible_horizontal = visible_horizontal != FALSE;
|
|
|
|
|
|
|
|
if (action->private_data->visible_horizontal != visible_horizontal)
|
|
|
|
{
|
|
|
|
action->private_data->visible_horizontal = visible_horizontal;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "visible-horizontal");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_visible_horizontal:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Checks whether @action is visible when horizontal
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-01-21 02:53:45 +00:00
|
|
|
* Returns: whether @action is visible when horizontal
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
gboolean
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_visible_horizontal (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->visible_horizontal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_visible_vertical:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
* @visible_vertical: whether the action is visible vertically
|
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* Sets whether @action is visible when vertical
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_visible_vertical (GtkAction *action,
|
|
|
|
gboolean visible_vertical)
|
|
|
|
{
|
2009-01-23 15:15:28 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
2006-01-03 06:19:00 +00:00
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
visible_vertical = visible_vertical != FALSE;
|
|
|
|
|
|
|
|
if (action->private_data->visible_vertical != visible_vertical)
|
|
|
|
{
|
|
|
|
action->private_data->visible_vertical = visible_vertical;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "visible-vertical");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_visible_vertical:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Checks whether @action is visible when horizontal
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-01-21 02:53:45 +00:00
|
|
|
* Returns: whether @action is visible when horizontal
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
gboolean
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_visible_vertical (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
|
|
|
|
|
|
|
|
return action->private_data->visible_vertical;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_tooltip:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
* @tooltip: the tooltip text
|
|
|
|
*
|
|
|
|
* Sets the tooltip text on @action
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_tooltip (GtkAction *action,
|
|
|
|
const gchar *tooltip)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
tmp = action->private_data->tooltip;
|
|
|
|
action->private_data->tooltip = g_strdup (tooltip);
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "tooltip");
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_tooltip:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Gets the tooltip text of @action.
|
|
|
|
*
|
2009-01-23 15:15:28 +00:00
|
|
|
* Returns: the tooltip text
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_tooltip (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->tooltip;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_stock_id:
|
|
|
|
* @action: a #GtkAction
|
2009-02-03 01:55:28 +00:00
|
|
|
* @stock_id: the stock id
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Sets the stock id on @action
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_stock_id (GtkAction *action,
|
|
|
|
const gchar *stock_id)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
2009-01-23 15:15:28 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-01-03 06:19:00 +00:00
|
|
|
tmp = action->private_data->stock_id;
|
|
|
|
action->private_data->stock_id = g_strdup (stock_id);
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "stock-id");
|
|
|
|
|
|
|
|
/* update label and short_label if appropriate */
|
|
|
|
if (!action->private_data->label_set)
|
|
|
|
{
|
|
|
|
GtkStockItem stock_item;
|
|
|
|
|
2006-03-13 05:11:23 +00:00
|
|
|
if (action->private_data->stock_id &&
|
|
|
|
gtk_stock_lookup (action->private_data->stock_id, &stock_item))
|
2006-01-03 06:19:00 +00:00
|
|
|
gtk_action_set_label (action, stock_item.label);
|
|
|
|
else
|
|
|
|
gtk_action_set_label (action, NULL);
|
|
|
|
|
|
|
|
action->private_data->label_set = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_stock_id:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Gets the stock id of @action.
|
|
|
|
*
|
|
|
|
* Returns: the stock id
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_stock_id (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->stock_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_icon_name:
|
|
|
|
* @action: a #GtkAction
|
2009-02-03 01:55:28 +00:00
|
|
|
* @icon_name: the icon name to set
|
2009-01-21 02:53:45 +00:00
|
|
|
*
|
|
|
|
* Sets the icon name on @action
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2006-03-13 05:11:23 +00:00
|
|
|
gtk_action_set_icon_name (GtkAction *action,
|
|
|
|
const gchar *icon_name)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
2009-01-23 15:15:28 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2006-03-13 05:11:23 +00:00
|
|
|
tmp = action->private_data->icon_name;
|
|
|
|
action->private_data->icon_name = g_strdup (icon_name);
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "icon-name");
|
|
|
|
}
|
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_icon_name:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Gets the icon name of @action.
|
|
|
|
*
|
|
|
|
* Returns: the icon name
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
2009-01-23 15:15:28 +00:00
|
|
|
G_CONST_RETURN gchar *
|
2009-01-21 02:53:45 +00:00
|
|
|
gtk_action_get_icon_name (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->icon_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_set_gicon:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
* @icon: the #GIcon to set
|
|
|
|
*
|
|
|
|
* Sets the icon of @action.
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
void
|
2009-01-08 05:37:39 +00:00
|
|
|
gtk_action_set_gicon (GtkAction *action,
|
|
|
|
GIcon *icon)
|
|
|
|
{
|
2009-01-21 02:53:45 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2009-01-08 05:37:39 +00:00
|
|
|
if (action->private_data->gicon)
|
|
|
|
g_object_unref (action->private_data->gicon);
|
|
|
|
|
|
|
|
action->private_data->gicon = icon;
|
|
|
|
|
|
|
|
if (action->private_data->gicon)
|
|
|
|
g_object_ref (action->private_data->gicon);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (action), "gicon");
|
|
|
|
}
|
2006-01-03 06:19:00 +00:00
|
|
|
|
2009-01-21 02:53:45 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_gicon:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Gets the gicon of @action.
|
|
|
|
*
|
|
|
|
* Returns: The action's #GIcon if one is set.
|
|
|
|
*
|
|
|
|
* Since: 2.16
|
|
|
|
*/
|
|
|
|
GIcon *
|
|
|
|
gtk_action_get_gicon (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->gicon;
|
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_block_activate_from:
|
|
|
|
* @action: the action object
|
|
|
|
* @proxy: a proxy widget
|
|
|
|
*
|
|
|
|
* Disables calls to the gtk_action_activate()
|
|
|
|
* function by signals on the given proxy widget. This is used to
|
|
|
|
* break notification loops for things like check or radio actions.
|
|
|
|
*
|
|
|
|
* This function is intended for use by action implementations.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-02-28 19:26:14 +00:00
|
|
|
* Deprecated: 2.16: activatables are now responsible for activating the
|
2009-01-23 15:15:28 +00:00
|
|
|
* action directly so this doesnt apply anymore.
|
2003-08-24 19:58:30 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_block_activate_from (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate),
|
|
|
|
action);
|
2009-02-07 03:17:43 +00:00
|
|
|
|
|
|
|
gtk_action_block_activate (action);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_unblock_activate_from:
|
|
|
|
* @action: the action object
|
|
|
|
* @proxy: a proxy widget
|
|
|
|
*
|
|
|
|
* Re-enables calls to the gtk_action_activate()
|
|
|
|
* function by signals on the given proxy widget. This undoes the
|
|
|
|
* blocking done by gtk_action_block_activate_from().
|
|
|
|
*
|
|
|
|
* This function is intended for use by action implementations.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
2009-01-23 15:15:28 +00:00
|
|
|
*
|
2009-02-28 19:26:14 +00:00
|
|
|
* Deprecated: 2.16: activatables are now responsible for activating the
|
2009-01-23 15:15:28 +00:00
|
|
|
* action directly so this doesnt apply anymore.
|
2003-08-24 19:58:30 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_unblock_activate_from (GtkAction *action,
|
|
|
|
GtkWidget *proxy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate),
|
|
|
|
action);
|
2009-02-07 03:17:43 +00:00
|
|
|
|
|
|
|
gtk_action_unblock_activate (action);
|
2003-08-24 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
2003-09-17 23:58:28 +00:00
|
|
|
static void
|
|
|
|
closure_accel_activate (GClosure *closure,
|
|
|
|
GValue *return_value,
|
|
|
|
guint n_param_values,
|
|
|
|
const GValue *param_values,
|
|
|
|
gpointer invocation_hint,
|
|
|
|
gpointer marshal_data)
|
|
|
|
{
|
2004-01-12 22:45:45 +00:00
|
|
|
if (gtk_action_is_sensitive (GTK_ACTION (closure->data)))
|
2004-11-28 05:13:00 +00:00
|
|
|
{
|
|
|
|
_gtk_action_emit_activate (GTK_ACTION (closure->data));
|
|
|
|
|
|
|
|
/* we handled the accelerator */
|
|
|
|
g_value_set_boolean (return_value, TRUE);
|
|
|
|
}
|
2003-09-17 23:58:28 +00:00
|
|
|
}
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
static void
|
|
|
|
gtk_action_set_action_group (GtkAction *action,
|
|
|
|
GtkActionGroup *action_group)
|
|
|
|
{
|
|
|
|
if (action->private_data->action_group == NULL)
|
|
|
|
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
|
|
|
else
|
|
|
|
g_return_if_fail (action_group == NULL);
|
|
|
|
|
|
|
|
action->private_data->action_group = action_group;
|
|
|
|
}
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_accel_path:
|
|
|
|
* @action: the action object
|
|
|
|
* @accel_path: the accelerator path
|
|
|
|
*
|
|
|
|
* Sets the accel path for this action. All proxy widgets associated
|
|
|
|
* with the action will have this accel path, so that their
|
|
|
|
* accelerators are consistent.
|
|
|
|
*
|
2008-06-07 20:40:20 +00:00
|
|
|
* Note that @accel_path string will be stored in a #GQuark. Therefore, if you
|
|
|
|
* pass a static string, you can save some memory by interning it first with
|
|
|
|
* g_intern_static_string().
|
|
|
|
*
|
2003-08-24 19:58:30 +00:00
|
|
|
* Since: 2.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_action_set_accel_path (GtkAction *action,
|
|
|
|
const gchar *accel_path)
|
|
|
|
{
|
2003-09-17 23:58:28 +00:00
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
action->private_data->accel_quark = g_quark_from_string (accel_path);
|
|
|
|
}
|
2003-09-17 23:58:28 +00:00
|
|
|
|
2004-11-09 19:15:44 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_accel_path:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns the accel path for this action.
|
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
*
|
|
|
|
* Returns: the accel path for this action, or %NULL
|
2005-09-01 13:10:55 +00:00
|
|
|
* if none is set. The returned string is owned by GTK+
|
2004-11-09 19:15:44 +00:00
|
|
|
* and must not be freed or modified.
|
|
|
|
*/
|
|
|
|
G_CONST_RETURN gchar *
|
|
|
|
gtk_action_get_accel_path (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
if (action->private_data->accel_quark)
|
|
|
|
return g_quark_to_string (action->private_data->accel_quark);
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-06-10 19:11:31 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_get_accel_closure:
|
|
|
|
* @action: the action object
|
|
|
|
*
|
|
|
|
* Returns the accel closure for this action.
|
|
|
|
*
|
|
|
|
* Since: 2.8
|
|
|
|
*
|
|
|
|
* Returns: the accel closure for this action. The returned closure is
|
2005-09-01 13:10:55 +00:00
|
|
|
* owned by GTK+ and must not be unreffed or modified.
|
2005-06-10 19:11:31 +00:00
|
|
|
*/
|
|
|
|
GClosure *
|
|
|
|
gtk_action_get_accel_closure (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
|
|
|
|
|
|
|
return action->private_data->accel_closure;
|
|
|
|
}
|
|
|
|
|
2004-11-09 19:15:44 +00:00
|
|
|
|
2003-09-17 23:58:28 +00:00
|
|
|
/**
|
|
|
|
* gtk_action_set_accel_group:
|
|
|
|
* @action: the action object
|
2009-12-10 10:23:40 +00:00
|
|
|
* @accel_group: (allow-none): a #GtkAccelGroup or %NULL
|
|
|
|
*
|
2003-09-17 23:58:28 +00:00
|
|
|
* Sets the #GtkAccelGroup in which the accelerator for this action
|
|
|
|
* will be installed.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_action_set_accel_group (GtkAction *action,
|
|
|
|
GtkAccelGroup *accel_group)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
g_return_if_fail (accel_group == NULL || GTK_IS_ACCEL_GROUP (accel_group));
|
|
|
|
|
|
|
|
if (accel_group)
|
|
|
|
g_object_ref (accel_group);
|
|
|
|
if (action->private_data->accel_group)
|
|
|
|
g_object_unref (action->private_data->accel_group);
|
|
|
|
|
|
|
|
action->private_data->accel_group = accel_group;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_connect_accelerator:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Installs the accelerator for @action if @action has an
|
|
|
|
* accel path and group. See gtk_action_set_accel_path() and
|
|
|
|
* gtk_action_set_accel_group()
|
|
|
|
*
|
|
|
|
* Since multiple proxies may independently trigger the installation
|
|
|
|
* of the accelerator, the @action counts the number of times this
|
|
|
|
* function has been called and doesn't remove the accelerator until
|
|
|
|
* gtk_action_disconnect_accelerator() has been called as many times.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_action_connect_accelerator (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
if (!action->private_data->accel_quark ||
|
|
|
|
!action->private_data->accel_group)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (action->private_data->accel_count == 0)
|
|
|
|
{
|
|
|
|
const gchar *accel_path =
|
|
|
|
g_quark_to_string (action->private_data->accel_quark);
|
|
|
|
|
|
|
|
gtk_accel_group_connect_by_path (action->private_data->accel_group,
|
|
|
|
accel_path,
|
|
|
|
action->private_data->accel_closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
action->private_data->accel_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_action_disconnect_accelerator:
|
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* Undoes the effect of one call to gtk_action_connect_accelerator().
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_action_disconnect_accelerator (GtkAction *action)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ACTION (action));
|
|
|
|
|
|
|
|
if (!action->private_data->accel_quark ||
|
|
|
|
!action->private_data->accel_group)
|
|
|
|
return;
|
|
|
|
|
|
|
|
action->private_data->accel_count--;
|
|
|
|
|
|
|
|
if (action->private_data->accel_count == 0)
|
|
|
|
gtk_accel_group_disconnect (action->private_data->accel_group,
|
|
|
|
action->private_data->accel_closure);
|
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
2007-03-15 19:33:57 +00:00
|
|
|
/**
|
2007-03-16 20:04:57 +00:00
|
|
|
* gtk_action_create_menu:
|
2007-03-15 19:33:57 +00:00
|
|
|
* @action: a #GtkAction
|
|
|
|
*
|
|
|
|
* If @action provides a #GtkMenu widget as a submenu for the menu
|
2007-03-16 20:04:57 +00:00
|
|
|
* item or the toolbar item it creates, this function returns an
|
|
|
|
* instance of that menu.
|
2007-03-15 19:33:57 +00:00
|
|
|
*
|
|
|
|
* Return value: the menu item provided by the action, or %NULL.
|
|
|
|
*
|
|
|
|
* Since: 2.12
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
2007-03-16 20:04:57 +00:00
|
|
|
gtk_action_create_menu (GtkAction *action)
|
2007-03-15 19:33:57 +00:00
|
|
|
{
|
2007-04-30 16:18:54 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
|
2007-03-15 19:33:57 +00:00
|
|
|
|
2007-03-16 20:04:57 +00:00
|
|
|
if (GTK_ACTION_GET_CLASS (action)->create_menu)
|
|
|
|
return GTK_ACTION_GET_CLASS (action)->create_menu (action);
|
2007-03-15 19:33:57 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-03-20 07:01:23 +00:00
|
|
|
#define __GTK_ACTION_C__
|
|
|
|
#include "gtkaliasdef.c"
|