Commit 04d8a337 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/module_db.c app/gui/color-area.c app/widgets/gimpbrushfactoryview.c

2001-07-27  Sven Neumann  <sven@gimp.org>

	* app/module_db.c
	* app/gui/color-area.c
	* app/widgets/gimpbrushfactoryview.c
	* app/widgets/gimpbufferview.c
	* app/widgets/gimpchannellistview.c
	* app/widgets/gimpcontainerlistview.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpdialogfactory.c
	* app/widgets/gimpdock.c: more GObject porting
parent da88297a
2001-07-27 Sven Neumann <sven@gimp.org>
* app/module_db.c
* app/gui/color-area.c
* app/widgets/gimpbrushfactoryview.c
* app/widgets/gimpbufferview.c
* app/widgets/gimpchannellistview.c
* app/widgets/gimpcontainerlistview.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpdialogfactory.c
* app/widgets/gimpdock.c: more GObject porting
2001-07-27 Michael Natterer <mitch@gimp.org>
* app/errorconsole.c
......
......@@ -358,7 +358,7 @@ module_db_browser_new (void)
button = gtk_button_new_with_label (_("Refresh"));
gtk_widget_show (button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
browser_refresh_callback, st);
GTK_SIGNAL_FUNC (browser_refresh_callback), st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
st->button = gtk_button_new_with_label ("");
......@@ -366,29 +366,30 @@ module_db_browser_new (void)
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
gtk_signal_connect (GTK_OBJECT (st->button), "clicked",
browser_load_unload_callback, st);
GTK_SIGNAL_FUNC (browser_load_unload_callback), st);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
gtk_object_set_user_data (GTK_OBJECT (st->list), st);
g_object_set_data (G_OBJECT (st->list), "state", st);
gtk_signal_connect (GTK_OBJECT (st->list), "select_child",
browser_select_callback, NULL);
g_signal_connect (G_OBJECT (st->list), "select_child",
G_CALLBACK (browser_select_callback), NULL);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
modules_handler_id =
gimp_container_add_handler (modules, "modified", browser_info_update, st);
gimp_container_add_handler (modules, "modified",
G_CALLBACK (browser_info_update), st);
gtk_signal_connect (GTK_OBJECT (modules), "add",
browser_info_add, st);
gtk_signal_connect (GTK_OBJECT (modules), "remove",
browser_info_remove, st);
g_signal_connect (G_OBJECT (modules), "add",
G_CALLBACK (browser_info_add), st);
g_signal_connect (G_OBJECT (modules), "remove",
G_CALLBACK (browser_info_remove), st);
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
browser_destroy_callback, st);
GTK_SIGNAL_FUNC (browser_destroy_callback), st);
return shell;
}
......@@ -493,7 +494,7 @@ module_info_get_type (void)
static void
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
g_signal_emit (G_OBJECT (mod), module_info_signals[MODIFIED], 0);
}
static ModuleInfo *
......@@ -799,7 +800,9 @@ static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
g_signal_handlers_disconnect_matched (G_OBJECT (modules),
G_SIGNAL_MATCH_DATA,
0, 0, 0, NULL, data);
gimp_container_remove_handler (modules, modules_handler_id);
g_free (data);
}
......@@ -948,24 +951,24 @@ browser_info_init (BrowserState *st,
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_signal_connect (GTK_OBJECT (st->load_inhibit_check), "toggled",
browser_load_inhibit_callback, st);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
}
static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
ModuleInfo *i;
ModuleInfo *info;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
info = g_object_get_data (G_OBJECT (child), "module_info");
st = g_object_get_data (G_OBJECT (widget), "state");
if (st->last_update == i)
if (st->last_update == info)
return;
st->last_update = i;
st->last_update = info;
browser_info_update (st->last_update, st);
}
......@@ -1000,7 +1003,7 @@ make_list_item (gpointer data,
list_item = gtk_list_item_new_with_label (info->fullpath);
gtk_widget_show (list_item);
gtk_object_set_user_data (GTK_OBJECT (list_item), info);
g_object_set_data (G_OBJECT (list_item), "module_info", info);
gtk_container_add (GTK_CONTAINER (st->list), list_item);
}
......@@ -1023,7 +1026,7 @@ browser_info_remove (GimpContainer *container,
GList *dlist;
GList *free_list;
GtkWidget *list_item;
ModuleInfo *i;
ModuleInfo *info;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
......@@ -1032,13 +1035,13 @@ browser_info_remove (GimpContainer *container,
{
list_item = dlist->data;
i = gtk_object_get_user_data (GTK_OBJECT (list_item));
g_return_if_fail (i != NULL);
info = g_object_get_data (G_OBJECT (list_item), "module_info");
g_return_if_fail (info != NULL);
if (i == mod)
if (info == mod)
{
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
g_list_free(free_list);
g_list_free (free_list);
return;
}
......
......@@ -157,7 +157,9 @@ color_area_draw_rect (GdkDrawable *drawable,
{
if (color_area_rgb_buf)
g_free (color_area_rgb_buf);
color_area_rgb_buf = g_malloc (color_area_rgb_buf_size = rowstride * height);
color_area_rgb_buf =
g_malloc (color_area_rgb_buf_size = rowstride * height);
}
bp = color_area_rgb_buf;
......@@ -491,9 +493,12 @@ color_area_create (gint width,
GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
#ifndef GDK_WINDOWING_DIRECTFB
gtk_signal_connect (GTK_OBJECT (color_area), "event",
GTK_SIGNAL_FUNC (color_area_events),
NULL);
#endif
gtk_signal_connect (GTK_OBJECT (color_area), "realize",
GTK_SIGNAL_FUNC (color_area_realize),
......
......@@ -358,7 +358,7 @@ module_db_browser_new (void)
button = gtk_button_new_with_label (_("Refresh"));
gtk_widget_show (button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
browser_refresh_callback, st);
GTK_SIGNAL_FUNC (browser_refresh_callback), st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
st->button = gtk_button_new_with_label ("");
......@@ -366,29 +366,30 @@ module_db_browser_new (void)
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
gtk_signal_connect (GTK_OBJECT (st->button), "clicked",
browser_load_unload_callback, st);
GTK_SIGNAL_FUNC (browser_load_unload_callback), st);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
gtk_object_set_user_data (GTK_OBJECT (st->list), st);
g_object_set_data (G_OBJECT (st->list), "state", st);
gtk_signal_connect (GTK_OBJECT (st->list), "select_child",
browser_select_callback, NULL);
g_signal_connect (G_OBJECT (st->list), "select_child",
G_CALLBACK (browser_select_callback), NULL);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
modules_handler_id =
gimp_container_add_handler (modules, "modified", browser_info_update, st);
gimp_container_add_handler (modules, "modified",
G_CALLBACK (browser_info_update), st);
gtk_signal_connect (GTK_OBJECT (modules), "add",
browser_info_add, st);
gtk_signal_connect (GTK_OBJECT (modules), "remove",
browser_info_remove, st);
g_signal_connect (G_OBJECT (modules), "add",
G_CALLBACK (browser_info_add), st);
g_signal_connect (G_OBJECT (modules), "remove",
G_CALLBACK (browser_info_remove), st);
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
browser_destroy_callback, st);
GTK_SIGNAL_FUNC (browser_destroy_callback), st);
return shell;
}
......@@ -493,7 +494,7 @@ module_info_get_type (void)
static void
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
g_signal_emit (G_OBJECT (mod), module_info_signals[MODIFIED], 0);
}
static ModuleInfo *
......@@ -799,7 +800,9 @@ static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
g_signal_handlers_disconnect_matched (G_OBJECT (modules),
G_SIGNAL_MATCH_DATA,
0, 0, 0, NULL, data);
gimp_container_remove_handler (modules, modules_handler_id);
g_free (data);
}
......@@ -948,24 +951,24 @@ browser_info_init (BrowserState *st,
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_signal_connect (GTK_OBJECT (st->load_inhibit_check), "toggled",
browser_load_inhibit_callback, st);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
}
static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
ModuleInfo *i;
ModuleInfo *info;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
info = g_object_get_data (G_OBJECT (child), "module_info");
st = g_object_get_data (G_OBJECT (widget), "state");
if (st->last_update == i)
if (st->last_update == info)
return;
st->last_update = i;
st->last_update = info;
browser_info_update (st->last_update, st);
}
......@@ -1000,7 +1003,7 @@ make_list_item (gpointer data,
list_item = gtk_list_item_new_with_label (info->fullpath);
gtk_widget_show (list_item);
gtk_object_set_user_data (GTK_OBJECT (list_item), info);
g_object_set_data (G_OBJECT (list_item), "module_info", info);
gtk_container_add (GTK_CONTAINER (st->list), list_item);
}
......@@ -1023,7 +1026,7 @@ browser_info_remove (GimpContainer *container,
GList *dlist;
GList *free_list;
GtkWidget *list_item;
ModuleInfo *i;
ModuleInfo *info;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
......@@ -1032,13 +1035,13 @@ browser_info_remove (GimpContainer *container,
{
list_item = dlist->data;
i = gtk_object_get_user_data (GTK_OBJECT (list_item));
g_return_if_fail (i != NULL);
info = g_object_get_data (G_OBJECT (list_item), "module_info");
g_return_if_fail (info != NULL);
if (i == mod)
if (info == mod)
{
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
g_list_free(free_list);
g_list_free (free_list);
return;
}
......
......@@ -358,7 +358,7 @@ module_db_browser_new (void)
button = gtk_button_new_with_label (_("Refresh"));
gtk_widget_show (button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
browser_refresh_callback, st);
GTK_SIGNAL_FUNC (browser_refresh_callback), st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
st->button = gtk_button_new_with_label ("");
......@@ -366,29 +366,30 @@ module_db_browser_new (void)
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
gtk_signal_connect (GTK_OBJECT (st->button), "clicked",
browser_load_unload_callback, st);
GTK_SIGNAL_FUNC (browser_load_unload_callback), st);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
gtk_object_set_user_data (GTK_OBJECT (st->list), st);
g_object_set_data (G_OBJECT (st->list), "state", st);
gtk_signal_connect (GTK_OBJECT (st->list), "select_child",
browser_select_callback, NULL);
g_signal_connect (G_OBJECT (st->list), "select_child",
G_CALLBACK (browser_select_callback), NULL);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
modules_handler_id =
gimp_container_add_handler (modules, "modified", browser_info_update, st);
gimp_container_add_handler (modules, "modified",
G_CALLBACK (browser_info_update), st);
gtk_signal_connect (GTK_OBJECT (modules), "add",
browser_info_add, st);
gtk_signal_connect (GTK_OBJECT (modules), "remove",
browser_info_remove, st);
g_signal_connect (G_OBJECT (modules), "add",
G_CALLBACK (browser_info_add), st);
g_signal_connect (G_OBJECT (modules), "remove",
G_CALLBACK (browser_info_remove), st);
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
browser_destroy_callback, st);
GTK_SIGNAL_FUNC (browser_destroy_callback), st);
return shell;
}
......@@ -493,7 +494,7 @@ module_info_get_type (void)
static void
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
g_signal_emit (G_OBJECT (mod), module_info_signals[MODIFIED], 0);
}
static ModuleInfo *
......@@ -799,7 +800,9 @@ static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
g_signal_handlers_disconnect_matched (G_OBJECT (modules),
G_SIGNAL_MATCH_DATA,
0, 0, 0, NULL, data);
gimp_container_remove_handler (modules, modules_handler_id);
g_free (data);
}
......@@ -948,24 +951,24 @@ browser_info_init (BrowserState *st,
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_signal_connect (GTK_OBJECT (st->load_inhibit_check), "toggled",
browser_load_inhibit_callback, st);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
}
static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
ModuleInfo *i;
ModuleInfo *info;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
info = g_object_get_data (G_OBJECT (child), "module_info");
st = g_object_get_data (G_OBJECT (widget), "state");
if (st->last_update == i)
if (st->last_update == info)
return;
st->last_update = i;
st->last_update = info;
browser_info_update (st->last_update, st);
}
......@@ -1000,7 +1003,7 @@ make_list_item (gpointer data,
list_item = gtk_list_item_new_with_label (info->fullpath);
gtk_widget_show (list_item);
gtk_object_set_user_data (GTK_OBJECT (list_item), info);
g_object_set_data (G_OBJECT (list_item), "module_info", info);
gtk_container_add (GTK_CONTAINER (st->list), list_item);
}
......@@ -1023,7 +1026,7 @@ browser_info_remove (GimpContainer *container,
GList *dlist;
GList *free_list;
GtkWidget *list_item;
ModuleInfo *i;
ModuleInfo *info;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
......@@ -1032,13 +1035,13 @@ browser_info_remove (GimpContainer *container,
{
list_item = dlist->data;
i = gtk_object_get_user_data (GTK_OBJECT (list_item));
g_return_if_fail (i != NULL);
info = g_object_get_data (G_OBJECT (list_item), "module_info");
g_return_if_fail (info != NULL);
if (i == mod)
if (info == mod)
{
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
g_list_free(free_list);
g_list_free (free_list);
return;
}
......
......@@ -180,7 +180,7 @@ gimp_brush_factory_view_new (GimpViewType view_type,
min_items_y,
context_func))
{
gtk_object_unref (GTK_OBJECT (factory_view));
g_object_unref (G_OBJECT (factory_view));
return NULL;
}
......
......@@ -182,7 +182,7 @@ gimp_buffer_view_new (GimpViewType view_type,
min_items_y,
context_func))
{
gtk_object_unref (GTK_OBJECT (buffer_view));
g_object_unref (G_OBJECT (buffer_view));
return NULL;
}
......
......@@ -326,7 +326,7 @@ gimp_channel_list_view_to_selection (GimpChannelListView *view,
{
new_channel = channel;
gtk_object_ref (GTK_OBJECT (channel));
g_object_ref (G_OBJECT (channel));
}
else
{
......@@ -340,7 +340,7 @@ gimp_channel_list_view_to_selection (GimpChannelListView *view,
gimage_mask_load (gimage, new_channel);
gtk_object_unref (GTK_OBJECT (new_channel));
g_object_unref (G_OBJECT (new_channel));
gdisplays_flush ();
}
......
......@@ -326,7 +326,7 @@ gimp_channel_list_view_to_selection (GimpChannelListView *view,
{
new_channel = channel;
gtk_object_ref (GTK_OBJECT (channel));
g_object_ref (G_OBJECT (channel));
}
else
{
......@@ -340,7 +340,7 @@ gimp_channel_list_view_to_selection (GimpChannelListView *view,
gimage_mask_load (gimage, new_channel);
gtk_object_unref (GTK_OBJECT (new_channel));
g_object_unref (G_OBJECT (new_channel));
gdisplays_flush ();
}
......
......@@ -286,7 +286,7 @@ gimp_container_list_view_reorder_item (GimpContainerView *view,
selected = GTK_WIDGET_STATE (list_item) == GTK_STATE_SELECTED;
gtk_object_ref (GTK_OBJECT (list_item));
g_object_ref (G_OBJECT (list_item));
gtk_list_remove_items (GTK_LIST (list_view->gtk_list), list);
......@@ -298,7 +298,7 @@ gimp_container_list_view_reorder_item (GimpContainerView *view,
if (selected)
gimp_container_view_select_item (view, viewable);
gtk_object_unref (GTK_OBJECT (list_item));
g_object_unref (G_OBJECT (list_item));
}
}
......
......@@ -196,7 +196,7 @@ gimp_data_factory_view_new (GimpViewType view_type,
min_items_y,
context_func))
{
gtk_object_unref (GTK_OBJECT (factory_view));
g_object_unref (G_OBJECT (factory_view));
return NULL;
}
......
......@@ -380,12 +380,10 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
if (dialog)
{
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp-dialog-factory",
factory);
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp-dialog-factory-entry",
entry);
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory",
factory);
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory-entry",
entry);
/* If we created a dock before, the newly created dialog is
* supposed to be a GimpDockable.
......@@ -585,9 +583,7 @@ gimp_dialog_factory_dock_new (GimpDialogFactory *factory)
if (dock)
{
gtk_object_set_data (GTK_OBJECT (dock),
"gimp-dialog-factory",
factory);
g_object_set_data (G_OBJECT (dock), "gimp-dialog-factory", factory);
gimp_dialog_factory_add_dialog (factory, dock);
}
......@@ -615,8 +611,8 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
return;
}
dialog_factory = gtk_object_get_data (GTK_OBJECT (dialog),
"gimp-dialog-factory");
dialog_factory = g_object_get_data (G_OBJECT (dialog),
"gimp-dialog-factory");
if (! dialog_factory)
{
......@@ -632,10 +628,9 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
return;
}
entry = gtk_object_get_data (GTK_OBJECT (dialog),
"gimp-dialog-factory-entry");
entry = g_object_get_data (G_OBJECT (dialog), "gimp-dialog-factory-entry");
if (entry) /* dialog is a toplevel (but not a GimpDock) or a GimpDockable */
if (entry) /* dialog is a toplevel (but not a GimpDock) or a GimpDockable */
{
gboolean toplevel;
......
......@@ -364,9 +364,9 @@ gimp_dock_tab_drag_begin (GtkWidget *widget,
gtk_widget_show (window);
gtk_object_set_data_full (GTK_OBJECT (dockable), "gimp-dock-drag-widget",
window,
(GtkDestroyNotify) gtk_widget_destroy);
g_object_set_data_full (G_OBJECT (dockable), "gimp-dock-drag-widget",
window,
(GDestroyNotify) gtk_widget_destroy);
gtk_drag_set_icon_widget (context, window,
-8, -8);
......@@ -382,25 +382,25 @@ gimp_dock_tab_drag_end (GtkWidget *widget,
dockable = GIMP_DOCKABLE (data);
drag_widget = gtk_object_get_data (GTK_OBJECT (dockable),
drag_widget = g_object_get_data (G_OBJECT (dockable),
"gimp-dock-drag-widget");
if (drag_widget)
{
GtkWidget *dock;
gtk_object_set_data (GTK_OBJECT (dockable), "gimp-dock-drag-widget", NULL);
g_object_set_data (G_OBJECT (dockable), "gimp-dock-drag-widget", NULL);