[gthumb] file list: use a GtkStack instead of a GthDumbNotebook



commit 60d8488719d6c84dfeccc72a599ad25b5f8d69c0
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Jul 4 15:32:51 2017 +0200

    file list: use a GtkStack instead of a GthDumbNotebook

 gthumb/Makefile.am         |    2 -
 gthumb/gth-dumb-notebook.c |  381 --------------------------------------------
 gthumb/gth-dumb-notebook.h |   58 -------
 gthumb/gth-file-list.c     |   23 +--
 po/POTFILES.in             |    2 -
 5 files changed, 9 insertions(+), 457 deletions(-)
---
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index acb743c..9672b50 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -39,7 +39,6 @@ PUBLIC_HEADER_FILES =                                         \
        gth-color-manager.h                             \
        gth-color-scale.h                               \
        gth-delete-task.h                               \
-       gth-dumb-notebook.h                             \
        gth-duplicable.h                                \
        gth-empty-list.h                                \
        gth-extensions.h                                \
@@ -186,7 +185,6 @@ gthumb_SOURCES =                                    \
        gth-color-manager.c                             \
        gth-color-scale.c                               \
        gth-delete-task.c                               \
-       gth-dumb-notebook.c                             \
        gth-duplicable.c                                \
        gth-empty-list.c                                \
        gth-error.c                                     \
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index d4c6d08..f516dd1 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -24,7 +24,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include "glib-utils.h"
-#include "gth-dumb-notebook.h"
 #include "gth-empty-list.h"
 #include "gth-file-list.h"
 #include "gth-file-selection.h"
@@ -42,6 +41,8 @@
 #define N_CREATEAHEAD 50000
 #define EMPTY (N_("(Empty)"))
 #define CHECK_JOBS_INTERVAL 50
+#define _FILE_VIEW "file-view"
+#define _EMPTY_VIEW "empty-view"
 
 
 typedef enum {
@@ -101,12 +102,6 @@ typedef struct {
 } ThumbnailJob;
 
 
-enum {
-       GTH_FILE_LIST_PANE_VIEW,
-       GTH_FILE_LIST_PANE_MESSAGE
-};
-
-
 typedef enum {
        THUMBNAILER_PHASE_INITIALIZE,
        THUMBNAILER_PHASE_UPDATE_VISIBLE,
@@ -629,7 +624,7 @@ gth_file_list_construct (GthFileList     *file_list,
 
        /* the main notebook */
 
-       file_list->priv->notebook = gth_dumb_notebook_new ();
+       file_list->priv->notebook = gtk_stack_new ();
 
        /* the message pane */
 
@@ -679,15 +674,15 @@ gth_file_list_construct (GthFileList     *file_list,
        gtk_container_add (GTK_CONTAINER (file_list->priv->scrolled_window), file_list->priv->view);
 
        gtk_widget_show (file_list->priv->scrolled_window);
-       gtk_container_add (GTK_CONTAINER (file_list->priv->notebook), file_list->priv->scrolled_window);
+       gtk_stack_add_named (GTK_STACK (file_list->priv->notebook), file_list->priv->scrolled_window, 
_FILE_VIEW);
 
        gtk_widget_show (file_list->priv->message);
-       gtk_container_add (GTK_CONTAINER (file_list->priv->notebook), file_list->priv->message);
+       gtk_stack_add_named (GTK_STACK (file_list->priv->notebook), file_list->priv->message, _EMPTY_VIEW);
 
        gtk_widget_show (file_list->priv->notebook);
        gtk_box_pack_start (GTK_BOX (file_list), file_list->priv->notebook, TRUE, TRUE, 0);
 
-       gth_dumb_notebook_show_child (GTH_DUMB_NOTEBOOK (file_list->priv->notebook), 
GTH_FILE_LIST_PANE_MESSAGE);
+       gtk_stack_set_visible_child_name (GTK_STACK (file_list->priv->notebook), _EMPTY_VIEW);
 }
 
 
@@ -833,7 +828,7 @@ gfl_clear_list (GthFileList *file_list,
        g_hash_table_remove_all (file_list->priv->thumb_data);
 
        gth_empty_list_set_text (GTH_EMPTY_LIST (file_list->priv->message), message);
-       gth_dumb_notebook_show_child (GTH_DUMB_NOTEBOOK (file_list->priv->notebook), 
GTH_FILE_LIST_PANE_MESSAGE);
+       gtk_stack_set_visible_child_name (GTK_STACK (file_list->priv->notebook), _EMPTY_VIEW);
 }
 
 
@@ -857,11 +852,11 @@ _gth_file_list_update_pane (GthFileList *file_list)
        file_store = (GthFileStore*) gth_file_view_get_model (GTH_FILE_VIEW (file_list->priv->view));
 
        if (gth_file_store_n_visibles (file_store) > 0) {
-               gth_dumb_notebook_show_child (GTH_DUMB_NOTEBOOK (file_list->priv->notebook), 
GTH_FILE_LIST_PANE_VIEW);
+               gtk_stack_set_visible_child_name (GTK_STACK (file_list->priv->notebook), _FILE_VIEW);
        }
        else {
                gth_empty_list_set_text (GTH_EMPTY_LIST (file_list->priv->message), _(EMPTY));
-               gth_dumb_notebook_show_child (GTH_DUMB_NOTEBOOK (file_list->priv->notebook), 
GTH_FILE_LIST_PANE_MESSAGE);
+               gtk_stack_set_visible_child_name (GTK_STACK (file_list->priv->notebook), _EMPTY_VIEW);
        }
 }
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e48a5fb..fa9a089 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -727,8 +727,6 @@ gthumb/gth-color-scale.c
 gthumb/gth-color-scale.h
 gthumb/gth-delete-task.c
 gthumb/gth-delete-task.h
-gthumb/gth-dumb-notebook.c
-gthumb/gth-dumb-notebook.h
 gthumb/gth-duplicable.c
 gthumb/gth-duplicable.h
 gthumb/gth-empty-list.c


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]