Author: pollux
Date: 2006-07-23 15:48:02 +0000 (Sun, 23 Jul 2006)
New Revision: 22517
Modified:
xfburn/trunk/xfburn/xfburn-compositions-notebook.c
Log:
use GObject data instead of a customized struct in order to store the pointer
to the composition
Modified: xfburn/trunk/xfburn/xfburn-compositions-notebook.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-compositions-notebook.c 2006-07-23 15:40:55 UTC
(rev 22516)
+++ xfburn/trunk/xfburn/xfburn-compositions-notebook.c 2006-07-23 15:48:02 UTC
(rev 22517)
@@ -112,11 +112,6 @@
/*************/
/* internals */
/*************/
-typedef struct {
- GtkNotebook *notebook;
- GtkWidget *child;
-} CompositionCloseInfo;
-
static void
cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num,
XfburnCompositionsNotebookPrivate *priv)
{
@@ -124,14 +119,14 @@
}
static void
-cb_composition_close (GtkButton *button, CompositionCloseInfo *info)
+cb_composition_close (XfburnNotebookTab *tab, GtkNotebook *notebook)
{
+ GtkWidget *composition;
guint page_num;
- page_num = gtk_notebook_page_num (info->notebook, info->child);
- gtk_notebook_remove_page (info->notebook, page_num);
-
- g_free (info);
+ composition = g_object_get_data (G_OBJECT (tab), "composition");
+ page_num = gtk_notebook_page_num (notebook, composition);
+ gtk_notebook_remove_page (notebook, page_num);
}
/**********/
@@ -167,7 +162,6 @@
if (composition) {
GtkWidget *tab = NULL;
guint page_num;
- CompositionCloseInfo *info;
tab = xfburn_notebook_tab_new (label_text);
gtk_widget_show (tab);
@@ -176,10 +170,8 @@
page_num = gtk_notebook_append_page(GTK_NOTEBOOK (notebook), composition,
tab);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
- info = g_new0 (CompositionCloseInfo, 1);
- info->notebook = GTK_NOTEBOOK (notebook);
- info->child = composition;
- g_signal_connect (G_OBJECT (tab), "button-close-clicked", G_CALLBACK
(cb_composition_close), info);
+ g_object_set_data (G_OBJECT (tab), "composition", composition);
+ g_signal_connect (G_OBJECT (tab), "button-close-clicked", G_CALLBACK
(cb_composition_close), notebook);
}
g_free (label_text);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits