summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2002-03-03 05:41:28 +0000
committerTim Janik <timj@src.gnome.org>2002-03-03 05:41:28 +0000
commitf0b58ab846b04abd4d23be19d0924b812cc74872 (patch)
treec7eac7da5950e721205e484def743cb377f0970b /gtk
parentb47b15f6ba401c735d415e65d1fa7620e3546968 (diff)
downloadgtk+-f0b58ab846b04abd4d23be19d0924b812cc74872.tar.gz
added compile time switch to put the tree views into a hpaned for owen to
Sun Mar 3 06:39:19 2002 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c: added compile time switch to put the tree views into a hpaned for owen to play with. * gtk/gtktreedatalist.c (_gtk_tree_data_list_header_free): * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data_func), (gtk_tree_view_column_finalize): * gtk/gtktreestore.c (gtk_tree_store_set_default_sort_func), (gtk_tree_store_set_sort_func), (gtk_tree_store_finalize): * gtk/gtktreeselection.c (gtk_tree_selection_finalize): * gtk/gtktreemodelsort.c (gtk_tree_model_sort_reset_default_sort_func), (gtk_tree_model_sort_set_default_sort_func), (gtk_tree_model_sort_set_sort_func): * gtk/gtkliststore.c (gtk_list_store_set_default_sort_func), (gtk_list_store_set_default_sort_func), (gtk_list_store_set_sort_func), (gtk_list_store_finalize): add reentrancy protection around destroy() function invocation. * gtk/gtktreeselection.c (gtk_tree_selection_set_select_function): fix destroy function invocation (which was missing).
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkfilesel.c18
-rw-r--r--gtk/gtkliststore.c18
-rw-r--r--gtk/gtktreedatalist.c7
-rw-r--r--gtk/gtktreemodelsort.c21
-rw-r--r--gtk/gtktreeselection.c19
-rw-r--r--gtk/gtktreestore.c19
-rw-r--r--gtk/gtktreeviewcolumn.c22
7 files changed, 100 insertions, 24 deletions
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index c8c2df3707..06a952c6b2 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -82,6 +82,8 @@
#include "gtkdnd.h"
#include "gtkeventbox.h"
+#define WANT_HPANAED 1
+#include "gtkhpaned.h"
#ifdef G_OS_WIN32
#include <direct.h>
@@ -630,7 +632,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
{
GtkWidget *entry_vbox;
GtkWidget *label;
- GtkWidget *list_hbox;
+ GtkWidget *list_hbox, *list_container;
GtkWidget *confirm_area;
GtkWidget *pulldown_hbox;
GtkWidget *scrolled_win;
@@ -675,6 +677,13 @@ gtk_file_selection_init (GtkFileSelection *filesel)
list_hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
gtk_widget_show (list_hbox);
+ if (WANT_HPANAED)
+ list_container = g_object_new (GTK_TYPE_HPANED,
+ "visible", TRUE,
+ "parent", list_hbox,
+ NULL);
+ else
+ list_container = list_hbox;
/* The directories list */
@@ -705,7 +714,10 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
- gtk_box_pack_start (GTK_BOX (list_hbox), scrolled_win, TRUE, TRUE, 0);
+ if (GTK_IS_PANED (list_container))
+ gtk_paned_pack1 (GTK_PANED (list_container), scrolled_win, TRUE, TRUE);
+ else
+ gtk_container_add (GTK_CONTAINER (list_container), scrolled_win);
gtk_widget_show (filesel->dir_list);
gtk_widget_show (scrolled_win);
@@ -739,7 +751,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
- gtk_box_pack_start (GTK_BOX (list_hbox), scrolled_win, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (list_container), scrolled_win);
gtk_widget_show (filesel->file_list);
gtk_widget_show (scrolled_win);
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index dfc00c4931..004abc5ce0 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -430,8 +430,10 @@ gtk_list_store_finalize (GObject *object)
if (list_store->default_sort_destroy)
{
- (* list_store->default_sort_destroy) (list_store->default_sort_data);
+ GtkDestroyNotify d = list_store->default_sort_destroy;
+
list_store->default_sort_destroy = NULL;
+ d (list_store->default_sort_data);
list_store->default_sort_data = NULL;
}
@@ -1918,7 +1920,12 @@ gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
}
if (header->destroy)
- (* header->destroy) (header->data);
+ {
+ GtkDestroyNotify d = header->destroy;
+
+ header->destroy = NULL;
+ d (header->data);
+ }
header->func = func;
header->data = data;
@@ -1937,7 +1944,12 @@ gtk_list_store_set_default_sort_func (GtkTreeSortable *sortable,
g_return_if_fail (GTK_IS_LIST_STORE (sortable));
if (list_store->default_sort_destroy)
- (* list_store->default_sort_destroy) (list_store->default_sort_data);
+ {
+ GtkDestroyNotify d = list_store->default_sort_destroy;
+
+ list_store->default_sort_destroy = NULL;
+ d (list_store->default_sort_data);
+ }
list_store->default_sort_func = func;
list_store->default_sort_data = data;
diff --git a/gtk/gtktreedatalist.c b/gtk/gtktreedatalist.c
index 403da218a6..a1007c355a 100644
--- a/gtk/gtktreedatalist.c
+++ b/gtk/gtktreedatalist.c
@@ -409,7 +409,12 @@ _gtk_tree_data_list_header_free (GList *list)
GtkTreeDataSortHeader *header = (GtkTreeDataSortHeader *) tmp->data;
if (header->destroy)
- (* header->destroy) (header->data);
+ {
+ GtkDestroyNotify d = header->destroy;
+
+ header->destroy = NULL;
+ d (header->data);
+ }
g_free (header);
}
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c
index 91851e50e8..e2cbe2f96e 100644
--- a/gtk/gtktreemodelsort.c
+++ b/gtk/gtktreemodelsort.c
@@ -1287,7 +1287,12 @@ gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
}
if (header->destroy)
- (* header->destroy) (header->data);
+ {
+ GtkDestroyNotify d = header->destroy;
+
+ header->destroy = NULL;
+ d (header->data);
+ }
header->func = func;
header->data = data;
@@ -1305,7 +1310,12 @@ gtk_tree_model_sort_set_default_sort_func (GtkTreeSortable *sortable,
g_return_if_fail (GTK_IS_TREE_MODEL_SORT (sortable));
if (tree_model_sort->default_sort_destroy)
- (* tree_model_sort->default_sort_destroy) (tree_model_sort->default_sort_data);
+ {
+ GtkDestroyNotify d = tree_model_sort->default_sort_destroy;
+
+ tree_model_sort->default_sort_destroy = NULL;
+ d (tree_model_sort->default_sort_data);
+ }
tree_model_sort->default_sort_func = func;
tree_model_sort->default_sort_data = data;
@@ -2187,7 +2197,12 @@ gtk_tree_model_sort_reset_default_sort_func (GtkTreeModelSort *tree_model_sort)
g_return_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort));
if (tree_model_sort->default_sort_destroy)
- (* tree_model_sort->default_sort_destroy) (tree_model_sort->default_sort_data);
+ {
+ GtkDestroyNotify d = tree_model_sort->default_sort_destroy;
+
+ tree_model_sort->default_sort_destroy = NULL;
+ d (tree_model_sort->default_sort_data);
+ }
tree_model_sort->default_sort_func = NO_SORT_FUNC;
tree_model_sort->default_sort_data = NULL;
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c
index 6b67452bc6..2c93cd4350 100644
--- a/gtk/gtktreeselection.c
+++ b/gtk/gtktreeselection.c
@@ -98,8 +98,15 @@ gtk_tree_selection_init (GtkTreeSelection *selection)
static void
gtk_tree_selection_finalize (GObject *object)
{
- if (GTK_TREE_SELECTION (object)->destroy)
- (* GTK_TREE_SELECTION (object)->destroy) (GTK_TREE_SELECTION (object)->user_data);
+ GtkTreeSelection *selection = GTK_TREE_SELECTION (object);
+
+ if (selection->destroy)
+ {
+ GtkDestroyNotify d = selection->destroy;
+
+ selection->destroy = NULL;
+ d (selection->user_data);
+ }
/* chain parent_class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -276,6 +283,14 @@ gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
g_return_if_fail (func != NULL);
+ if (selection->destroy)
+ {
+ GtkDestroyNotify d = selection->destroy;
+
+ selection->destroy = NULL;
+ d (selection->user_data);
+ }
+
selection->user_func = func;
selection->user_data = data;
selection->destroy = destroy;
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c
index 65b37479cb..38164bb595 100644
--- a/gtk/gtktreestore.c
+++ b/gtk/gtktreestore.c
@@ -450,8 +450,10 @@ gtk_tree_store_finalize (GObject *object)
if (tree_store->default_sort_destroy)
{
- (* tree_store->default_sort_destroy) (tree_store->default_sort_data);
+ GtkDestroyNotify d = tree_store->default_sort_destroy;
+
tree_store->default_sort_destroy = NULL;
+ d (tree_store->default_sort_data);
tree_store->default_sort_data = NULL;
}
@@ -2195,12 +2197,16 @@ gtk_tree_store_set_sort_func (GtkTreeSortable *sortable,
}
if (header->destroy)
- (* header->destroy) (header->data);
+ {
+ GtkDestroyNotify d = header->destroy;
+
+ header->destroy = NULL;
+ d (header->data);
+ }
header->func = func;
header->data = data;
header->destroy = destroy;
-
}
static void
@@ -2214,7 +2220,12 @@ gtk_tree_store_set_default_sort_func (GtkTreeSortable *sortable,
g_return_if_fail (GTK_IS_TREE_STORE (sortable));
if (tree_store->default_sort_destroy)
- (* tree_store->default_sort_destroy) (tree_store->default_sort_data);
+ {
+ GtkDestroyNotify d = tree_store->default_sort_destroy;
+
+ tree_store->default_sort_destroy = NULL;
+ d (tree_store->default_sort_data);
+ }
tree_store->default_sort_func = func;
tree_store->default_sort_data = data;
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index fb6d453a98..49cc8b9db5 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -329,8 +329,14 @@ gtk_tree_view_column_finalize (GObject *object)
for (list = tree_column->cell_list; list; list = list->next)
{
GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
- if (info->func_data && info->destroy)
- (info->destroy) (info->func_data);
+
+ if (info->destroy)
+ {
+ GtkDestroyNotify d = info->destroy;
+
+ info->destroy = NULL;
+ d (info->func_data);
+ }
gtk_tree_view_column_clear_attributes (tree_column, info->cell);
g_object_unref (G_OBJECT (info->cell));
g_free (info);
@@ -1333,13 +1339,13 @@ gtk_tree_view_column_set_cell_data_func (GtkTreeViewColumn *tree_column,
g_return_if_fail (info != NULL);
- if (func == info->func &&
- func_data == info->func_data &&
- destroy == info->destroy)
- return;
+ if (info->destroy)
+ {
+ GtkDestroyNotify d = info->destroy;
- if (info->func_data && info->destroy)
- (info->destroy) (info->func_data);
+ info->destroy = NULL;
+ d (info->func_data);
+ }
info->func = func;
info->func_data = func_data;