[Xfce4-commits] <ristretto:stephan/icon-bar> Make thumbnail-size configurable

Stephan Arts noreply at xfce.org
Mon Jan 30 19:32:01 CET 2012


Updating branch refs/heads/stephan/icon-bar
         to 52ecc3a7269c4af30a2b4a4e5aadec15338e8a7b (commit)
       from 553b263b19c9816071a6c579ae8f9a5c792c813c (commit)

commit 52ecc3a7269c4af30a2b4a4e5aadec15338e8a7b
Author: Stephan Arts <stephan at xfce.org>
Date:   Mon Jan 30 19:29:19 2012 +0100

    Make thumbnail-size configurable

 src/image_list.c       |  138 +++++++++++++++++++++++++++++++++++++-
 src/image_viewer.c     |   36 +++++-----
 src/main_window.c      |  176 +++++++++++++++++++++++++++++++++++++++---------
 src/main_window_ui.xml |    9 +++
 src/settings.c         |   31 +++++++++
 src/util.h             |   11 +++
 6 files changed, 351 insertions(+), 50 deletions(-)

diff --git a/src/image_list.c b/src/image_list.c
index a2af888..9e3a554 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -65,6 +65,11 @@ cb_rstto_wrap_images_changed (
         GObject *settings,
         GParamSpec *pspec,
         gpointer user_data);
+static void
+cb_rstto_thumbnail_size_changed (
+        GObject *settings,
+        GParamSpec *pspec,
+        gpointer user_data);
 
 static void
 rstto_image_list_monitor_dir (
@@ -205,6 +210,8 @@ struct _RsttoImageListPriv
     GList        *images;
     gint          n_images;
 
+    RsttoThumbnailSize thumbnail_size;
+
     GSList       *iterators;
     GCompareFunc  cb_rstto_image_list_compare_func;
 
@@ -303,6 +310,9 @@ rstto_image_list_init(RsttoImageList *image_list)
     image_list->priv->wrap_images = rstto_settings_get_boolean_property (
             image_list->priv->settings,
             "wrap-images");
+    image_list->priv->thumbnail_size = rstto_settings_get_uint_property (
+            image_list->priv->settings,
+            "thumbnail-size");
 
     g_signal_connect (
             G_OBJECT(image_list->priv->settings),
@@ -310,6 +320,12 @@ rstto_image_list_init(RsttoImageList *image_list)
             G_CALLBACK (cb_rstto_wrap_images_changed),
             image_list);
 
+    g_signal_connect (
+            G_OBJECT(image_list->priv->settings),
+            "notify::thumbnail-size",
+            G_CALLBACK (cb_rstto_thumbnail_size_changed),
+            image_list);
+
 }
 
 static void
@@ -1198,6 +1214,45 @@ cb_rstto_wrap_images_changed (
     image_list->priv->wrap_images = g_value_get_boolean (&val_wrap_images);
 }
 
+static void
+cb_rstto_thumbnail_size_changed (
+        GObject *settings,
+        GParamSpec *pspec,
+        gpointer user_data)
+{
+    GValue val_thumbnail_size = { 0, };
+    RsttoImageList *image_list = RSTTO_IMAGE_LIST (user_data);
+    GList *image_iter = image_list->priv->images;
+    gint i = 0;
+    GtkTreePath *path_ = NULL;
+    GtkTreeIter iter;
+
+    g_value_init (&val_thumbnail_size, G_TYPE_UINT);
+
+    g_object_get_property (
+            settings,
+            "thumbnail-size",
+            &val_thumbnail_size);
+
+    image_list->priv->thumbnail_size = g_value_get_uint (&val_thumbnail_size);
+
+
+    while (image_iter)
+    {
+        path_ = gtk_tree_path_new();
+        gtk_tree_path_append_index(path_, i);
+
+        iter.stamp = image_list->priv->stamp;
+        iter.user_data = image_iter->data;
+        iter.user_data3 = GINT_TO_POINTER (i);
+
+        gtk_tree_model_row_changed(GTK_TREE_MODEL(image_list), path_, &iter);
+
+        i++;
+        image_iter = g_list_next (image_iter);     
+    }
+}
+
 /***************************************/
 /*      TreeModelIface Functions       */
 /***************************************/
@@ -1403,6 +1458,7 @@ image_list_model_get_value (
         gint column,
         GValue *value )
 {
+    RsttoImageList *image_list = RSTTO_IMAGE_LIST (tree_model);
     RsttoFile *file = RSTTO_FILE(iter->user_data);
     const gchar *uri = NULL;
     gchar *checksum = NULL;
@@ -1422,7 +1478,87 @@ image_list_model_get_value (
             thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", filename, NULL);
 
             g_value_init (value, GDK_TYPE_PIXBUF);
-            g_value_take_object (value, gdk_pixbuf_new_from_file_at_scale (thumbnail_path, 64, 64, TRUE, NULL));
+            /*
+             * TINY: 32x32
+             * SMALL: 48x48
+             * NORMAL: 64x64
+             * LARGE: 96x96
+             * HUGE: 128x128
+             * INSANE: 256x256
+             */
+            switch (image_list->priv->thumbnail_size)
+            {
+                case THUMBNAIL_SIZE_VERY_SMALL:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    24,
+                                    24,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_SMALLER:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    32,
+                                    32,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_SMALL:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    48,
+                                    48,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_NORMAL:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    64,
+                                    64,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_LARGE:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    96,
+                                    96,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_LARGER:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    128,
+                                    128,
+                                    TRUE,
+                                    NULL));
+                    break;
+                case THUMBNAIL_SIZE_VERY_LARGE:
+                    g_value_take_object (
+                            value,
+                            gdk_pixbuf_new_from_file_at_scale (
+                                    thumbnail_path,
+                                    256,
+                                    256,
+                                    TRUE,
+                                    NULL));
+                    break;
+            }
 
             g_free (checksum);
             g_free (filename);
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 1be5c3a..18ee41a 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -1002,8 +1002,8 @@ paint_image (
         }
 
         cairo_save (ctx);
-        x_offset = viewer->priv->rendering.x_offset;
-        y_offset = viewer->priv->rendering.y_offset;
+        x_offset = floor(viewer->priv->rendering.x_offset);
+        y_offset = floor(viewer->priv->rendering.y_offset);
 
 /* BEGIN PAINT CHECKERED BACKGROUND */
         if (TRUE == gdk_pixbuf_get_has_alpha (viewer->priv->pixbuf))
@@ -1063,16 +1063,16 @@ paint_image (
                         M_PI*0.5);
                 cairo_translate (
                         ctx,
-                        0.0 - gtk_adjustment_get_value (viewer->vadjustment),
-                        gtk_adjustment_get_value (viewer->hadjustment));
+                        floor(0.0 - gtk_adjustment_get_value (viewer->vadjustment)),
+                        floor(gtk_adjustment_get_value (viewer->hadjustment)));
                 cairo_translate (
                         ctx,
                         0.0,
                         -1.0 * viewer->priv->image_height * viewer->priv->scale);
                 cairo_translate (
                         ctx,
-                        viewer->priv->rendering.y_offset,
-                        -1.0 * viewer->priv->rendering.x_offset);
+                        y_offset,
+                        -1.0 * x_offset);
                 break;
             case RSTTO_IMAGE_ORIENT_270:
                 cairo_rotate (
@@ -1080,8 +1080,8 @@ paint_image (
                         M_PI*1.5);
                 cairo_translate (
                         ctx,
-                        gtk_adjustment_get_value (viewer->vadjustment),
-                        0.0 - gtk_adjustment_get_value (viewer->hadjustment));
+                        floor(gtk_adjustment_get_value (viewer->vadjustment)),
+                        0.0 - floor(gtk_adjustment_get_value (viewer->hadjustment)));
                 cairo_translate (
                         ctx,
                         -1.0 * viewer->priv->image_width * viewer->priv->scale,
@@ -1089,8 +1089,8 @@ paint_image (
 
                 cairo_translate (
                         ctx,
-                        -1.0 * viewer->priv->rendering.y_offset,
-                        viewer->priv->rendering.x_offset);
+                        -1.0 * y_offset,
+                        x_offset);
                 break;
             case RSTTO_IMAGE_ORIENT_180:
                 cairo_rotate (
@@ -1098,8 +1098,8 @@ paint_image (
                         M_PI);
                 cairo_translate (
                         ctx,
-                        gtk_adjustment_get_value (viewer->hadjustment),
-                        gtk_adjustment_get_value (viewer->vadjustment));
+                        floor(gtk_adjustment_get_value (viewer->hadjustment)),
+                        floor(gtk_adjustment_get_value (viewer->vadjustment)));
                 cairo_translate (
                         ctx,
                         -1.0 * viewer->priv->image_width * viewer->priv->scale,
@@ -1107,20 +1107,20 @@ paint_image (
 
                 cairo_translate (
                         ctx,
-                        -1.0 * viewer->priv->rendering.x_offset,
-                        -1.0 * viewer->priv->rendering.y_offset);
+                        -1.0 * x_offset,
+                        -1.0 * y_offset);
                 break;
             case RSTTO_IMAGE_ORIENT_NONE:
             default:
                 cairo_translate (
                         ctx,
-                        0.0 - gtk_adjustment_get_value (viewer->hadjustment),
-                        0.0 - gtk_adjustment_get_value (viewer->vadjustment));
+                        0.0 - floor(gtk_adjustment_get_value (viewer->hadjustment)),
+                        0.0 - floor(gtk_adjustment_get_value (viewer->vadjustment)));
 
                 cairo_translate (
                         ctx,
-                        viewer->priv->rendering.x_offset,
-                        viewer->priv->rendering.y_offset);
+                        x_offset,
+                        y_offset);
                 break;
 
         }
diff --git a/src/main_window.c b/src/main_window.c
index a2b1edb..1855184 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -90,10 +90,6 @@ struct _RsttoMainWindowPriv
     GtkWidget *image_viewer;
     GtkWidget *p_viewer_s_window;
     GtkWidget *table;
-    GtkWidget *hpaned_left;
-    GtkWidget *hpaned_right;
-    GtkWidget *vpaned_top;
-    GtkWidget *vpaned_bottom;
     GtkWidget *t_bar_s_window;
     GtkWidget *thumbnailbar;
     GtkWidget *statusbar;
@@ -208,6 +204,13 @@ static void
 cb_rstto_main_window_sorting_function_changed (GtkRadioAction *action, GtkRadioAction *current,  RsttoMainWindow *window);
 static void
 cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *, GtkRadioAction *,  RsttoMainWindow *window);
+
+static void
+cb_rstto_main_window_thumbnail_size_changed (
+        GtkRadioAction *action,
+        GtkRadioAction *current,
+        RsttoMainWindow *window);
+
 static gboolean
 cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
 static void
@@ -294,6 +297,11 @@ rstto_main_window_set_navigationbar_position (
         RsttoMainWindow *window,
         guint orientation);
 
+static void
+rstto_main_window_set_thumbnail_size (
+        RsttoMainWindow *window,
+        RsttoThumbnailSize size);
+
 
 static void
 cb_rstto_merge_toolbars_changed (
@@ -367,6 +375,7 @@ static GtkActionEntry action_entries[] =
 /* Position Menu */
   { "position-menu", NULL, N_ ("_Position"), NULL, },
   { "thumbnailbar-position-menu", NULL, N_ ("Thumbnail Bar _Position"), NULL, },
+  { "thumbnailbar-size-menu", NULL, N_ ("Thumbnail _Size"), NULL, },
 /* Misc */
   { "leave-fullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("Leave _Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
   { "tb-menu", NULL, NULL, NULL, }
@@ -401,6 +410,18 @@ static const GtkRadioActionEntry radio_action_pos_entries[] =
     { "pos-bottom", NULL, N_("Bottom"), NULL, NULL, 3},
 };
 
+/** Thumbnail-size options*/
+static const GtkRadioActionEntry radio_action_size_entries[] = 
+{
+    { "size-very-small", NULL, N_("Very Small"), NULL, NULL, 0},
+    { "size-smaller", NULL, N_("Smaller"), NULL, NULL, 1},
+    { "size-small", NULL, N_("Small"), NULL, NULL, 2},
+    { "size-normal", NULL, N_("Normal"), NULL, NULL, 3},
+    { "size-large", NULL, N_("Large"), NULL, NULL, 4},
+    { "size-larger", NULL, N_("Larger"), NULL, NULL, 5},
+    { "size-very-large", NULL, N_("Very Large"), NULL, NULL, 6},
+};
+
 
 GType
 rstto_main_window_get_type (void)
@@ -449,6 +470,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     GClosure        *quit_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_quit, window, NULL);
 
     guint navigationbar_position = 3;
+    guint thumbnail_size = 3;
 
     gtk_window_set_title (GTK_WINDOW (window), RISTRETTO_APP_TITLE);
 
@@ -508,6 +530,7 @@ rstto_main_window_init (RsttoMainWindow *window)
 
 
     navigationbar_position = rstto_settings_get_navbar_position (window->priv->settings_manager);
+    thumbnail_size = rstto_settings_get_uint_property (window->priv->settings_manager, "thumbnail-size");
 
     accel_group = gtk_ui_manager_get_accel_group (window->priv->ui_manager);
     gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
@@ -579,6 +602,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     gtk_action_group_add_toggle_actions (window->priv->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), GTK_WIDGET (window));
     gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_sort_entries , G_N_ELEMENTS (radio_action_sort_entries), 0, G_CALLBACK (cb_rstto_main_window_sorting_function_changed), GTK_WIDGET (window));
     gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_pos_entries, G_N_ELEMENTS (radio_action_pos_entries), navigationbar_position, G_CALLBACK (cb_rstto_main_window_navigationtoolbar_position_changed), GTK_WIDGET (window));
+    gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_size_entries, G_N_ELEMENTS (radio_action_size_entries), thumbnail_size, G_CALLBACK (cb_rstto_main_window_thumbnail_size_changed), GTK_WIDGET (window));
 
 
     gtk_ui_manager_add_ui_from_string (window->priv->ui_manager,main_window_ui, main_window_ui_length, NULL);
@@ -634,19 +658,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     exo_icon_bar_set_pixbuf_column (EXO_ICON_BAR (window->priv->thumbnailbar), 1);
     exo_icon_bar_set_item_width (EXO_ICON_BAR (window->priv->thumbnailbar), 96);
 
-    window->priv->hpaned_left = gtk_hpaned_new();
-    window->priv->hpaned_right = gtk_hpaned_new();
-    window->priv->vpaned_top = gtk_vpaned_new();
-    window->priv->vpaned_bottom = gtk_vpaned_new();
-    window->priv->table = gtk_table_new (3, 3, FALSE);
-
-    gtk_paned_pack2 (GTK_PANED (window->priv->hpaned_left), window->priv->hpaned_right, TRUE, FALSE);
-    gtk_paned_pack1 (GTK_PANED (window->priv->hpaned_right), window->priv->vpaned_top, TRUE, FALSE);
-    gtk_paned_pack2 (GTK_PANED (window->priv->vpaned_top), window->priv->vpaned_bottom, TRUE, FALSE);
-
-    gtk_paned_pack1 (GTK_PANED (window->priv->vpaned_bottom), window->priv->p_viewer_s_window, TRUE, FALSE);
-    gtk_paned_pack2 (GTK_PANED (window->priv->hpaned_right), window->priv->t_bar_s_window, FALSE, FALSE);
-
+    window->priv->table = gtk_table_new (5, 5, FALSE);
 
     window->priv->statusbar = gtk_statusbar_new();
     window->priv->statusbar_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(window->priv->statusbar), "image-data");
@@ -661,8 +673,9 @@ rstto_main_window_init (RsttoMainWindow *window)
     gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->table, TRUE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->statusbar, FALSE, FALSE, 0);
 
-    gtk_table_attach_defaults (GTK_TABLE (window->priv->table), window->priv->hpaned_left, 1, 2, 1, 2);
-    gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 1, 0, 3, GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
+    gtk_table_attach_defaults (GTK_TABLE (window->priv->table), window->priv->t_bar_s_window, 1, 2, 0, 5);
+    gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 1, 0, 5, GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
+    gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->p_viewer_s_window, 2, 3, 2, 3, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
 
     gtk_widget_set_no_show_all (window->priv->toolbar, TRUE);
     gtk_widget_set_no_show_all (window->priv->image_list_toolbar, TRUE);
@@ -865,12 +878,8 @@ static void
 rstto_main_window_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 {
     RsttoMainWindow *window = RSTTO_MAIN_WINDOW(widget);
-    GtkRequisition   panel_requisition;
 
     GTK_WIDGET_CLASS (parent_class)->size_allocate(widget, allocation); 
-
-    gtk_widget_size_request (window->priv->vpaned_top, &panel_requisition);
-
 }
 
 static void
@@ -1784,6 +1793,18 @@ rstto_window_save_geometry_timer (gpointer user_data)
     return FALSE;
 }
 
+
+static void
+rstto_main_window_set_thumbnail_size (
+        RsttoMainWindow *window,
+        RsttoThumbnailSize size)
+{
+    rstto_settings_set_uint_property (
+            window->priv->settings_manager,
+            "thumbnail-size",
+            size);
+}
+
 static void
 rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation)
 {
@@ -1800,12 +1821,33 @@ rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint ori
 
 
             gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->t_bar_s_window)), window->priv->t_bar_s_window);
-            gtk_paned_pack1 (GTK_PANED (window->priv->hpaned_left), window->priv->t_bar_s_window, FALSE, FALSE);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->t_bar_s_window,
+                    1,
+                    2,
+                    0,
+                    5,
+                    GTK_FILL,
+                    GTK_EXPAND|GTK_FILL,
+                    0,
+                    0);
+
             gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
             gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_CORNER_BOTTOM_RIGHT);
 
             gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 1, 0, 3, GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->image_list_toolbar,
+                    0,
+                    1,
+                    0,
+                    5,
+                    GTK_FILL,
+                    GTK_EXPAND|GTK_FILL,
+                    0,
+                    0);
             gtk_orientable_set_orientation (GTK_ORIENTABLE(window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
             exo_icon_bar_set_orientation (EXO_ICON_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
             break;
@@ -1818,12 +1860,33 @@ rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint ori
 
 
             gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->t_bar_s_window)), window->priv->t_bar_s_window);
-            gtk_paned_pack2 (GTK_PANED (window->priv->hpaned_right), window->priv->t_bar_s_window, FALSE, FALSE);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->t_bar_s_window,
+                    3,
+                    4,
+                    0,
+                    5,
+                    GTK_FILL,
+                    GTK_EXPAND|GTK_FILL,
+                    0,
+                    0);
+
             gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
             gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_CORNER_BOTTOM_LEFT);
 
             gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 2, 3, 0, 3, GTK_FILL,GTK_EXPAND|GTK_FILL, 0, 0);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->image_list_toolbar,
+                    4,
+                    5,
+                    0,
+                    5,
+                    GTK_FILL,
+                    GTK_EXPAND|GTK_FILL,
+                    0,
+                    0);
             gtk_orientable_set_orientation (GTK_ORIENTABLE (window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
             exo_icon_bar_set_orientation (EXO_ICON_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
             break;
@@ -1836,12 +1899,33 @@ rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint ori
 
 
             gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->t_bar_s_window)), window->priv->t_bar_s_window);
-            gtk_paned_pack1 (GTK_PANED (window->priv->vpaned_top), window->priv->t_bar_s_window, FALSE, FALSE);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->t_bar_s_window,
+                    0,
+                    5,
+                    1,
+                    2,
+                    GTK_EXPAND|GTK_FILL,
+                    GTK_FILL,
+                    0,
+                    0);
+
             gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
             gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_CORNER_BOTTOM_RIGHT);
 
             gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 0, 1, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->image_list_toolbar,
+                    0,
+                    5,
+                    0,
+                    1,
+                    GTK_EXPAND|GTK_FILL,
+                    GTK_FILL,
+                    0,
+                    0);
             gtk_orientable_set_orientation (GTK_ORIENTABLE (window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
             exo_icon_bar_set_orientation (EXO_ICON_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
             break;
@@ -1853,12 +1937,33 @@ rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint ori
             gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(window->priv->forward), GTK_STOCK_GO_FORWARD);
 
             gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->t_bar_s_window)), window->priv->t_bar_s_window);
-            gtk_paned_pack2 (GTK_PANED (window->priv->vpaned_bottom), window->priv->t_bar_s_window, FALSE, FALSE);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->t_bar_s_window,
+                    0,
+                    5,
+                    3,
+                    4,
+                    GTK_EXPAND|GTK_FILL,
+                    GTK_FILL,
+                    0,
+                    0);
+
             gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
             gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (window->priv->t_bar_s_window), GTK_CORNER_TOP_RIGHT);
 
             gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 2, 3, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
+            gtk_table_attach (
+                    GTK_TABLE (window->priv->table),
+                    window->priv->image_list_toolbar,
+                    0,
+                    5,
+                    4,
+                    5,
+                    GTK_EXPAND|GTK_FILL,
+                    GTK_FILL,
+                    0,
+                    0);
             gtk_orientable_set_orientation (GTK_ORIENTABLE(window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
             exo_icon_bar_set_orientation (EXO_ICON_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
             break;
@@ -1937,6 +2042,15 @@ cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *action,
 }
 
 static void
+cb_rstto_main_window_thumbnail_size_changed (
+        GtkRadioAction *action,
+        GtkRadioAction *current,
+        RsttoMainWindow *window)
+{
+    rstto_main_window_set_thumbnail_size (window, gtk_radio_action_get_current_value (current));
+}
+
+static void
 cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window)
 {
     gint response = GTK_RESPONSE_APPLY;
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index c7888f7..b0c9509 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -42,6 +42,15 @@
                 <menuitem action="pos-top"/>
                 <menuitem action="pos-bottom"/>
             </menu>
+            <menu action="thumbnailbar-size-menu">
+                <menuitem action="size-very-small"/>
+                <menuitem action="size-smaller"/>
+                <menuitem action="size-small"/>
+                <menuitem action="size-normal"/>
+                <menuitem action="size-large"/>
+                <menuitem action="size-larger"/>
+                <menuitem action="size-very-large"/>
+            </menu>
             <separator/>
             <menu action="zoom-menu">
                 <menuitem action="zoom-in"/>
diff --git a/src/settings.c b/src/settings.c
index 1d89aca..d34d1c5 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -74,6 +74,7 @@ enum
     PROP_MERGE_TOOLBARS,
     PROP_ERROR_MISSING_THUMBNAILER,
     PROP_SORT_TYPE,
+    PROP_THUMBNAIL_SIZE,
 };
 
 GType
@@ -124,6 +125,7 @@ struct _RsttoSettingsPriv
     gboolean  use_thunar_properties;
     gboolean  maximize_on_startup;
     gboolean  merge_toolbars;
+    RsttoThumbnailSize thumbnail_size;
 
     RsttoSortType sort_type;
 
@@ -165,6 +167,7 @@ rstto_settings_init (GObject *object)
     settings->priv->maximize_on_startup = TRUE;
     settings->priv->hide_thumbnailbar_fullscreen = TRUE;
     settings->priv->errors.missing_thumbnailer = TRUE;
+    settings->priv->thumbnail_size = THUMBNAIL_SIZE_NORMAL;
 
     xfconf_g_property_bind (
             settings->priv->channel,
@@ -223,6 +226,13 @@ rstto_settings_init (GObject *object)
 
     xfconf_g_property_bind (
             settings->priv->channel,
+            "/window/thumbnails/size",
+            G_TYPE_UINT,
+            settings,
+            "thumbnail-size");
+
+    xfconf_g_property_bind (
+            settings->priv->channel,
             "/window/thumbnails/hide-fullscreen",
             G_TYPE_BOOLEAN,
             settings,
@@ -547,6 +557,19 @@ rstto_settings_class_init (GObjectClass *object_class)
             object_class,
             PROP_SORT_TYPE,
             pspec);
+
+    pspec = g_param_spec_uint (
+            "thumbnail-size",
+            "",
+            "",
+            0,
+            THUMBNAIL_SIZE_COUNT,
+            0,
+            G_PARAM_READWRITE);
+    g_object_class_install_property (
+            object_class,
+            PROP_THUMBNAIL_SIZE,
+            pspec);
 }
 
 /**
@@ -709,6 +732,9 @@ rstto_settings_set_property    (GObject      *object,
         case PROP_SORT_TYPE:
             settings->priv->sort_type = g_value_get_uint ( value );
             break;
+        case PROP_THUMBNAIL_SIZE:
+            settings->priv->thumbnail_size = g_value_get_uint (value);
+            break;
         default:
             break;
     }
@@ -789,6 +815,11 @@ rstto_settings_get_property    (GObject    *object,
                     value,
                     settings->priv->sort_type);
             break;
+        case PROP_THUMBNAIL_SIZE:
+            g_value_set_uint (
+                    value,
+                    settings->priv->thumbnail_size);
+            break;
         default:
             break;
 
diff --git a/src/util.h b/src/util.h
index cbea6bc..e7200af 100644
--- a/src/util.h
+++ b/src/util.h
@@ -47,4 +47,15 @@ typedef enum {
     SORT_TYPE_COUNT,
 } RsttoSortType;
 
+typedef enum {
+    THUMBNAIL_SIZE_VERY_SMALL = 0,
+    THUMBNAIL_SIZE_SMALLER,
+    THUMBNAIL_SIZE_SMALL,
+    THUMBNAIL_SIZE_NORMAL,
+    THUMBNAIL_SIZE_LARGE,
+    THUMBNAIL_SIZE_LARGER,
+    THUMBNAIL_SIZE_VERY_LARGE,
+    THUMBNAIL_SIZE_COUNT,
+} RsttoThumbnailSize;
+
 #endif /* __RSTTO_UTIL_H__ */


More information about the Xfce4-commits mailing list