gtk+ r20610 - trunk/gtk
- From: timj svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20610 - trunk/gtk
- Date: Fri, 20 Jun 2008 11:08:45 +0000 (UTC)
Author: timj
Date: Fri Jun 20 11:08:45 2008
New Revision: 20610
URL: http://svn.gnome.org/viewvc/gtk+?rev=20610&view=rev
Log:
Seal GtkMenuItem
Modified:
trunk/gtk/gtk.symbols
trunk/gtk/gtkmenuitem.c
trunk/gtk/gtkmenuitem.h
Modified: trunk/gtk/gtk.symbols
==============================================================================
--- trunk/gtk/gtk.symbols (original)
+++ trunk/gtk/gtk.symbols Fri Jun 20 11:08:45 2008
@@ -2272,6 +2272,7 @@
#if IN_FILE(__GTK_MENU_ITEM_C__)
gtk_menu_item_activate
gtk_menu_item_deselect
+gtk_menu_item_get_accel_path
gtk_menu_item_get_right_justified
gtk_menu_item_get_submenu
gtk_menu_item_get_type G_GNUC_CONST
Modified: trunk/gtk/gtkmenuitem.c
==============================================================================
--- trunk/gtk/gtkmenuitem.c (original)
+++ trunk/gtk/gtkmenuitem.c Fri Jun 20 11:08:45 2008
@@ -52,7 +52,9 @@
enum {
PROP_0,
- PROP_SUBMENU
+ PROP_RIGHT_JUSTIFIED,
+ PROP_SUBMENU,
+ PROP_ACCEL_PATH
};
@@ -190,6 +192,21 @@
G_TYPE_INT);
/**
+ * GtkMenuItem:right-justified:
+ *
+ * Sets whether the menu item appears justified at the right side of a menu bar.
+ *
+ * Since: GSEAL-branch
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_RIGHT_JUSTIFIED,
+ g_param_spec_boolean ("right-justified",
+ P_("Right Justified"),
+ P_("Sets whether the menu item appears justified at the right side of a menu bar"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ /**
* GtkMenuItem:submenu:
*
* The submenu attached to the menu item, or NULL if it has none.
@@ -204,6 +221,23 @@
GTK_TYPE_MENU,
GTK_PARAM_READWRITE));
+ /**
+ * GtkMenuItem:accel-path:
+ *
+ * Sets the accelerator path of the menu item, through which runtime
+ * changes of the menu item's accelerator caused by the user can be
+ * identified and saved to persistant storage.
+ *
+ * Since: GSEAL-branch
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_ACCEL_PATH,
+ g_param_spec_string ("accel-path",
+ P_("Accel Path"),
+ P_("Sets the accelerator path of the menu item"),
+ NULL,
+ GTK_PARAM_READWRITE));
+
gtk_widget_class_install_style_property_parser (widget_class,
g_param_spec_enum ("selected-shadow-type",
"Selected Shadow Type",
@@ -329,9 +363,15 @@
switch (prop_id)
{
+ case PROP_RIGHT_JUSTIFIED:
+ gtk_menu_item_set_right_justified (menu_item, g_value_get_boolean (value));
+ break;
case PROP_SUBMENU:
gtk_menu_item_set_submenu (menu_item, g_value_get_object (value));
break;
+ case PROP_ACCEL_PATH:
+ gtk_menu_item_set_accel_path (menu_item, g_value_get_string (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -349,9 +389,15 @@
switch (prop_id)
{
+ case PROP_RIGHT_JUSTIFIED:
+ g_value_set_boolean (value, gtk_menu_item_get_right_justified (menu_item));
+ break;
case PROP_SUBMENU:
g_value_set_object (value, gtk_menu_item_get_submenu (menu_item));
break;
+ case PROP_ACCEL_PATH:
+ g_value_set_string (value, gtk_menu_item_get_accel_path (menu_item));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1632,6 +1678,29 @@
}
}
+/**
+ * gtk_menu_item_get_accel_path
+ * @menu_item: a valid #GtkMenuItem
+ *
+ * Set the accelerator path on @menu_item, through which runtime changes of the
+ * menu item's accelerator caused by the user can be identified and saved to
+ * persistant storage (see gtk_accel_map_save() on this).
+ * To setup a default accelerator for this menu item, call
+ * gtk_accel_map_add_entry() with the same @accel_path.
+ * See also gtk_accel_map_add_entry() on the specifics of accelerator paths,
+ * and gtk_menu_set_accel_path() for a more convenient variant of this function.
+ *
+ * Returns: the accelerator path corresponding to this menu item's
+ * functionality, or %NULL if not set
+ */
+G_CONST_RETURN gchar *
+gtk_menu_item_get_accel_path (GtkMenuItem *menu_item)
+{
+ g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
+
+ return menu_item->accel_path;
+}
+
static void
gtk_menu_item_forall (GtkContainer *container,
gboolean include_internals,
Modified: trunk/gtk/gtkmenuitem.h
==============================================================================
--- trunk/gtk/gtkmenuitem.h (original)
+++ trunk/gtk/gtkmenuitem.h Fri Jun 20 11:08:45 2008
@@ -52,21 +52,21 @@
struct _GtkMenuItem
{
GtkItem item;
-
- GtkWidget *submenu;
- GdkWindow *event_window;
-
- guint16 toggle_size;
- guint16 accelerator_width;
- gchar *accel_path;
-
- guint show_submenu_indicator : 1;
- guint submenu_placement : 1;
- guint submenu_direction : 1;
- guint right_justify: 1;
- guint timer_from_keypress : 1;
- guint from_menubar : 1;
- guint timer;
+
+ GtkWidget *GSEAL (submenu);
+ GdkWindow *GSEAL (event_window);
+
+ guint16 GSEAL (toggle_size);
+ guint16 GSEAL (accelerator_width);
+ gchar *GSEAL (accel_path);
+
+ guint GSEAL (show_submenu_indicator : 1);
+ guint GSEAL (submenu_placement : 1);
+ guint GSEAL (submenu_direction : 1);
+ guint GSEAL (right_justify: 1);
+ guint GSEAL (timer_from_keypress : 1);
+ guint GSEAL (from_menubar : 1);
+ guint GSEAL (timer);
};
struct _GtkMenuItemClass
@@ -115,6 +115,7 @@
gboolean gtk_menu_item_get_right_justified (GtkMenuItem *menu_item);
void gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
const gchar *accel_path);
+G_CONST_RETURN gchar* gtk_menu_item_get_accel_path (GtkMenuItem *menu_item);
/* private */
void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]