[gtk+/gtk-2-90] Port testtreeview to new API
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-90] Port testtreeview to new API
- Date: Sat, 24 Apr 2010 02:34:02 +0000 (UTC)
commit d419ac0639b5ff934f7059e0968ea14c3feca82a
Author: Javier Jardón <jjardon gnome org>
Date: Sat Apr 24 03:53:11 2010 +0200
Port testtreeview to new API
Use GtkComboBox instead the deprecated GtkOptionMenu
https://bugzilla.gnome.org/show_bug.cgi?id=616679
tests/testtreeview.c | 79 +++++++++++---------------------------------------
1 files changed, 17 insertions(+), 62 deletions(-)
---
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 8f376bd..9fbba7d 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -18,7 +18,6 @@
* Boston, MA 02111-1307, USA.
*/
-#undef GTK_DISABLE_DEPRECATED
#include <string.h>
#include "prop-editor.h"
#include <gtk/gtk.h>
@@ -658,12 +657,12 @@ create_tree_model (void)
}
static void
-model_selected (GtkOptionMenu *om, gpointer data)
+model_selected (GtkComboBox *combo_box, gpointer data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
gint hist;
- hist = gtk_option_menu_get_history (om);
+ hist = gtk_combo_box_get_active (combo_box);
if (models[hist] != gtk_tree_view_get_model (tree_view))
{
@@ -672,12 +671,12 @@ model_selected (GtkOptionMenu *om, gpointer data)
}
static void
-columns_selected (GtkOptionMenu *om, gpointer data)
+columns_selected (GtkComboBox *combo_box, gpointer data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
gint hist;
- hist = gtk_option_menu_get_history (om);
+ hist = gtk_combo_box_get_active (combo_box);
if (hist != get_columns_type ())
{
@@ -704,8 +703,7 @@ main (int argc,
GtkWidget *sw;
GtkWidget *tv;
GtkWidget *table;
- GtkWidget *om;
- GtkWidget *menu;
+ GtkWidget *combo_box;
GtkTreeModel *model;
gint i;
@@ -756,77 +754,34 @@ main (int argc,
GDK_ACTION_MOVE | GDK_ACTION_COPY);
/* Model menu */
-
- menu = gtk_menu_new ();
-
- i = 0;
- while (i < MODEL_LAST)
- {
- GtkWidget *mi;
- const char *name;
-
- name = model_names[i];
-
- mi = gtk_menu_item_new_with_label (name);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
-
-#if 0
- window = create_prop_editor (G_OBJECT (models[i]));
-
- gtk_window_set_title (GTK_WINDOW (window),
- name);
-#endif
-
- ++i;
- }
- gtk_widget_show_all (menu);
+ combo_box = gtk_combo_box_new_text ();
+ for (i = 0; i < MODEL_LAST; i++)
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), model_names[i]);
- om = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (om), menu);
-
- gtk_table_attach (GTK_TABLE (table), om,
+ gtk_table_attach (GTK_TABLE (table), combo_box,
0, 1, 0, 1,
0, 0,
0, 0);
- g_signal_connect (om,
+ g_signal_connect (combo_box,
"changed",
G_CALLBACK (model_selected),
tv);
/* Columns menu */
-
- menu = gtk_menu_new ();
-
- i = 0;
- while (i < COLUMNS_LAST)
- {
- GtkWidget *mi;
- const char *name;
-
- name = column_type_names[i];
-
- mi = gtk_menu_item_new_with_label (name);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
-
- ++i;
- }
- gtk_widget_show_all (menu);
+ combo_box = gtk_combo_box_new_text ();
+ for (i = 0; i < COLUMNS_LAST; i++)
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), column_type_names[i]);
- om = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (om), menu);
-
- gtk_table_attach (GTK_TABLE (table), om,
+ gtk_table_attach (GTK_TABLE (table), combo_box,
0, 1, 1, 2,
0, 0,
0, 0);
set_columns_type (GTK_TREE_VIEW (tv), COLUMNS_LOTS);
- gtk_option_menu_set_history (GTK_OPTION_MENU (om), COLUMNS_LOTS);
-
- g_signal_connect (om,
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), COLUMNS_LOTS);
+
+ g_signal_connect (combo_box,
"changed",
G_CALLBACK (columns_selected),
tv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]