[gtk+/combo-refactor] Make GtkTreeMenu a private class:
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/combo-refactor] Make GtkTreeMenu a private class:
- Date: Wed, 15 Dec 2010 08:14:44 +0000 (UTC)
commit a197314ab0c7a20c1f56130e5916ebf53cb2a3a5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Wed Dec 15 17:17:45 2010 +0900
Make GtkTreeMenu a private class:
- Removed GtkTreeMenu from gtk-docs.sgml
- Removed GtkTreeMenu from gtk3-sections.txt
- Removed GtkTreeMenu from gtk.symbols
- Make GtkTreeMenu apis prefixed with '_' (including _get_type()).
- Updated GtkComboBox sources to use the private apis
- Updated GtkCellView to not mention #GtkTreeMenu in gtk-doc statements
- Updated tests/testtreemenu to not use a GtkTreeMenu but still
show a very fancy GtkComboBox
- Moved gtktreemenu.h to private headers section in the makefile.
- Removed include of gtktreemenu.h from gtk.h
docs/reference/gtk/gtk-docs.sgml | 1 -
docs/reference/gtk/gtk3-sections.txt | 36 --------
gtk/Makefile.am | 2 +-
gtk/gtk.h | 1 -
gtk/gtk.symbols | 20 ----
gtk/gtkcellview.c | 11 ++-
gtk/gtkcombobox.c | 40 ++++----
gtk/gtktreemenu.c | 164 +++++++++++++++++-----------------
gtk/gtktreemenu.h | 76 ++++++++--------
tests/testtreemenu.c | 68 +++++++++-----
10 files changed, 190 insertions(+), 229 deletions(-)
---
diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml
index cdb8c6a..39b9624 100644
--- a/docs/reference/gtk/gtk-docs.sgml
+++ b/docs/reference/gtk/gtk-docs.sgml
@@ -173,7 +173,6 @@
<xi:include href="xml/gtkcombobox.xml" />
<xi:include href="xml/gtkcomboboxtext.xml" />
<xi:include href="xml/gtkmenu.xml" />
- <xi:include href="xml/gtktreemenu.xml" />
<xi:include href="xml/gtkmenubar.xml" />
<xi:include href="xml/gtkmenuitem.xml" />
<xi:include href="xml/gtkimagemenuitem.xml" />
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index ea99c79..0d34c0d 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -784,42 +784,6 @@ gtk_color_selection_dialog_get_type
</SECTION>
<SECTION>
-<FILE>gtktreemenu</FILE>
-<TITLE>GtkTreeMenu</TITLE>
-GtkTreeMenu
-GtkTreeMenuClass
-GtkTreeMenuHeaderFunc
-gtk_tree_menu_new
-gtk_tree_menu_new_with_area
-gtk_tree_menu_new_full
-gtk_tree_menu_set_model
-gtk_tree_menu_get_model
-gtk_tree_menu_set_root
-gtk_tree_menu_get_root
-gtk_tree_menu_get_tearoff
-gtk_tree_menu_set_tearoff
-gtk_tree_menu_get_wrap_width
-gtk_tree_menu_set_wrap_width
-gtk_tree_menu_get_row_span_column
-gtk_tree_menu_set_row_span_column
-gtk_tree_menu_get_column_span_column
-gtk_tree_menu_set_column_span_column
-gtk_tree_menu_get_row_separator_func
-gtk_tree_menu_set_row_separator_func
-gtk_tree_menu_get_header_func
-gtk_tree_menu_set_header_func
-<SUBSECTION Standard>
-GTK_TREE_MENU
-GTK_IS_TREE_MENU
-GTK_TYPE_TREE_MENU
-gtk_tree_menu_get_type
-GTK_TREE_MENU_CLASS
-GTK_IS_TREE_MENU_CLASS
-GTK_TREE_MENU_GET_CLASS
-GtkTreeMenuPrivate
-</SECTION>
-
-<SECTION>
<FILE>gtkcombobox</FILE>
<TITLE>GtkComboBox</TITLE>
GtkComboBox
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 03121c6..11a494c 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -328,7 +328,6 @@ gtk_public_h_sources = \
gtktoolshell.h \
gtktooltip.h \
gtktreednd.h \
- gtktreemenu.h \
gtktreemodel.h \
gtktreemodelfilter.h \
gtktreemodelsort.h \
@@ -434,6 +433,7 @@ gtk_private_h_sources = \
gtktreedatalist.h \
gtktreeprivate.h \
gtkwidgetprivate.h \
+ gtktreemenu.h \
$(gtk_clipboard_dnd_h_sources) \
$(gtk_appchooser_impl_h_sources)
diff --git a/gtk/gtk.h b/gtk/gtk.h
index f55bdcf..0d85793 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -209,7 +209,6 @@
#include <gtk/gtktooltip.h>
#include <gtk/gtktestutils.h>
#include <gtk/gtktreednd.h>
-#include <gtk/gtktreemenu.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreemodelfilter.h>
#include <gtk/gtktreemodelsort.h>
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index dcb769f..0f72c74 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -3041,26 +3041,6 @@ gtk_tree_get_row_drag_data
gtk_tree_iter_copy
gtk_tree_iter_free
gtk_tree_iter_get_type G_GNUC_CONST
-gtk_tree_menu_get_column_span_column
-gtk_tree_menu_get_header_func
-gtk_tree_menu_get_model
-gtk_tree_menu_get_root
-gtk_tree_menu_get_row_separator_func
-gtk_tree_menu_get_row_span_column
-gtk_tree_menu_get_tearoff
-gtk_tree_menu_get_type G_GNUC_CONST
-gtk_tree_menu_get_wrap_width
-gtk_tree_menu_new
-gtk_tree_menu_new_full
-gtk_tree_menu_new_with_area
-gtk_tree_menu_set_column_span_column
-gtk_tree_menu_set_header_func
-gtk_tree_menu_set_model
-gtk_tree_menu_set_root
-gtk_tree_menu_set_row_separator_func
-gtk_tree_menu_set_row_span_column
-gtk_tree_menu_set_tearoff
-gtk_tree_menu_set_wrap_width
gtk_tree_model_filter_clear_cache
gtk_tree_model_filter_convert_child_iter_to_iter
gtk_tree_model_filter_convert_child_path_to_path
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 88a677b..0b48958 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -40,11 +40,12 @@
* and #GtkCellAreaContext. A #GtkCellAreaContext can be provided to the
* #GtkCellView at construction time in order to keep the cellview in context
* of a group of cell views, this ensures that the renderers displayed will
- * be properly aligned with eachother (like the aligned cells of #GtkTreeMenu).
+ * be properly aligned with eachother (like the aligned cells in the menus
+ * of #GtkComboBox).
*
* #GtkCellView is #GtkOrientable in order to decide in which orientation
- * the underlying #GtkCellAreaContext should be allocated. Taking the #GtkTreeMenu
- * as an example, cellviews should be oriented horizontally if the menus are
+ * the underlying #GtkCellAreaContext should be allocated. Taking the #GtkComboBox
+ * menu as an example, cellviews should be oriented horizontally if the menus are
* listed top-to-bottom and thus all share the same width but may have separate
* individual heights (left-to-right menus should be allocated vertically since
* they all share the same height but may have variable widths).
@@ -251,7 +252,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
* ensure the sizes and cell alignments match across all the views with
* the same context.
*
- * #GtkTreeMenu uses this to assign the same context to all cell views
+ * #GtkComboBox menus uses this to assign the same context to all cell views
* in the menu items for a single menu (each submenu creates it's own
* context since the size of each submenu does not depend on parent
* or sibling menus).
@@ -1324,7 +1325,7 @@ gtk_cell_view_get_draw_sensitive (GtkCellView *cell_view)
* @draw_sensitive: whether to draw all cells in a sensitive state.
*
* Sets whether @cell_view should draw all of it's
- * cells in a sensitive state, this is used by #GtkTreeMenu
+ * cells in a sensitive state, this is used by #GtkComboBox menus
* to ensure that rows with insensitive cells that contain
* children appear sensitive in the parent menu item.
*
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 0bb3e48..921865e 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2988,28 +2988,28 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
combo_box);
/* create our funky menu */
- menu = gtk_tree_menu_new_with_area (priv->area);
+ menu = _gtk_tree_menu_new_with_area (priv->area);
gtk_widget_set_name (menu, "gtk-combobox-popup-menu");
- gtk_tree_menu_set_model (GTK_TREE_MENU (menu), priv->model);
+ _gtk_tree_menu_set_model (GTK_TREE_MENU (menu), priv->model);
- gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (menu), priv->wrap_width);
- gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (menu), priv->row_column);
- gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (menu), priv->col_column);
- gtk_tree_menu_set_tearoff (GTK_TREE_MENU (menu),
- combo_box->priv->add_tearoffs);
+ _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (menu), priv->wrap_width);
+ _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (menu), priv->row_column);
+ _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (menu), priv->col_column);
+ _gtk_tree_menu_set_tearoff (GTK_TREE_MENU (menu),
+ combo_box->priv->add_tearoffs);
g_signal_connect (menu, "menu-activate",
G_CALLBACK (gtk_combo_box_menu_activate), combo_box);
/* Chain our row_separator_func through */
- gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (menu),
- (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func,
- combo_box, NULL);
+ _gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (menu),
+ (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func,
+ combo_box, NULL);
- gtk_tree_menu_set_header_func (GTK_TREE_MENU (menu),
- (GtkTreeMenuHeaderFunc)gtk_combo_box_header_func,
- combo_box, NULL);
+ _gtk_tree_menu_set_header_func (GTK_TREE_MENU (menu),
+ (GtkTreeMenuHeaderFunc)gtk_combo_box_header_func,
+ combo_box, NULL);
gtk_widget_set_name (menu, "gtk-combobox-popup-menu");
@@ -3915,7 +3915,7 @@ gtk_combo_box_set_wrap_width (GtkComboBox *combo_box,
gtk_combo_box_check_appearance (combo_box);
if (GTK_IS_TREE_MENU (priv->popup_widget))
- gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (priv->popup_widget), priv->wrap_width);
+ _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (priv->popup_widget), priv->wrap_width);
g_object_notify (G_OBJECT (combo_box), "wrap-width");
}
@@ -3969,7 +3969,7 @@ gtk_combo_box_set_row_span_column (GtkComboBox *combo_box,
priv->row_column = row_span;
if (GTK_IS_TREE_MENU (priv->popup_widget))
- gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (priv->popup_widget), priv->row_column);
+ _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (priv->popup_widget), priv->row_column);
g_object_notify (G_OBJECT (combo_box), "row-span-column");
}
@@ -4023,7 +4023,7 @@ gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
priv->col_column = column_span;
if (GTK_IS_TREE_MENU (priv->popup_widget))
- gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (priv->popup_widget), priv->col_column);
+ _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (priv->popup_widget), priv->col_column);
g_object_notify (G_OBJECT (combo_box), "column-span-column");
}
@@ -4295,8 +4295,8 @@ gtk_combo_box_set_model (GtkComboBox *combo_box,
if (GTK_IS_TREE_MENU (combo_box->priv->popup_widget))
{
/* menu mode */
- gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget),
- combo_box->priv->model);
+ _gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget),
+ combo_box->priv->model);
}
if (combo_box->priv->cell_view)
@@ -4991,8 +4991,8 @@ gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box,
if (GTK_IS_TREE_MENU (combo_box->priv->popup_widget))
{
- gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), NULL);
- gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), combo_box->priv->model);
+ _gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), NULL);
+ _gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), combo_box->priv->model);
}
gtk_widget_queue_draw (GTK_WIDGET (combo_box));
diff --git a/gtk/gtktreemenu.c b/gtk/gtktreemenu.c
index 98da2c1..ddade3c 100644
--- a/gtk/gtktreemenu.c
+++ b/gtk/gtktreemenu.c
@@ -190,12 +190,12 @@ enum {
static guint tree_menu_signals[N_SIGNALS] = { 0 };
static GQuark tree_menu_path_quark = 0;
-G_DEFINE_TYPE_WITH_CODE (GtkTreeMenu, gtk_tree_menu, GTK_TYPE_MENU,
+G_DEFINE_TYPE_WITH_CODE (GtkTreeMenu, _gtk_tree_menu, GTK_TYPE_MENU,
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
gtk_tree_menu_cell_layout_init));
static void
-gtk_tree_menu_init (GtkTreeMenu *menu)
+_gtk_tree_menu_init (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -234,7 +234,7 @@ gtk_tree_menu_init (GtkTreeMenu *menu)
}
static void
-gtk_tree_menu_class_init (GtkTreeMenuClass *class)
+_gtk_tree_menu_class_init (GtkTreeMenuClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
@@ -420,7 +420,7 @@ gtk_tree_menu_constructor (GType type,
GtkTreeMenu *menu;
GtkTreeMenuPrivate *priv;
- object = G_OBJECT_CLASS (gtk_tree_menu_parent_class)->constructor
+ object = G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->constructor
(type, n_construct_properties, construct_properties);
menu = GTK_TREE_MENU (object);
@@ -451,7 +451,7 @@ gtk_tree_menu_dispose (GObject *object)
menu = GTK_TREE_MENU (object);
priv = menu->priv;
- gtk_tree_menu_set_model (menu, NULL);
+ _gtk_tree_menu_set_model (menu, NULL);
gtk_tree_menu_set_area (menu, NULL);
if (priv->context)
@@ -464,7 +464,7 @@ gtk_tree_menu_dispose (GObject *object)
priv->size_changed_id = 0;
}
- G_OBJECT_CLASS (gtk_tree_menu_parent_class)->dispose (object);
+ G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->dispose (object);
}
static void
@@ -476,13 +476,13 @@ gtk_tree_menu_finalize (GObject *object)
menu = GTK_TREE_MENU (object);
priv = menu->priv;
- gtk_tree_menu_set_row_separator_func (menu, NULL, NULL, NULL);
- gtk_tree_menu_set_header_func (menu, NULL, NULL, NULL);
+ _gtk_tree_menu_set_row_separator_func (menu, NULL, NULL, NULL);
+ _gtk_tree_menu_set_header_func (menu, NULL, NULL, NULL);
if (priv->root)
gtk_tree_row_reference_free (priv->root);
- G_OBJECT_CLASS (gtk_tree_menu_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->finalize (object);
}
static void
@@ -496,11 +496,11 @@ gtk_tree_menu_set_property (GObject *object,
switch (prop_id)
{
case PROP_MODEL:
- gtk_tree_menu_set_model (menu, g_value_get_object (value));
+ _gtk_tree_menu_set_model (menu, g_value_get_object (value));
break;
case PROP_ROOT:
- gtk_tree_menu_set_root (menu, g_value_get_boxed (value));
+ _gtk_tree_menu_set_root (menu, g_value_get_boxed (value));
break;
case PROP_CELL_AREA:
@@ -509,19 +509,19 @@ gtk_tree_menu_set_property (GObject *object,
break;
case PROP_TEAROFF:
- gtk_tree_menu_set_tearoff (menu, g_value_get_boolean (value));
+ _gtk_tree_menu_set_tearoff (menu, g_value_get_boolean (value));
break;
case PROP_WRAP_WIDTH:
- gtk_tree_menu_set_wrap_width (menu, g_value_get_int (value));
+ _gtk_tree_menu_set_wrap_width (menu, g_value_get_int (value));
break;
case PROP_ROW_SPAN_COL:
- gtk_tree_menu_set_row_span_column (menu, g_value_get_int (value));
+ _gtk_tree_menu_set_row_span_column (menu, g_value_get_int (value));
break;
case PROP_COL_SPAN_COL:
- gtk_tree_menu_set_column_span_column (menu, g_value_get_int (value));
+ _gtk_tree_menu_set_column_span_column (menu, g_value_get_int (value));
break;
default:
@@ -619,7 +619,7 @@ gtk_tree_menu_get_preferred_width (GtkWidget *widget,
sync_reserve_submenu_size (menu);
- GTK_WIDGET_CLASS (gtk_tree_menu_parent_class)->get_preferred_width (widget, minimum_size, natural_size);
+ GTK_WIDGET_CLASS (_gtk_tree_menu_parent_class)->get_preferred_width (widget, minimum_size, natural_size);
g_signal_handler_unblock (priv->context, priv->size_changed_id);
}
@@ -636,7 +636,7 @@ gtk_tree_menu_get_preferred_height (GtkWidget *widget,
sync_reserve_submenu_size (menu);
- GTK_WIDGET_CLASS (gtk_tree_menu_parent_class)->get_preferred_height (widget, minimum_size, natural_size);
+ GTK_WIDGET_CLASS (_gtk_tree_menu_parent_class)->get_preferred_height (widget, minimum_size, natural_size);
g_signal_handler_unblock (priv->context, priv->size_changed_id);
}
@@ -1278,23 +1278,23 @@ gtk_tree_menu_create_submenu (GtkTreeMenu *menu,
view = gtk_bin_get_child (GTK_BIN (item));
gtk_cell_view_set_draw_sensitive (GTK_CELL_VIEW (view), TRUE);
- submenu = gtk_tree_menu_new_with_area (priv->area);
+ submenu = _gtk_tree_menu_new_with_area (priv->area);
- gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (submenu),
- priv->row_separator_func,
- priv->row_separator_data,
- priv->row_separator_destroy);
- gtk_tree_menu_set_header_func (GTK_TREE_MENU (submenu),
- priv->header_func,
- priv->header_data,
- priv->header_destroy);
+ _gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (submenu),
+ priv->row_separator_func,
+ priv->row_separator_data,
+ priv->row_separator_destroy);
+ _gtk_tree_menu_set_header_func (GTK_TREE_MENU (submenu),
+ priv->header_func,
+ priv->header_data,
+ priv->header_destroy);
- gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (submenu), priv->wrap_width);
- gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (submenu), priv->row_span_col);
- gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (submenu), priv->col_span_col);
+ _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (submenu), priv->wrap_width);
+ _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (submenu), priv->row_span_col);
+ _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (submenu), priv->col_span_col);
gtk_tree_menu_set_model_internal (GTK_TREE_MENU (submenu), priv->model);
- gtk_tree_menu_set_root (GTK_TREE_MENU (submenu), path);
+ _gtk_tree_menu_set_root (GTK_TREE_MENU (submenu), path);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
g_signal_connect (submenu, "menu-activate",
@@ -1531,7 +1531,7 @@ gtk_tree_menu_set_model_internal (GtkTreeMenu *menu,
****************************************************************/
/**
- * gtk_tree_menu_new:
+ * _gtk_tree_menu_new:
*
* Creates a new #GtkTreeMenu.
*
@@ -1540,13 +1540,13 @@ gtk_tree_menu_set_model_internal (GtkTreeMenu *menu,
* Since: 3.0
*/
GtkWidget *
-gtk_tree_menu_new (void)
+_gtk_tree_menu_new (void)
{
return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU, NULL);
}
/**
- * gtk_tree_menu_new_with_area:
+ * _gtk_tree_menu_new_with_area:
* @area: the #GtkCellArea to use to render cells in the menu
*
* Creates a new #GtkTreeMenu using @area to render it's cells.
@@ -1556,7 +1556,7 @@ gtk_tree_menu_new (void)
* Since: 3.0
*/
GtkWidget *
-gtk_tree_menu_new_with_area (GtkCellArea *area)
+_gtk_tree_menu_new_with_area (GtkCellArea *area)
{
return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU,
"cell-area", area,
@@ -1564,7 +1564,7 @@ gtk_tree_menu_new_with_area (GtkCellArea *area)
}
/**
- * gtk_tree_menu_new_full:
+ * _gtk_tree_menu_new_full:
* @area: (allow-none): the #GtkCellArea to use to render cells in the menu, or %NULL.
* @model: (allow-none): the #GtkTreeModel to build the menu heirarchy from, or %NULL.
* @root: (allow-none): the #GtkTreePath indicating the root row for this menu, or %NULL.
@@ -1576,9 +1576,9 @@ gtk_tree_menu_new_with_area (GtkCellArea *area)
* Since: 3.0
*/
GtkWidget *
-gtk_tree_menu_new_full (GtkCellArea *area,
- GtkTreeModel *model,
- GtkTreePath *root)
+_gtk_tree_menu_new_full (GtkCellArea *area,
+ GtkTreeModel *model,
+ GtkTreePath *root)
{
return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU,
"cell-area", area,
@@ -1588,7 +1588,7 @@ gtk_tree_menu_new_full (GtkCellArea *area,
}
/**
- * gtk_tree_menu_set_model:
+ * _gtk_tree_menu_set_model:
* @menu: a #GtkTreeMenu
* @model: (allow-none): the #GtkTreeModel to build the menu hierarchy from, or %NULL.
*
@@ -1597,8 +1597,8 @@ gtk_tree_menu_new_full (GtkCellArea *area,
* Since: 3.0
*/
void
-gtk_tree_menu_set_model (GtkTreeMenu *menu,
- GtkTreeModel *model)
+_gtk_tree_menu_set_model (GtkTreeMenu *menu,
+ GtkTreeModel *model)
{
g_return_if_fail (GTK_IS_TREE_MENU (menu));
g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
@@ -1609,7 +1609,7 @@ gtk_tree_menu_set_model (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_model:
+ * _gtk_tree_menu_get_model:
* @menu: a #GtkTreeMenu
*
* Gets the @model currently used for the menu heirarhcy.
@@ -1620,7 +1620,7 @@ gtk_tree_menu_set_model (GtkTreeMenu *menu,
* Since: 3.0
*/
GtkTreeModel *
-gtk_tree_menu_get_model (GtkTreeMenu *menu)
+_gtk_tree_menu_get_model (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1632,7 +1632,7 @@ gtk_tree_menu_get_model (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_root:
+ * _gtk_tree_menu_set_root:
* @menu: a #GtkTreeMenu
* @path: (allow-none): the #GtkTreePath which is the root of @menu, or %NULL.
*
@@ -1642,8 +1642,8 @@ gtk_tree_menu_get_model (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_root (GtkTreeMenu *menu,
- GtkTreePath *path)
+_gtk_tree_menu_set_root (GtkTreeMenu *menu,
+ GtkTreePath *path)
{
GtkTreeMenuPrivate *priv;
@@ -1664,7 +1664,7 @@ gtk_tree_menu_set_root (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_root:
+ * _gtk_tree_menu_get_root:
* @menu: a #GtkTreeMenu
*
* Gets the @root path for @menu's hierarchy, or returns %NULL if @menu
@@ -1676,7 +1676,7 @@ gtk_tree_menu_set_root (GtkTreeMenu *menu,
* Since: 3.0
*/
GtkTreePath *
-gtk_tree_menu_get_root (GtkTreeMenu *menu)
+_gtk_tree_menu_get_root (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1691,7 +1691,7 @@ gtk_tree_menu_get_root (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_get_tearoff:
+ * _gtk_tree_menu_get_tearoff:
* @menu: a #GtkTreeMenu
*
* Gets whether this menu is build with a leading tearoff menu item.
@@ -1701,7 +1701,7 @@ gtk_tree_menu_get_root (GtkTreeMenu *menu)
* Since: 3.0
*/
gboolean
-gtk_tree_menu_get_tearoff (GtkTreeMenu *menu)
+_gtk_tree_menu_get_tearoff (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1713,7 +1713,7 @@ gtk_tree_menu_get_tearoff (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_tearoff:
+ * _gtk_tree_menu_set_tearoff:
* @menu: a #GtkTreeMenu
* @tearoff: whether the menu should have a leading tearoff menu item.
*
@@ -1722,8 +1722,8 @@ gtk_tree_menu_get_tearoff (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
- gboolean tearoff)
+_gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
+ gboolean tearoff)
{
GtkTreeMenuPrivate *priv;
@@ -1742,7 +1742,7 @@ gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_wrap_width:
+ * _gtk_tree_menu_get_wrap_width:
* @menu: a #GtkTreeMenu
*
* Gets the wrap width which is used to determine the number of columns
@@ -1753,7 +1753,7 @@ gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
* Since: 3.0
*/
gint
-gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu)
+_gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1765,7 +1765,7 @@ gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_wrap_width:
+ * _gtk_tree_menu_set_wrap_width:
* @menu: a #GtkTreeMenu
* @width: the wrap width
*
@@ -1775,8 +1775,8 @@ gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
- gint width)
+_gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
+ gint width)
{
GtkTreeMenuPrivate *priv;
@@ -1796,7 +1796,7 @@ gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_row_span_column:
+ * _gtk_tree_menu_get_row_span_column:
* @menu: a #GtkTreeMenu
*
* Gets the column with row span information for @menu.
@@ -1808,7 +1808,7 @@ gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
* Since: 3.0
*/
gint
-gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu)
+_gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1820,7 +1820,7 @@ gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_row_span_column:
+ * _gtk_tree_menu_set_row_span_column:
* @menu: a #GtkTreeMenu
* @row_span: the column in the model to fetch the row span for a given menu item.
*
@@ -1831,8 +1831,8 @@ gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
- gint row_span)
+_gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
+ gint row_span)
{
GtkTreeMenuPrivate *priv;
@@ -1852,7 +1852,7 @@ gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_column_span_column:
+ * _gtk_tree_menu_get_column_span_column:
* @menu: a #GtkTreeMenu
*
* Gets the column with column span information for @menu.
@@ -1864,7 +1864,7 @@ gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
* Since: 3.0
*/
gint
-gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu)
+_gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1876,7 +1876,7 @@ gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_column_span_column:
+ * _gtk_tree_menu_set_column_span_column:
* @menu: a #GtkTreeMenu
* @column_span: the column in the model to fetch the column span for a given menu item.
*
@@ -1887,8 +1887,8 @@ gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
- gint column_span)
+_gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
+ gint column_span)
{
GtkTreeMenuPrivate *priv;
@@ -1908,7 +1908,7 @@ gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_row_separator_func:
+ * _gtk_tree_menu_get_row_separator_func:
* @menu: a #GtkTreeMenu
*
* Gets the current #GtkTreeViewRowSeparatorFunc separator function.
@@ -1918,7 +1918,7 @@ gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
* Since: 3.0
*/
GtkTreeViewRowSeparatorFunc
-gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu)
+_gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1930,7 +1930,7 @@ gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_row_separator_func:
+ * _gtk_tree_menu_set_row_separator_func:
* @menu: a #GtkTreeMenu
* @func: (allow-none): a #GtkTreeViewRowSeparatorFunc, or %NULL to unset the separator function.
* @data: (allow-none): user data to pass to @func, or %NULL
@@ -1943,10 +1943,10 @@ gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
- GtkTreeViewRowSeparatorFunc func,
- gpointer data,
- GDestroyNotify destroy)
+_gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
+ GtkTreeViewRowSeparatorFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
{
GtkTreeMenuPrivate *priv;
@@ -1965,7 +1965,7 @@ gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
}
/**
- * gtk_tree_menu_get_header_func:
+ * _gtk_tree_menu_get_header_func:
* @menu: a #GtkTreeMenu
*
* Gets the current #GtkTreeMenuHeaderFunc header function.
@@ -1975,7 +1975,7 @@ gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
* Since: 3.0
*/
GtkTreeMenuHeaderFunc
-gtk_tree_menu_get_header_func (GtkTreeMenu *menu)
+_gtk_tree_menu_get_header_func (GtkTreeMenu *menu)
{
GtkTreeMenuPrivate *priv;
@@ -1987,7 +1987,7 @@ gtk_tree_menu_get_header_func (GtkTreeMenu *menu)
}
/**
- * gtk_tree_menu_set_header_func:
+ * _gtk_tree_menu_set_header_func:
* @menu: a #GtkTreeMenu
* @func: (allow-none): a #GtkTreeMenuHeaderFunc, or %NULL to unset the header function.
* @data: (allow-none): user data to pass to @func, or %NULL
@@ -2003,10 +2003,10 @@ gtk_tree_menu_get_header_func (GtkTreeMenu *menu)
* Since: 3.0
*/
void
-gtk_tree_menu_set_header_func (GtkTreeMenu *menu,
- GtkTreeMenuHeaderFunc func,
- gpointer data,
- GDestroyNotify destroy)
+_gtk_tree_menu_set_header_func (GtkTreeMenu *menu,
+ GtkTreeMenuHeaderFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
{
GtkTreeMenuPrivate *priv;
diff --git a/gtk/gtktreemenu.h b/gtk/gtktreemenu.h
index 5f92c6d..6292466 100644
--- a/gtk/gtktreemenu.h
+++ b/gtk/gtktreemenu.h
@@ -35,7 +35,7 @@
G_BEGIN_DECLS
-#define GTK_TYPE_TREE_MENU (gtk_tree_menu_get_type ())
+#define GTK_TYPE_TREE_MENU (_gtk_tree_menu_get_type ())
#define GTK_TREE_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MENU, GtkTreeMenu))
#define GTK_TREE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_MENU, GtkTreeMenuClass))
#define GTK_IS_TREE_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MENU))
@@ -85,43 +85,43 @@ struct _GtkTreeMenuClass
void (*_gtk_reserved6) (void);
};
-GType gtk_tree_menu_get_type (void) G_GNUC_CONST;
-
-GtkWidget *gtk_tree_menu_new (void);
-GtkWidget *gtk_tree_menu_new_with_area (GtkCellArea *area);
-GtkWidget *gtk_tree_menu_new_full (GtkCellArea *area,
- GtkTreeModel *model,
- GtkTreePath *root);
-void gtk_tree_menu_set_model (GtkTreeMenu *menu,
- GtkTreeModel *model);
-GtkTreeModel *gtk_tree_menu_get_model (GtkTreeMenu *menu);
-void gtk_tree_menu_set_root (GtkTreeMenu *menu,
- GtkTreePath *path);
-GtkTreePath *gtk_tree_menu_get_root (GtkTreeMenu *menu);
-gboolean gtk_tree_menu_get_tearoff (GtkTreeMenu *menu);
-void gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
- gboolean tearoff);
-gint gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu);
-void gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
- gint width);
-gint gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu);
-void gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
- gint row_span);
-gint gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu);
-void gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
- gint column_span);
-
-GtkTreeViewRowSeparatorFunc gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu);
-void gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
- GtkTreeViewRowSeparatorFunc func,
- gpointer data,
- GDestroyNotify destroy);
-
-GtkTreeMenuHeaderFunc gtk_tree_menu_get_header_func (GtkTreeMenu *menu);
-void gtk_tree_menu_set_header_func (GtkTreeMenu *menu,
- GtkTreeMenuHeaderFunc func,
- gpointer data,
- GDestroyNotify destroy);
+GType _gtk_tree_menu_get_type (void) G_GNUC_CONST;
+
+GtkWidget *_gtk_tree_menu_new (void);
+GtkWidget *_gtk_tree_menu_new_with_area (GtkCellArea *area);
+GtkWidget *_gtk_tree_menu_new_full (GtkCellArea *area,
+ GtkTreeModel *model,
+ GtkTreePath *root);
+void _gtk_tree_menu_set_model (GtkTreeMenu *menu,
+ GtkTreeModel *model);
+GtkTreeModel *_gtk_tree_menu_get_model (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_root (GtkTreeMenu *menu,
+ GtkTreePath *path);
+GtkTreePath *_gtk_tree_menu_get_root (GtkTreeMenu *menu);
+gboolean _gtk_tree_menu_get_tearoff (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_tearoff (GtkTreeMenu *menu,
+ gboolean tearoff);
+gint _gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu,
+ gint width);
+gint _gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu,
+ gint row_span);
+gint _gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu,
+ gint column_span);
+
+GtkTreeViewRowSeparatorFunc _gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu,
+ GtkTreeViewRowSeparatorFunc func,
+ gpointer data,
+ GDestroyNotify destroy);
+
+GtkTreeMenuHeaderFunc _gtk_tree_menu_get_header_func (GtkTreeMenu *menu);
+void _gtk_tree_menu_set_header_func (GtkTreeMenu *menu,
+ GtkTreeMenuHeaderFunc func,
+ gpointer data,
+ GDestroyNotify destroy);
G_END_DECLS
diff --git a/tests/testtreemenu.c b/tests/testtreemenu.c
index bb2e73a..2d13e3d 100644
--- a/tests/testtreemenu.c
+++ b/tests/testtreemenu.c
@@ -5,6 +5,8 @@
/*******************************************************
* Grid Test *
*******************************************************/
+
+#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
static GdkPixbuf *
create_color_pixbuf (const char *color)
{
@@ -126,6 +128,7 @@ create_menu_grid_demo (void)
return menu;
}
+#endif
/*******************************************************
* Simple Test *
@@ -273,21 +276,13 @@ simple_tree_model (void)
return (GtkTreeModel *)store;
}
-static GtkWidget *
-simple_tree_menu (void)
+static GtkCellArea *
+create_cell_area (void)
{
- GtkTreeModel *model;
- GtkWidget *menu;
GtkCellArea *area;
GtkCellRenderer *renderer;
- model = simple_tree_model ();
-
- menu = gtk_tree_menu_new ();
- gtk_tree_menu_set_model (GTK_TREE_MENU (menu), model);
- gtk_tree_menu_set_root (GTK_TREE_MENU (menu), NULL);
-
- area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (menu));
+ area = gtk_cell_area_box_new ();
cell_1 = renderer = gtk_cell_renderer_text_new ();
gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, FALSE);
@@ -306,8 +301,24 @@ simple_tree_menu (void)
gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), renderer, FALSE, TRUE);
gtk_cell_area_attribute_connect (area, renderer, "text", SIMPLE_COLUMN_DESCRIPTION);
+ return area;
+}
+
+#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
+static GtkWidget *
+simple_tree_menu (GtkCellArea *area)
+{
+ GtkTreeModel *model;
+ GtkWidget *menu;
+
+ model = simple_tree_model ();
+
+ menu = gtk_tree_menu_new_with_area (area);
+ gtk_tree_menu_set_model (GTK_TREE_MENU (menu), model);
+
return menu;
}
+#endif
static void
orientation_changed (GtkComboBox *combo,
@@ -363,6 +374,16 @@ expand_cell_3_toggled (GtkToggleButton *toggle,
gtk_cell_area_cell_set (area, cell_3, "expand", expand, NULL);
}
+gboolean
+enable_submenu_headers (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ return TRUE;
+}
+
+
+#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
static void
menu_activated_cb (GtkTreeMenu *menu,
const gchar *path,
@@ -382,15 +403,6 @@ menu_activated_cb (GtkTreeMenu *menu,
g_free (row_name);
}
-gboolean
-enable_submenu_headers (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- return TRUE;
-}
-
-
static void
submenu_headers_toggled (GtkToggleButton *toggle,
GtkTreeMenu *menu)
@@ -407,6 +419,7 @@ tearoff_toggled (GtkToggleButton *toggle,
{
gtk_tree_menu_set_tearoff (menu, gtk_toggle_button_get_active (toggle));
}
+#endif
static void
tree_menu (void)
@@ -414,6 +427,7 @@ tree_menu (void)
GtkWidget *window, *widget;
GtkWidget *menu, *menubar, *vbox, *menuitem;
GtkCellArea *area;
+ GtkTreeModel *store;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -425,6 +439,10 @@ tree_menu (void)
menubar = gtk_menu_bar_new ();
gtk_widget_show (menubar);
+ store = simple_tree_model ();
+ area = create_cell_area ();
+
+#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
menuitem = gtk_menu_item_new_with_label ("Grid");
menu = create_menu_grid_demo ();
gtk_widget_show (menu);
@@ -442,13 +460,11 @@ tree_menu (void)
g_signal_connect (menu, "menu-activate", G_CALLBACK (menu_activated_cb), NULL);
gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
+#endif
/* Add a combo box with the same menu ! */
- area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (menu));
- widget = g_object_new (GTK_TYPE_COMBO_BOX,
- "cell-area", area,
- "model", gtk_tree_menu_get_model (GTK_TREE_MENU (menu)),
- NULL);
+ widget = gtk_combo_box_new_with_area (area);
+ gtk_combo_box_set_model (GTK_COMBO_BOX (widget), store);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_show (widget);
gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
@@ -504,6 +520,7 @@ tree_menu (void)
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_3_toggled), area);
+#if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_
widget = gtk_check_button_new_with_label ("Submenu Headers");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_show (widget);
@@ -519,6 +536,7 @@ tree_menu (void)
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (tearoff_toggled), menu);
+#endif
gtk_container_add (GTK_CONTAINER (window), vbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]