[buoh/cleanups: 5/31] Switch to gtk_widget_class_bind_template_child_private



commit 34e1bf48c57984e936e1045e5034289c36069ba5
Author: Jan Tojnar <jtojnar gmail com>
Date:   Fri Sep 14 16:13:57 2018 +0200

    Switch to gtk_widget_class_bind_template_child_private
    
    No point of having the widgets public

 src/buoh-add-comic-dialog.c  | 10 ++++++----
 src/buoh-add-comic-dialog.h  |  2 --
 src/buoh-properties-dialog.c | 35 +++++++++++++++++++++--------------
 src/buoh-properties-dialog.h |  7 -------
 4 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/src/buoh-add-comic-dialog.c b/src/buoh-add-comic-dialog.c
index ee14fcb..aafecaf 100644
--- a/src/buoh-add-comic-dialog.c
+++ b/src/buoh-add-comic-dialog.c
@@ -31,6 +31,8 @@
 
 struct _BuohAddComicDialogPrivate {
         GtkTreeModel *model;
+        GtkWidget    *selected_label;
+        GtkWidget    *tree_view;
         gint          n_selected;
 };
 
@@ -54,7 +56,7 @@ buoh_add_comic_dialog_init (BuohAddComicDialog *dialog)
 
         dialog->priv->model = buoh_get_comics_model (BUOH);
 
-        gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->tree_view), dialog->priv->model);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->priv->tree_view), dialog->priv->model);
 
         /* Counter */
         dialog->priv->n_selected = buoh_add_comic_dialog_get_n_selected (dialog);
@@ -68,8 +70,8 @@ buoh_add_comic_dialog_class_init (BuohAddComicDialogClass *klass)
 
         gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/buoh/ui/add-comic-dialog.ui");
 
-        gtk_widget_class_bind_template_child (widget_class, BuohAddComicDialog, selected_label);
-        gtk_widget_class_bind_template_child (widget_class, BuohAddComicDialog, tree_view);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohAddComicDialog, selected_label);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohAddComicDialog, tree_view);
 
         gtk_widget_class_bind_template_callback (widget_class, buoh_add_comic_toggled_cb);
 }
@@ -103,7 +105,7 @@ buoh_comic_add_dialog_update_selected (BuohAddComicDialog *dialog)
         gchar *text;
 
         text = g_strdup_printf (_("Comics selected: %d"), dialog->priv->n_selected);
-        gtk_label_set_text (GTK_LABEL (dialog->selected_label), text);
+        gtk_label_set_text (GTK_LABEL (dialog->priv->selected_label), text);
         g_free (text);
 }
 
diff --git a/src/buoh-add-comic-dialog.h b/src/buoh-add-comic-dialog.h
index c914adb..94c8d12 100644
--- a/src/buoh-add-comic-dialog.h
+++ b/src/buoh-add-comic-dialog.h
@@ -38,8 +38,6 @@ typedef struct _BuohAddComicDialogPrivate BuohAddComicDialogPrivate;
 struct _BuohAddComicDialog {
         GtkDialog                  parent;
         BuohAddComicDialogPrivate *priv;
-        GtkWidget                 *selected_label;
-        GtkWidget                 *tree_view;
 };
 
 struct _BuohAddComicDialogClass {
diff --git a/src/buoh-properties-dialog.c b/src/buoh-properties-dialog.c
index 749c5be..87aeb8a 100644
--- a/src/buoh-properties-dialog.c
+++ b/src/buoh-properties-dialog.c
@@ -30,6 +30,13 @@
 
 struct _BuohPropertiesDialogPrivate {
         BuohComicManager *comic_manager;
+        GtkWidget        *title;
+        GtkWidget        *author;
+        GtkWidget        *uri;
+        GtkWidget        *language;
+        GtkWidget        *date;
+        GtkWidget        *publication_days;
+        GtkWidget        *thumbnail;
 };
 
 static void buoh_properties_dialog_init       (BuohPropertiesDialog      *dialog);
@@ -52,13 +59,13 @@ buoh_properties_dialog_class_init (BuohPropertiesDialogClass *klass)
 
         gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/buoh/ui/properties-dialog.ui");
 
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, title);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, author);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, uri);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, language);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, date);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, publication_days);
-        gtk_widget_class_bind_template_child (widget_class, BuohPropertiesDialog, thumbnail);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, title);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, author);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, uri);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, language);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, date);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, publication_days);
+        gtk_widget_class_bind_template_child_private (widget_class, BuohPropertiesDialog, thumbnail);
 }
 
 void
@@ -79,13 +86,13 @@ buoh_properties_dialog_set_comic_manager (BuohPropertiesDialog   *dialog,
         comic = buoh_comic_manager_get_current (comic_manager);
 
         thumbnail = buoh_comic_get_thumbnail (comic);
-        gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->thumbnail), thumbnail);
+        gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->priv->thumbnail), thumbnail);
         g_object_unref (thumbnail);
 
-        gtk_label_set_text (GTK_LABEL (dialog->title), buoh_comic_manager_get_title (comic_manager));
-        gtk_label_set_text (GTK_LABEL (dialog->author), buoh_comic_manager_get_author (comic_manager));
-        gtk_label_set_text (GTK_LABEL (dialog->uri), buoh_comic_get_uri (comic));
-        gtk_label_set_text (GTK_LABEL (dialog->language), buoh_comic_manager_get_language (comic_manager));
+        gtk_label_set_text (GTK_LABEL (dialog->priv->title), buoh_comic_manager_get_title (comic_manager));
+        gtk_label_set_text (GTK_LABEL (dialog->priv->author), buoh_comic_manager_get_author (comic_manager));
+        gtk_label_set_text (GTK_LABEL (dialog->priv->uri), buoh_comic_get_uri (comic));
+        gtk_label_set_text (GTK_LABEL (dialog->priv->language), buoh_comic_manager_get_language 
(comic_manager));
 
         comic_date = buoh_comic_get_date (comic);
         if (g_date_strftime (date, DATE_BUFFER,
@@ -93,11 +100,11 @@ buoh_properties_dialog_set_comic_manager (BuohPropertiesDialog   *dialog,
                              comic_date) == 0) {
                 buoh_debug ("Date buffer too short");
         }
-        gtk_label_set_text (GTK_LABEL (dialog->date), date);
+        gtk_label_set_text (GTK_LABEL (dialog->priv->date), date);
 
         if (BUOH_IS_COMIC_MANAGER_DATE (comic_manager)) {
                 pub_days = buoh_comic_manager_date_get_publication_days (BUOH_COMIC_MANAGER_DATE 
(comic_manager));
-                gtk_label_set_text (GTK_LABEL (dialog->publication_days), pub_days);
+                gtk_label_set_text (GTK_LABEL (dialog->priv->publication_days), pub_days);
                 g_free (pub_days);
         }
 }
diff --git a/src/buoh-properties-dialog.h b/src/buoh-properties-dialog.h
index 75995a5..6a09100 100644
--- a/src/buoh-properties-dialog.h
+++ b/src/buoh-properties-dialog.h
@@ -41,13 +41,6 @@ typedef struct _BuohPropertiesDialogPrivate BuohPropertiesDialogPrivate;
 struct _BuohPropertiesDialog {
         GtkDialog                   parent;
         BuohPropertiesDialogPrivate *priv;
-        GtkWidget                   *title;
-        GtkWidget                   *author;
-        GtkWidget                   *uri;
-        GtkWidget                   *language;
-        GtkWidget                   *date;
-        GtkWidget                   *publication_days;
-        GtkWidget                   *thumbnail;
 };
 
 struct _BuohPropertiesDialogClass {


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