[Goodies-commits] r3711 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Sun Dec 16 14:16:39 CET 2007


Author: stephan
Date: 2007-12-16 13:16:39 +0000 (Sun, 16 Dec 2007)
New Revision: 3711

Modified:
   ristretto/trunk/src/main_window.c
   ristretto/trunk/src/thumbnail.c
   ristretto/trunk/src/thumbnail_bar.c
Log:
- Some improvements to the thumbnail-bar
- remove an obsolete line of code from the main_window



Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2007-12-16 10:40:32 UTC (rev 3710)
+++ ristretto/trunk/src/main_window.c	2007-12-16 13:16:39 UTC (rev 3711)
@@ -863,7 +863,7 @@
     gtk_container_remove(GTK_CONTAINER(window->priv->containers.paned), window->priv->containers.s_window);
     gtk_widget_destroy(window->priv->containers.paned);
 
-    //rstto_thumbnail_viewer_set_orientation(RSTTO_THUMBNAIL_VIEWER(window->priv->thumbnail_viewer), orientation);
+    rstto_thumbnail_bar_set_orientation(RSTTO_THUMBNAIL_BAR(window->priv->thumbnail_viewer), orientation);
 
     switch (orientation)
     {
@@ -887,11 +887,10 @@
 void
 rstto_main_window_set_show_thumbnail_viewer(RsttoMainWindow *window, gboolean visibility)
 {
-    /*
     window->priv->settings.thumbnail_viewer_visibility = visibility;
     if (visibility == TRUE)
     {
-        switch(rstto_thumbnail_viewer_get_orientation(RSTTO_THUMBNAIL_VIEWER(window->priv->thumbnail_viewer)))
+        switch(rstto_thumbnail_bar_get_orientation(RSTTO_THUMBNAIL_BAR(window->priv->thumbnail_viewer)))
         {
             case GTK_ORIENTATION_HORIZONTAL:
                 gtk_check_menu_item_set_active(
@@ -912,7 +911,6 @@
             GTK_CHECK_MENU_ITEM(window->priv->menus.view.show_thumbnail_viewer.menu_item_thumbnail_viewer_hide),
             TRUE);
     }
-    */
 }
 
 void
@@ -1852,7 +1850,6 @@
 const GdkColor *
 rstto_main_window_get_pv_bg_color (RsttoMainWindow *window)
 {
-    /*return rstto_picture_viewer_get_bg_color(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer));*/
     return window->priv->settings.bg_color;
 }
 

Modified: ristretto/trunk/src/thumbnail.c
===================================================================
--- ristretto/trunk/src/thumbnail.c	2007-12-16 10:40:32 UTC (rev 3710)
+++ ristretto/trunk/src/thumbnail.c	2007-12-16 13:16:39 UTC (rev 3711)
@@ -124,7 +124,6 @@
 
     if (GTK_WIDGET_REALIZED(widget))
     {
-         g_debug("CA: %d:%d", allocation->x, allocation->y);
          gdk_window_move_resize (widget->window,
             allocation->x + border_width,
             allocation->y + border_width,
@@ -213,7 +212,7 @@
             gc,
             pixmap,
             0, 0,
-            0, 0,
+            widget->allocation.x, widget->allocation.y,
             widget->allocation.width,
             widget->allocation.height);
 

Modified: ristretto/trunk/src/thumbnail_bar.c
===================================================================
--- ristretto/trunk/src/thumbnail_bar.c	2007-12-16 10:40:32 UTC (rev 3710)
+++ ristretto/trunk/src/thumbnail_bar.c	2007-12-16 13:16:39 UTC (rev 3711)
@@ -112,6 +112,7 @@
 	GTK_WIDGET_SET_FLAGS(bar, GTK_NO_WINDOW);
 	gtk_widget_set_redraw_on_allocate(GTK_WIDGET(bar), FALSE);
     bar->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+    bar->priv->offset = 100;
 
 }
 
@@ -158,42 +159,39 @@
     GtkAllocation child_allocation;
     GtkRequisition child_requisition;
 
-    child_allocation.x = allocation->x + border_width;
+    child_allocation.x = allocation->x + border_width - bar->priv->offset;
     child_allocation.y = allocation->y + border_width;
     child_allocation.width = 70 - border_width;
     child_allocation.height = 70 - border_width;
 
     GSList *iter = bar->priv->thumbs;
 
-    /*
-    if (GTK_WIDGET_REALIZED (widget))
-    {
-        gdk_window_move_resize (widget->window,
-                              allocation->x + border_width,
-                              allocation->y + border_width,
-                              allocation->width - border_width * 2,
-                              allocation->height - border_width * 2);
-    }
-    */
-  
-
     switch(bar->priv->orientation)
     {
         case GTK_ORIENTATION_HORIZONTAL:
-            if(iter)
+            while(iter)
             {
-                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
-                gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
-                if (child_allocation.x < (allocation->x + allocation->width))
+                if ((child_allocation.x < (allocation->x + allocation->width)) &&
+                    ((child_allocation.x + child_allocation.width) > allocation->x + border_width))
                     gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
                 else
                     gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
-
-                child_allocation.x += child_requisition.width;
+                gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
+                child_allocation.x += 70;
                 iter = g_slist_next(iter);
             }
             break;
         case GTK_ORIENTATION_VERTICAL:
+            while(iter)
+            {
+                if (child_allocation.y < (allocation->y + allocation->height))
+                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
+                else
+                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
+                gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
+                child_allocation.y += 70;
+                iter = g_slist_next(iter);
+            }
             break;
     }
 }
@@ -285,7 +283,7 @@
 static GType
 rstto_thumbnail_bar_child_type(GtkContainer *container)
 {
-    return RSTTO_TYPE_THUMBNAIL;
+    return GTK_TYPE_WIDGET;
 }
 
 /*
@@ -300,6 +298,7 @@
 static void
 cb_rstto_thumbnail_bar_nav_new_entry(RsttoNavigator *nav, gint nr, RsttoNavigatorEntry *entry, RsttoThumbnailBar *bar)
 {
+    //   GtkWidget *thumb = gtk_label_new("Aaaaaaaaaaa");
     GtkWidget *thumb = rstto_thumbnail_new(entry);
     gtk_container_add(GTK_CONTAINER(bar), thumb);
 }




More information about the Goodies-commits mailing list