* Boston, MA 02111-1307, USA.
*/
-#undef GTK_DISABLE_DEPRECATED
#include <string.h>
#include "prop-editor.h"
#include <gtk/gtk.h>
GtkCellRenderer *rend;
GdkPixbuf *pixbuf;
GtkWidget *image;
- GtkObject *adjustment;
-
+ GtkAdjustment *adjustment;
+
current_column_type = type;
col = gtk_tree_view_get_column (tree_view, 0);
gtk_tree_view_set_rules_hint (tree_view, TRUE);
rend = gtk_cell_renderer_text_new ();
-
+
col = gtk_tree_view_column_new_with_attributes ("Column 1",
rend,
"text", 1,
GtkTreeStore *store;
gint i;
GType *t;
- volatile GType dummy; /* G_GNUC_CONST makes the optimizer remove
- * get_type calls if you don't do something
- * like this
- */
/* Make the tree more interesting */
- dummy = gtk_scrolled_window_get_type ();
- dummy = gtk_label_get_type ();
- dummy = gtk_hscrollbar_get_type ();
- dummy = gtk_vscrollbar_get_type ();
- dummy = pango_layout_get_type ();
+ /* - we need this magic here so we are sure the type ends up being
+ * registered and gcc doesn't optimize away the code */
+ g_type_class_unref (g_type_class_ref (gtk_scrolled_window_get_type ()));
+ g_type_class_unref (g_type_class_ref (gtk_label_get_type ()));
+ g_type_class_unref (g_type_class_ref (gtk_scrollbar_get_type ()));
+ g_type_class_unref (g_type_class_ref (pango_layout_get_type ()));
t = get_model_types ();
}
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))
{
}
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 ())
{
GtkWidget *sw;
GtkWidget *tv;
GtkWidget *table;
- GtkWidget *om;
- GtkWidget *menu;
+ GtkWidget *combo_box;
GtkTreeModel *model;
gint i;
gtk_init (&argc, &argv);
+ if (g_getenv ("RTL"))
+ gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+
our_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) book_closed_xpm);
#if 0
GDK_ACTION_MOVE | GDK_ACTION_COPY);
/* Model menu */
+ combo_box = gtk_combo_box_text_new ();
+ for (i = 0; i < MODEL_LAST; i++)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), model_names[i]);
- 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);
-
- 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 */
+ combo_box = gtk_combo_box_text_new ();
+ for (i = 0; i < COLUMNS_LAST; i++)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), column_type_names[i]);
- 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);
-
- 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);