app/widgets/gimphelp.c app/widgets/gimpuimanager.c

2007-05-22  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimphelp.c
	* app/widgets/gimpuimanager.c
	* app/widgets/gimpview-popup.c
	* app/widgets/gtkwrapbox.c: use GSlice to allocate structs.

svn path=/trunk/; revision=22572
This commit is contained in:
Sven Neumann 2007-05-22 15:14:41 +00:00 committed by Sven Neumann
parent 7654733de9
commit af350d89e6
5 changed files with 34 additions and 18 deletions

View File

@ -1,3 +1,10 @@
2007-05-22 Sven Neumann <sven@gimp.org>
* app/widgets/gimphelp.c
* app/widgets/gimpuimanager.c
* app/widgets/gimpview-popup.c
* app/widgets/gtkwrapbox.c: use GSlice to allocate structs.
2007-05-22 Michael Natterer <mitch@gimp.org>
* app/base/tile.[ch]: changed tile_init() to tile_new() and return

View File

@ -66,7 +66,7 @@ struct _GimpIdleHelp
/* local function prototypes */
static gint gimp_idle_help (gpointer data);
static gint gimp_idle_help (GimpIdleHelp *idle_help);
static gboolean gimp_help_browser (Gimp *gimp);
static void gimp_help_browser_error (Gimp *gimp,
@ -97,7 +97,7 @@ gimp_help_show (Gimp *gimp,
if (config->use_help)
{
GimpIdleHelp *idle_help = g_new0 (GimpIdleHelp, 1);
GimpIdleHelp *idle_help = g_slice_new0 (GimpIdleHelp);
idle_help->gimp = gimp;
@ -109,7 +109,7 @@ gimp_help_show (Gimp *gimp,
if (help_id && strlen (help_id))
idle_help->help_id = g_strdup (help_id);
g_idle_add (gimp_idle_help, idle_help);
g_idle_add ((GSourceFunc) gimp_idle_help, idle_help);
if (gimp->be_verbose)
g_print ("HELP: request for help-id '%s' from help-domain '%s'\n",
@ -122,9 +122,8 @@ gimp_help_show (Gimp *gimp,
/* private functions */
static gboolean
gimp_idle_help (gpointer data)
gimp_idle_help (GimpIdleHelp *idle_help)
{
GimpIdleHelp *idle_help = data;
GimpGuiConfig *config = GIMP_GUI_CONFIG (idle_help->gimp->config);
const gchar *procedure_name = NULL;
@ -157,7 +156,8 @@ gimp_idle_help (gpointer data)
g_free (idle_help->help_domain);
g_free (idle_help->help_locales);
g_free (idle_help->help_id);
g_free (idle_help);
g_slice_free (GimpIdleHelp, idle_help);
return FALSE;
}

View File

@ -267,7 +267,7 @@ gimp_ui_manager_finalize (GObject *object)
if (entry->widget)
g_object_unref (entry->widget);
g_free (entry);
g_slice_free (GimpUIManagerUIEntry, entry);
}
g_list_free (manager->registered_uis);
@ -539,7 +539,7 @@ gimp_ui_manager_ui_register (GimpUIManager *manager,
g_return_if_fail (basename != NULL);
g_return_if_fail (gimp_ui_manager_entry_get (manager, ui_path) == NULL);
entry = g_new0 (GimpUIManagerUIEntry, 1);
entry = g_slice_new0 (GimpUIManagerUIEntry);
entry->ui_path = g_strdup (ui_path);
entry->basename = g_strdup (basename);
@ -550,12 +550,19 @@ gimp_ui_manager_ui_register (GimpUIManager *manager,
manager->registered_uis = g_list_prepend (manager->registered_uis, entry);
}
typedef struct
{
guint x;
guint y;
} MenuPos;
static void
menu_pos_free (MenuPos *pos)
{
g_slice_free (MenuPos, pos);
}
void
gimp_ui_manager_ui_popup (GimpUIManager *manager,
const gchar *ui_path,
@ -613,8 +620,9 @@ gimp_ui_manager_ui_popup (GimpUIManager *manager,
if (! menu_pos)
{
menu_pos = g_new0 (MenuPos, 1);
g_object_set_data_full (G_OBJECT (widget), "menu-pos", menu_pos, g_free);
menu_pos = g_slice_new0 (MenuPos);
g_object_set_data_full (G_OBJECT (widget), "menu-pos", menu_pos,
(GDestroyNotify) menu_pos_free);
}
menu_pos->x = x;

View File

@ -100,7 +100,7 @@ gimp_view_popup_show (GtkWidget *widget,
&popup_height))
return FALSE;
popup = g_new0 (GimpViewPopup, 1);
popup = g_slice_new0 (GimpViewPopup);
popup->widget = widget;
popup->context = context;
@ -164,7 +164,7 @@ gimp_view_popup_hide (GimpViewPopup *popup)
gtk_grab_remove (popup->widget);
g_free (popup);
g_slice_free (GimpViewPopup, popup);
}
static gboolean

View File

@ -591,7 +591,8 @@ gtk_wrap_box_pack_wrapped (GtkWrapBox *wbox,
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (child->parent == NULL);
child_info = g_new (GtkWrapBoxChild, 1);
child_info = g_slice_new (GtkWrapBoxChild);
child_info->widget = child;
child_info->hexpand = hexpand ? TRUE : FALSE;
child_info->hfill = hfill ? TRUE : FALSE;
@ -852,20 +853,20 @@ gtk_wrap_box_remove (GtkContainer *container,
if (child->widget == widget)
{
gboolean was_visible;
was_visible = GTK_WIDGET_VISIBLE (widget);
gtk_widget_unparent (widget);
if (last)
last->next = child->next;
else
wbox->children = child->next;
g_free (child);
g_slice_free (GtkWrapBoxChild, child);
wbox->n_children--;
if (was_visible)
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
}