Commit fe842a54 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Make GtkCellView public, since people seem to have uses for it, it is

2004-07-19  Matthias Clasen  <mclasen@redhat.com>

	Make GtkCellView public, since people seem to have uses for it,
	it is clean API and we were just conservative in not making it
	public initially. At the same time, get rid of GtkCellViewMenuItem,
	which doesn't have any function which can't be served by a
	GtkMenuItem with a GtkCellView child.

	* gtk/gtk.h: Include gtkcellview.h

	* gtk/Makefile.am (gtk_public_h_sources):

	* gtk/Makefile.am (gtk_private_h_sources):
	(gtk_c_sources): Remove gtkcellviewmenuitem.[hc]
	* gtk/gtkcombobox.c: Replace all uses of GtkCellViewMenuItem by
	GtkMenuItem with a GtkCellView child.

	* gtk/gtkcellviewmenuitem.[hc]: Removed.
parent 5351a4e4
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Make GtkCellView public, since people seem to have uses for it,
it is clean API and we were just conservative in not making it
public initially. At the same time, get rid of GtkCellViewMenuItem,
which doesn't have any function which can't be served by a
GtkMenuItem with a GtkCellView child.
* gtk/gtk.h: Include gtkcellview.h
* gtk/Makefile.am (gtk_public_h_sources):
* gtk/Makefile.am (gtk_private_h_sources):
(gtk_c_sources): Remove gtkcellviewmenuitem.[hc]
* gtk/gtkcombobox.c: Replace all uses of GtkCellViewMenuItem by
GtkMenuItem with a GtkCellView child.
* gtk/gtkcellviewmenuitem.[hc]: Removed.
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Support inline autocompletion in entries (#135953)
......
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Make GtkCellView public, since people seem to have uses for it,
it is clean API and we were just conservative in not making it
public initially. At the same time, get rid of GtkCellViewMenuItem,
which doesn't have any function which can't be served by a
GtkMenuItem with a GtkCellView child.
* gtk/gtk.h: Include gtkcellview.h
* gtk/Makefile.am (gtk_public_h_sources):
* gtk/Makefile.am (gtk_private_h_sources):
(gtk_c_sources): Remove gtkcellviewmenuitem.[hc]
* gtk/gtkcombobox.c: Replace all uses of GtkCellViewMenuItem by
GtkMenuItem with a GtkCellView child.
* gtk/gtkcellviewmenuitem.[hc]: Removed.
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Support inline autocompletion in entries (#135953)
......
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Make GtkCellView public, since people seem to have uses for it,
it is clean API and we were just conservative in not making it
public initially. At the same time, get rid of GtkCellViewMenuItem,
which doesn't have any function which can't be served by a
GtkMenuItem with a GtkCellView child.
* gtk/gtk.h: Include gtkcellview.h
* gtk/Makefile.am (gtk_public_h_sources):
* gtk/Makefile.am (gtk_private_h_sources):
(gtk_c_sources): Remove gtkcellviewmenuitem.[hc]
* gtk/gtkcombobox.c: Replace all uses of GtkCellViewMenuItem by
GtkMenuItem with a GtkCellView child.
* gtk/gtkcellviewmenuitem.[hc]: Removed.
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Support inline autocompletion in entries (#135953)
......
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Make GtkCellView public, since people seem to have uses for it,
it is clean API and we were just conservative in not making it
public initially. At the same time, get rid of GtkCellViewMenuItem,
which doesn't have any function which can't be served by a
GtkMenuItem with a GtkCellView child.
* gtk/gtk.h: Include gtkcellview.h
* gtk/Makefile.am (gtk_public_h_sources):
* gtk/Makefile.am (gtk_private_h_sources):
(gtk_c_sources): Remove gtkcellviewmenuitem.[hc]
* gtk/gtkcombobox.c: Replace all uses of GtkCellViewMenuItem by
GtkMenuItem with a GtkCellView child.
* gtk/gtkcellviewmenuitem.[hc]: Removed.
2004-07-19 Matthias Clasen <mclasen@redhat.com>
Support inline autocompletion in entries (#135953)
......
......@@ -123,6 +123,7 @@ gtk_public_h_sources = \
gtkcellrendererprogress.h \
gtkcellrenderertext.h \
gtkcellrenderertoggle.h \
gtkcellview.h \
gtkcheckbutton.h \
gtkcheckmenuitem.h \
gtkclipboard.h \
......@@ -276,8 +277,6 @@ gtk_semi_private_h_sources = \
# GTK+ header files that don't get installed
gtk_private_h_sources = \
gtkcellrendererseptext.h\
gtkcellview.h \
gtkcellviewmenuitem.h \
gtkentryprivate.h \
gtkfilechooserembed.h \
gtkfilechooserentry.h \
......@@ -332,7 +331,6 @@ gtk_c_sources = \
gtkcellrenderertext.c \
gtkcellrenderertoggle.c \
gtkcellview.c \
gtkcellviewmenuitem.c \
gtkcheckbutton.c \
gtkcheckmenuitem.c \
gtkclipboard.c \
......
......@@ -53,6 +53,7 @@
#include <gtk/gtkcellrendererprogress.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkcellrenderertoggle.h>
#include <gtk/gtkcellview.h>
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkcheckmenuitem.h>
#include <gtk/gtkclipboard.h>
......
/* gtkcellviewmenuitem.c
* Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
*
* 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 this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "gtkcellviewmenuitem.h"
#include "gtkcellview.h"
struct _GtkCellViewMenuItemPrivate
{
GtkWidget *cell_view;
};
static void gtk_cell_view_menu_item_init (GtkCellViewMenuItem *item);
static void gtk_cell_view_menu_item_class_init (GtkCellViewMenuItemClass *klass);
#define GTK_CELL_VIEW_MENU_ITEM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW_MENU_ITEM, GtkCellViewMenuItemPrivate))
GType
gtk_cell_view_menu_item_get_type (void)
{
static GType cell_view_menu_item_type = 0;
if (!cell_view_menu_item_type)
{
static const GTypeInfo cell_view_menu_item_info =
{
sizeof (GtkCellViewMenuItemClass),
NULL,
NULL,
(GClassInitFunc) gtk_cell_view_menu_item_class_init,
NULL,
NULL,
sizeof (GtkCellViewMenuItem),
0,
(GInstanceInitFunc) gtk_cell_view_menu_item_init
};
cell_view_menu_item_type =
g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkCellViewMenuItem",
&cell_view_menu_item_info, 0);
}
return cell_view_menu_item_type;
}
static void
gtk_cell_view_menu_item_class_init (GtkCellViewMenuItemClass *klass)
{
g_type_class_add_private ((GObjectClass *)klass,
sizeof (GtkCellViewMenuItemPrivate));
}
static void
gtk_cell_view_menu_item_init (GtkCellViewMenuItem *item)
{
item->priv = GTK_CELL_VIEW_MENU_ITEM_GET_PRIVATE (item);
}
GtkWidget *
gtk_cell_view_menu_item_new (void)
{
GtkCellViewMenuItem *item;
item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL);
item->priv->cell_view = gtk_cell_view_new ();
gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view);
gtk_widget_show (item->priv->cell_view);
return GTK_WIDGET (item);
}
GtkWidget *
gtk_cell_view_menu_item_new_with_pixbuf (GdkPixbuf *pixbuf)
{
GtkCellViewMenuItem *item;
item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL);
item->priv->cell_view = gtk_cell_view_new_with_pixbuf (pixbuf);
gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view);
gtk_widget_show (item->priv->cell_view);
return GTK_WIDGET (item);
}
GtkWidget *
gtk_cell_view_menu_item_new_with_text (const gchar *text)
{
GtkCellViewMenuItem *item;
item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL);
item->priv->cell_view = gtk_cell_view_new_with_text (text);
gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view);
gtk_widget_show (item->priv->cell_view);
return GTK_WIDGET (item);
}
GtkWidget *
gtk_cell_view_menu_item_new_with_markup (const gchar *markup)
{
GtkCellViewMenuItem *item;
item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL);
item->priv->cell_view = gtk_cell_view_new_with_markup (markup);
gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view);
gtk_widget_show (item->priv->cell_view);
return GTK_WIDGET (item);
}
GtkWidget *
gtk_cell_view_menu_item_new_from_model (GtkTreeModel *model,
GtkTreePath *path)
{
GtkCellViewMenuItem *item;
item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL);
item->priv->cell_view = gtk_cell_view_new ();
gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view);
gtk_cell_view_set_model (GTK_CELL_VIEW (item->priv->cell_view), model);
gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (item->priv->cell_view), path);
gtk_widget_show (item->priv->cell_view);
return GTK_WIDGET (item);
}
/* gtkcellviewmenuitem.h
* Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
*
* 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 this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_CELL_VIEW_MENU_ITEM_H__
#define __GTK_CELL_VIEW_MENU_ITEM_H__
#include <gtk/gtkmenuitem.h>
#include <gtk/gtktreemodel.h>
G_BEGIN_DECLS
#define GTK_TYPE_CELL_VIEW_MENU_ITEM (gtk_cell_view_menu_item_get_type ())
#define GTK_CELL_VIEW_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_VIEW_MENU_ITEM, GtkCellViewMenuItem))
#define GTK_CELL_VIEW_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_VIEW_MENU_ITEM, GtkCellViewMenuItemClass))
#define GTK_IS_CELL_VIEW_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_VIEW_MENU_ITEM))
#define GTK_IS_CELL_VIEW_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_VIEW_MENU_ITEM))
#define GTK_CELL_VIEW_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_VIEW_MENU_ITEM, GtkCellViewMenuItemClass))
typedef struct _GtkCellViewMenuItem GtkCellViewMenuItem;
typedef struct _GtkCellViewMenuItemClass GtkCellViewMenuItemClass;
typedef struct _GtkCellViewMenuItemPrivate GtkCellViewMenuItemPrivate;
struct _GtkCellViewMenuItem
{
GtkMenuItem parent_instance;
/*< private >*/
GtkCellViewMenuItemPrivate *priv;
};
struct _GtkCellViewMenuItemClass
{
GtkMenuItemClass parent_class;
};
GType gtk_cell_view_menu_item_get_type (void);
GtkWidget *gtk_cell_view_menu_item_new (void);
GtkWidget *gtk_cell_view_menu_item_new_with_pixbuf (GdkPixbuf *pixbuf);
GtkWidget *gtk_cell_view_menu_item_new_with_text (const gchar *text);
GtkWidget *gtk_cell_view_menu_item_new_with_markup (const gchar *markup);
GtkWidget *gtk_cell_view_menu_item_new_from_model (GtkTreeModel *model,
GtkTreePath *path);
G_END_DECLS
#endif /* __GTK_CELL_VIEW_MENU_ITEM_H__ */
......@@ -25,7 +25,6 @@
#include "gtkcelllayout.h"
#include "gtkcellrenderertext.h"
#include "gtkcellview.h"
#include "gtkcellviewmenuitem.h"
#include "gtkeventbox.h"
#include "gtkframe.h"
#include "gtkhbox.h"
......@@ -1239,7 +1238,7 @@ menu_row_is_sensitive (GtkComboBox *combo_box,
GList *cells, *list;
gboolean sensitive;
if (!GTK_IS_CELL_VIEW_MENU_ITEM (item))
if (!GTK_IS_CELL_VIEW (GTK_BIN (item)->child))
return FALSE;
cell_view = gtk_bin_get_child (GTK_BIN (item));
......@@ -1372,7 +1371,7 @@ update_menu_sensitivity (GtkComboBox *combo_box)
GtkWidget *item = GTK_WIDGET (child->data);
gboolean sensitive;
if (!GTK_IS_CELL_VIEW_MENU_ITEM (item))
if (!GTK_IS_CELL_VIEW (GTK_BIN (item)->child))
continue;
sensitive = menu_row_is_sensitive (combo_box, item);
......@@ -2059,14 +2058,21 @@ gtk_combo_box_menu_fill (GtkComboBox *combo_box)
tmp = gtk_separator_menu_item_new ();
else
{
tmp = gtk_cell_view_menu_item_new_from_model (combo_box->priv->model,
path);
GtkCellView *cell_view;
cell_view = gtk_cell_view_new ();
gtk_cell_view_set_model (cell_view, combo_box->priv->model);
gtk_cell_view_set_displayed_row (cell_view, path);
gtk_widget_show (GTK_WIDGET (cell_view));
tmp = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER (tmp), cell_view);
g_signal_connect (tmp, "activate",
G_CALLBACK (gtk_combo_box_menu_item_activate),
combo_box);
cell_view_sync_cells (combo_box,
GTK_CELL_VIEW (GTK_BIN (tmp)->child));
cell_view_sync_cells (combo_box, cell_view);
}
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tmp);
......@@ -2412,6 +2418,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
GtkWidget *menu;
GtkWidget *item;
GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
GtkCellView *cell_view;
if (!combo_box->priv->popup_widget)
return;
......@@ -2419,12 +2426,19 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
menu = combo_box->priv->popup_widget;
g_return_if_fail (GTK_IS_MENU (menu));
item = gtk_cell_view_menu_item_new_from_model (model, path);
cell_view = gtk_cell_view_new ();
gtk_cell_view_set_model (cell_view, model);
gtk_cell_view_set_displayed_row (cell_view, path);
gtk_widget_show (GTK_WIDGET (cell_view));
item = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER (item), cell_view);
g_signal_connect (item, "activate",
G_CALLBACK (gtk_combo_box_menu_item_activate),
combo_box);
cell_view_sync_cells (combo_box, GTK_CELL_VIEW (GTK_BIN (item)->child));
cell_view_sync_cells (combo_box, cell_view);
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item,
gtk_tree_path_get_indices (path)[0]);
......@@ -2999,10 +3013,10 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
view = GTK_CELL_VIEW (i->data);
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (view), cell, expand);
}
......@@ -3052,10 +3066,10 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (view), cell, expand);
}
......@@ -3105,10 +3119,10 @@ gtk_combo_box_cell_layout_clear (GtkCellLayout *layout)
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_clear (GTK_CELL_LAYOUT (view));
}
......@@ -3159,10 +3173,10 @@ gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (view), cell,
attribute, column);
......@@ -3222,10 +3236,10 @@ gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (view), cell,
func, func_data, NULL);
......@@ -3281,10 +3295,10 @@ gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (view), cell);
}
......@@ -3343,10 +3357,10 @@ gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
if (GTK_IS_TEAROFF_MENU_ITEM (i->data))
continue;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
if (GTK_IS_CELL_VIEW (i->data))
view = GTK_CELL_VIEW (i->data);
else
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (view), cell, position);
}
......@@ -4059,7 +4073,8 @@ gtk_cell_editable_key_press (GtkWidget *widget,
}
else if (event->keyval == GDK_Return)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
if (GTK_IS_CELL_EDITABLE (combo_box))
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
if (GTK_IS_CELL_EDITABLE (combo_box))
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment