Commit c9e39436 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Changed to have the list become non-italic when the demo window is

Sat Nov 18 18:00:17 2000  Jonathan Blandford  <jrb@redhat.com>

	* demos/gtk-demo/main.c: Changed to have the list become
	non-italic when the demo window is destroyed through an external
	event (like a close button).  Doing so found three bugs in the
	widget.

	* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.

	* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
	we actually set the cell.

	* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto

	* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
	free a leaked path.  Thanks memprof.
parent 14ec95ef
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c: Changed to have the list become
non-italic when the demo window is destroyed through an external
event (like a close button). Doing so found three bugs in the
widget.
* demos/gtk-demo/*.c (do_*): Changed to return the toplevel window.
* gtk/gtkliststore.c (gtk_list_store_set_cell): emit "change" when
we actually set the cell.
* gtk/gtktreestore.c (gtk_tree_store_set_cell): ditto
* gtk/gtktreeselection.c (gtk_tree_selection_real_select_node):
free a leaked path. Thanks memprof.
Sat Nov 18 11:58:17 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_allocate_images): Fix
......
......@@ -43,7 +43,7 @@ create_bbox (gint horizontal,
return frame;
}
void
GtkWidget *
do_button_box (void)
{
static GtkWidget* window = NULL;
......@@ -115,8 +115,15 @@ do_button_box (void)
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show_all (window);
{
gtk_widget_show_all (window);
}
else
gtk_widget_destroy (window);
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
#!/usr/bin/perl -w
print <<EOT;
typedef GtkWidget *(*GDoDemoFunc) (void);
typedef struct _Demo Demo;
struct _Demo
{
gchar *title;
gchar *filename;
void (*func) (void);
GDoDemoFunc func;
};
EOT
......@@ -31,7 +33,7 @@ for $file (@ARGV) {
close INFO_FILE;
print "void do_$basename (void);\n";
print "GtkWidget *do_$basename (void);\n";
$array .= qq( { "$title", "$file", do_$basename });
}
......
#!/usr/bin/perl -w
print <<EOT;
typedef GtkWidget *(*GDoDemoFunc) (void);
typedef struct _Demo Demo;
struct _Demo
{
gchar *title;
gchar *filename;
void (*func) (void);
GDoDemoFunc func;
};
EOT
......@@ -31,7 +33,7 @@ for $file (@ARGV) {
close INFO_FILE;
print "void do_$basename (void);\n";
print "GtkWidget *do_$basename (void);\n";
$array .= qq( { "$title", "$file", do_$basename });
}
......
......@@ -41,7 +41,7 @@ static GtkItemFactoryEntry menu_items[] =
static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
void
GtkWidget *
do_item_factory (void)
{
static GtkWidget *window = NULL;
......@@ -114,5 +114,10 @@ do_item_factory (void)
gtk_widget_show_all (window);
}
else
gtk_widget_destroy (window);
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
......@@ -20,6 +20,33 @@ enum {
NUM_COLUMNS
};
typedef struct _CallbackData CallbackData;
struct _CallbackData
{
GtkTreeModel *model;
GtkTreePath *path;
};
static void
window_closed_cb (GtkWidget *window, gpointer data)
{
CallbackData *cbdata = data;
GtkTreeIter iter;
gboolean italic;
gtk_tree_model_get_iter (cbdata->model, &iter, cbdata->path);
gtk_tree_store_get (GTK_TREE_STORE (cbdata->model), &iter,
ITALIC_COLUMN, &italic,
-1);
if (italic)
gtk_tree_store_set (GTK_TREE_STORE (cbdata->model), &iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_path_free (cbdata->path);
g_free (cbdata);
}
gboolean
read_line (FILE *stream, GString *str)
{
......@@ -224,7 +251,8 @@ button_press_event_cb (GtkTreeView *tree_view,
{
GtkTreeIter iter;
gboolean italic;
GVoidFunc func;
GDoDemoFunc func;
GtkWidget *window;
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_store_get (GTK_TREE_STORE (model),
......@@ -232,12 +260,28 @@ button_press_event_cb (GtkTreeView *tree_view,
FUNC_COLUMN, &func,
ITALIC_COLUMN, &italic,
-1);
(func) ();
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_path_free (path);
window = (func) ();
if (window != NULL)
{
CallbackData *cbdata;
cbdata = g_new (CallbackData, 1);
cbdata->model = model;
cbdata->path = path;
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
window_closed_cb,
cbdata);
}
else
{
gtk_tree_path_free (path);
}
}
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
......
......@@ -52,7 +52,7 @@ create_menu (gint depth, gboolean tearoff)
return menu;
}
void
GtkWidget *
do_menus (void)
{
static GtkWidget *window = NULL;
......@@ -180,8 +180,15 @@ do_menus (void)
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
{
gtk_widget_show (window);
}
else
gtk_widget_destroy (window);
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
......@@ -113,7 +113,7 @@ create_pane_options (GtkPaned *paned,
return frame;
}
void
GtkWidget *
do_panes (void)
{
static GtkWidget *window = NULL;
......@@ -182,7 +182,14 @@ do_panes (void)
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
{
gtk_widget_show (window);
}
else
gtk_widget_destroy (window);
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
......@@ -163,7 +163,7 @@ insert_text (GtkTextBuffer *buffer)
GtkTextIter start, end;
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) book_closed_xpm);
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
......@@ -282,7 +282,7 @@ insert_text (GtkTextBuffer *buffer)
g_object_unref (G_OBJECT (pixbuf));
}
void
GtkWidget *
do_textview (void)
{
static GtkWidget *window = NULL;
......@@ -342,8 +342,15 @@ do_textview (void)
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
{
gtk_widget_show (window);
}
else
gtk_widget_destroy (window);
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
......@@ -442,6 +442,9 @@ gtk_list_store_set_cell (GtkListStore *list_store,
if (column == 0)
{
_gtk_tree_data_list_value_to_node (list, value);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"changed",
NULL, iter);
return;
}
......
......@@ -893,6 +893,7 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
}
else
selected = TRUE;
gtk_tree_path_free (path);
}
if (selected == TRUE)
{
......
......@@ -502,6 +502,9 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
if (column == 0)
{
_gtk_tree_data_list_value_to_node (list, value);
gtk_signal_emit_by_name (GTK_OBJECT (tree_store),
"changed",
NULL, iter);
return;
}
......
......@@ -1947,7 +1947,7 @@ gtk_tree_view_changed (GtkTreeModel *model,
else
{
/* FIXME: just redraw the node */
gtk_widget_queue_resize (GTK_WIDGET (data));
gtk_widget_queue_draw (GTK_WIDGET (data));
}
}
......
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