mirror of https://github.com/GNOME/gimp.git
app: don't use g_list_length() to check if a list is empty
This commit is contained in:
parent
d310dacbb1
commit
11239c4b17
|
@ -82,7 +82,7 @@ gimp_single_window_strategy_create_dockable_dialog (GimpWindowStrategy *strategy
|
|||
GtkWidget *widget = NULL;
|
||||
GimpImageWindow *window;
|
||||
|
||||
g_return_val_if_fail (g_list_length (windows) > 0, NULL);
|
||||
g_return_val_if_fail (windows != NULL, NULL);
|
||||
|
||||
/* In single-window mode, there should only be one window... */
|
||||
window = GIMP_IMAGE_WINDOW (windows->data);
|
||||
|
|
|
@ -837,7 +837,7 @@ gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window)
|
|||
|
||||
docks = gimp_dock_container_get_docks (GIMP_DOCK_CONTAINER (dock_window));
|
||||
|
||||
if (g_list_length (docks) < 1)
|
||||
if (! docks)
|
||||
{
|
||||
should_add = FALSE;
|
||||
}
|
||||
|
|
|
@ -234,10 +234,9 @@ gimp_paned_box_set_widget_drag_handler (GtkWidget *widget,
|
|||
static gint
|
||||
gimp_paned_box_get_drop_area_size (GimpPanedBox *paned_box)
|
||||
{
|
||||
gboolean no_widgets = (g_list_length (paned_box->p->widgets) == 0);
|
||||
gint drop_area_size = 0;
|
||||
|
||||
if (no_widgets)
|
||||
if (! paned_box->p->widgets)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkOrientation orientation;
|
||||
|
@ -340,7 +339,6 @@ gimp_paned_box_drag_motion (GtkWidget *widget,
|
|||
GtkOrientation orientation = 0;
|
||||
gboolean handle = FALSE;
|
||||
gint drop_area_size = gimp_paned_box_get_drop_area_size (paned_box);
|
||||
gboolean no_widgets = (g_list_length (paned_box->p->widgets) == 0);
|
||||
|
||||
if (gimp_paned_box_will_handle_drag (paned_box->p->drag_handler,
|
||||
widget,
|
||||
|
@ -355,11 +353,6 @@ gimp_paned_box_drag_motion (GtkWidget *widget,
|
|||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
/* If there are no widgets, the drop area is as big as the paned
|
||||
* box
|
||||
*/
|
||||
no_widgets = (g_list_length (paned_box->p->widgets) == 0);
|
||||
|
||||
/* See if we're at the edge of the dock If there are no dockables,
|
||||
* the entire paned box is a drop area
|
||||
*/
|
||||
|
@ -369,7 +362,10 @@ gimp_paned_box_drag_motion (GtkWidget *widget,
|
|||
dnd_window_y = 0;
|
||||
dnd_window_h = allocation.height;
|
||||
|
||||
if (no_widgets)
|
||||
/* If there are no widgets, the drop area is as big as the paned
|
||||
* box
|
||||
*/
|
||||
if (! paned_box->p->widgets)
|
||||
dnd_window_w = allocation.width;
|
||||
else
|
||||
dnd_window_w = drop_area_size;
|
||||
|
@ -390,7 +386,10 @@ gimp_paned_box_drag_motion (GtkWidget *widget,
|
|||
dnd_window_x = 0;
|
||||
dnd_window_w = allocation.width;
|
||||
|
||||
if (no_widgets)
|
||||
/* If there are no widgets, the drop area is as big as the paned
|
||||
* box
|
||||
*/
|
||||
if (! paned_box->p->widgets)
|
||||
dnd_window_h = allocation.height;
|
||||
else
|
||||
dnd_window_h = drop_area_size;
|
||||
|
|
|
@ -583,7 +583,7 @@ gimp_toolbox_book_removed (GimpDock *dock,
|
|||
if (GIMP_DOCK_CLASS (parent_class)->book_removed)
|
||||
GIMP_DOCK_CLASS (parent_class)->book_removed (dock, dockbook);
|
||||
|
||||
if (g_list_length (gimp_dock_get_dockbooks (dock)) == 0 &&
|
||||
if (! gimp_dock_get_dockbooks (dock) &&
|
||||
! toolbox->p->in_destruction)
|
||||
{
|
||||
gimp_dock_invalidate_geometry (dock);
|
||||
|
|
Loading…
Reference in New Issue