Trim trailing white spaces.
[geeqie.git] / src / layout.c
index 6abbb5a..08a8f69 100644 (file)
@@ -332,11 +332,7 @@ static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data)
 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
 {
        /* destroy the menu */
-#if GTK_CHECK_VERSION(2,12,0)
        g_object_unref(widget);
-#else
-       gtk_widget_unref(GTK_WIDGET(widget));
-#endif
 }
 
 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
@@ -687,9 +683,6 @@ static void layout_list_sync_marks(LayoutWindow *lw)
 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
 {
        if (!lw) return;
-#if 0
-       if (lw->vf) vf_scroll_to_subpart(lw->vf, needle);
-#endif
 }
 
 GList *layout_list(LayoutWindow *lw)
@@ -1038,20 +1031,35 @@ gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *
 
 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v)
 {
+       GtkAllocation h_allocation;
+       GtkAllocation v_allocation;
+       
        if (!layout_valid(&lw)) return FALSE;
+       
+       if (lw->h_pane)
+               {
+               GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->h_pane));
+               gtk_widget_get_allocation(child, &h_allocation);
+               }
+
+       if (lw->v_pane)
+               {
+               GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->v_pane));
+               gtk_widget_get_allocation(child, &v_allocation);
+               }
 
-       if (lw->h_pane && gtk_paned_get_child1(GTK_PANED(lw->h_pane))->allocation.x >= 0)
+       if (lw->h_pane && h_allocation.x >= 0)
                {
-               *h = gtk_paned_get_child1(GTK_PANED(lw->h_pane))->allocation.width;
+               *h = h_allocation.width;
                }
        else if (h != &lw->options.main_window.hdivider_pos)
                {
                *h = lw->options.main_window.hdivider_pos;
                }
 
-       if (lw->v_pane && gtk_paned_get_child1(GTK_PANED(lw->v_pane))->allocation.x >= 0)
+       if (lw->v_pane && v_allocation.x >= 0)
                {
-               *v = gtk_paned_get_child1(GTK_PANED(lw->v_pane))->allocation.height;
+               *v = v_allocation.height;
                }
        else if (v != &lw->options.main_window.vdivider_pos)
                {
@@ -1146,13 +1154,10 @@ static void layout_location_compute(LayoutLocation l1, LayoutLocation l2,
 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
 {
        GdkWindow *window;
+       GtkAllocation allocation;
        if (!layout_valid(&lw)) return FALSE;
 
-#if GTK_CHECK_VERSION(2,20,0)
        if (!lw->tools || !gtk_widget_get_visible(lw->tools))
-#else
-       if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
-#endif
                {
                /* use the stored values (sort of breaks success return value) */
 
@@ -1165,14 +1170,15 @@ gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w,
        gdk_window_get_root_origin(window, x, y);
        *w = gdk_window_get_width(window);
        *h = gdk_window_get_height(window);
+       gtk_widget_get_allocation(gtk_paned_get_child1(GTK_PANED(lw->tools_pane)), &allocation);
 
        if (GTK_IS_VPANED(lw->tools_pane))
                {
-               *divider_pos = gtk_paned_get_child1(GTK_PANED(lw->tools_pane))->allocation.height;
+               *divider_pos = allocation.height;
                }
        else
                {
-               *divider_pos = gtk_paned_get_child1(GTK_PANED(lw->tools_pane))->allocation.width;
+               *divider_pos = allocation.width;
                }
 
        return TRUE;
@@ -1190,11 +1196,7 @@ static void layout_tools_hide(LayoutWindow *lw, gboolean hide)
 
        if (hide)
                {
-#if GTK_CHECK_VERSION(2,20,0)
                if (gtk_widget_get_visible(lw->tools))
-#else
-               if (GTK_WIDGET_VISIBLE(lw->tools))
-#endif
                        {
                        layout_tools_geometry_sync(lw);
                        gtk_widget_hide(lw->tools);
@@ -1202,11 +1204,7 @@ static void layout_tools_hide(LayoutWindow *lw, gboolean hide)
                }
        else
                {
-#if GTK_CHECK_VERSION(2,20,0)
                if (!gtk_widget_get_visible(lw->tools))
-#else
-               if (!GTK_WIDGET_VISIBLE(lw->tools))
-#endif
                        {
                        gtk_widget_show(lw->tools);
                        if (lw->vf) vf_refresh(lw->vf);
@@ -1234,10 +1232,6 @@ static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *fi
 
        vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) ||
                   (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw)));
-#if 0
-       layout_location_compute(lw->dir_location, lw->file_location,
-                               tools, files, &w1, &w2);
-#endif
        /* for now, tools/dir are always first in order */
        w1 = tools;
        w2 = files;
@@ -1556,7 +1550,7 @@ void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)
 
        /* remember state */
 
-       /* layout_image_slideshow_stop(lw); slideshow should survive */ 
+       /* layout_image_slideshow_stop(lw); slideshow should survive */
        layout_image_full_screen_stop(lw);
 
        dir_fd = lw->dir_fd;
@@ -1732,19 +1726,11 @@ void layout_toolbar_toggle(LayoutWindow *lw)
 
        if (lw->options.toolbar_hidden)
                {
-#if GTK_CHECK_VERSION(2,20,0)
                if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
-#else
-               if (GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
-#endif
                }
        else
                {
-#if GTK_CHECK_VERSION(2,20,0)
                if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
-#else
-               if (!GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
-#endif
                }
 }
 
@@ -1911,7 +1897,7 @@ void layout_show_config_window(LayoutWindow *lw)
        gtk_container_add(GTK_CONTAINER(hbox), button);
        GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
        gtk_widget_show(button);
-*/     
+*/
        button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
                                 G_CALLBACK(layout_config_apply_cb), lc);
        gtk_container_add(GTK_CONTAINER(hbox), button);
@@ -2379,7 +2365,7 @@ static void layout_config_startup_path(LayoutOptions *lop, gchar **path)
                        *path = get_current_dir();
                        break;
                }
-}      
+}
 
 
 static void layout_config_commandline(LayoutOptions *lop, gchar **path)
@@ -2423,7 +2409,7 @@ LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar
                {
                layout_config_commandline(&lop, &path);
                }
-       else 
+       else
                {
                layout_config_startup_path(&lop, &path);
                }