[recipes] Rename GrPreferences to GrChefDialog



commit cd96d95df5a10eef3f2fea09e3b42f3b9b8625ae
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 30 09:00:08 2017 +0100

    Rename GrPreferences to GrChefDialog
    
    We will use this dialog in more places soon.
    No visual changes yet.

 po/POTFILES.in                               |    4 +-
 src/Makefile.am                              |    4 +-
 src/gr-app.c                                 |    8 ++--
 src/{gr-preferences.c => gr-chef-dialog.c}   |   54 +++++++++++++-------------
 src/{gr-preferences.h => gr-chef-dialog.h}   |    8 ++--
 src/{gr-preferences.ui => gr-chef-dialog.ui} |    2 +-
 src/recipes-ui.gresource.xml                 |    2 +-
 7 files changed, 41 insertions(+), 41 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fd9b354..8525cea 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,6 +4,7 @@ data/chefs.db.h
 data/recipes.db.h
 src/chef-conflict-dialog.ui
 src/gr-category-tile.ui
+src/gr-chef-dialog.ui
 src/gr-chef-tile.ui
 src/gr-cuisine-page.ui
 src/gr-cuisines-page.ui
@@ -13,7 +14,6 @@ src/gr-edit-page.ui
 src/gr-image-viewer.ui
 src/gr-ingredient-search-tile.ui
 src/gr-list-page.ui
-src/gr-preferences.ui
 src/gr-query-editor.ui
 src/gr-recipes-page.ui
 src/gr-recipe-tile.ui
@@ -25,6 +25,7 @@ src/recipe-export-dialog.ui
 src/gr-app.c
 src/gr-category-tile.c
 src/gr-chef.c
+src/gr-chef-dialog.c
 src/gr-chef-tile.c
 src/gr-cuisine.c
 src/gr-cuisine-page.c
@@ -42,7 +43,6 @@ src/gr-ingredients-list.c
 src/gr-list-page.c
 src/gr-meal.c
 src/gr-number.c
-src/gr-preferences.c
 src/gr-query-editor.c
 src/gr-recipe.c
 src/gr-recipe-exporter.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 60e7a36..1714099 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -74,8 +74,8 @@ recipes_SOURCES = \
        gr-meal-row.c           \
        gr-number.h             \
        gr-number.c             \
-       gr-preferences.h        \
-       gr-preferences.c        \
+       gr-chef-dialog.h        \
+       gr-chef-dialog.c        \
        gr-query-editor.h       \
        gr-query-editor.c       \
        gr-recipe.h             \
diff --git a/src/gr-app.c b/src/gr-app.c
index 534b0ae..473f4ec 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -26,7 +26,7 @@
 
 #include "gr-app.h"
 #include "gr-window.h"
-#include "gr-preferences.h"
+#include "gr-chef-dialog.h"
 #include "gr-recipe-store.h"
 #include "gr-cuisine.h"
 #include "gr-shell-search-provider.h"
@@ -72,12 +72,12 @@ preferences_activated (GSimpleAction *action,
                        GVariant      *parameter,
                        gpointer       app)
 {
-        GrPreferences *prefs;
+        GrChefDialog *dialog;
         GtkWindow *win;
 
         win = gtk_application_get_active_window (GTK_APPLICATION (app));
-        prefs = gr_preferences_new (win);
-        gtk_window_present (GTK_WINDOW (prefs));
+        dialog = gr_chef_dialog_new (win);
+        gtk_window_present (GTK_WINDOW (dialog));
 }
 
 static GtkWidget *
diff --git a/src/gr-preferences.c b/src/gr-chef-dialog.c
similarity index 83%
rename from src/gr-preferences.c
rename to src/gr-chef-dialog.c
index 7ed5a8b..cc26208 100644
--- a/src/gr-preferences.c
+++ b/src/gr-chef-dialog.c
@@ -1,4 +1,4 @@
-/* gr-preferences.c:
+/* gr-chef-dialog.c:
  *
  * Copyright (C) 2016 Matthias Clasen <mclasen redhat com>
  *
@@ -27,14 +27,14 @@
 #include <gspell/gspell.h>
 #endif
 
-#include "gr-preferences.h"
+#include "gr-chef-dialog.h"
 #include "gr-chef.h"
 #include "gr-recipe-store.h"
 #include "gr-app.h"
 #include "gr-utils.h"
 
 
-struct _GrPreferences
+struct _GrChefDialog
 {
         GtkDialog parent_instance;
 
@@ -48,16 +48,16 @@ struct _GrPreferences
         char *image_path;
 };
 
-G_DEFINE_TYPE (GrPreferences, gr_preferences, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (GrChefDialog, gr_chef_dialog, GTK_TYPE_DIALOG)
 
 static void
-dismiss_error (GrPreferences *self)
+dismiss_error (GrChefDialog *self)
 {
         gtk_revealer_set_reveal_child (GTK_REVEALER (self->error_revealer), FALSE);
 }
 
 static void
-update_image (GrPreferences *self)
+update_image (GrChefDialog *self)
 {
         if (self->image_path != NULL && self->image_path[0] != '\0') {
                 g_autoptr(GdkPixbuf) pixbuf = NULL;
@@ -75,7 +75,7 @@ update_image (GrPreferences *self)
 static void
 file_chooser_response (GtkNativeDialog *self,
                        gint             response_id,
-                       GrPreferences   *prefs)
+                       GrChefDialog   *prefs)
 {
         if (response_id == GTK_RESPONSE_ACCEPT) {
                 g_free (prefs->image_path);
@@ -85,7 +85,7 @@ file_chooser_response (GtkNativeDialog *self,
 }
 
 static void
-image_button_clicked (GrPreferences *self)
+image_button_clicked (GrChefDialog *self)
 {
         GtkFileChooserNative *chooser;
         g_autoptr(GtkFileFilter) filter = NULL;
@@ -109,17 +109,17 @@ image_button_clicked (GrPreferences *self)
 }
 
 static void
-gr_preferences_finalize (GObject *object)
+gr_chef_dialog_finalize (GObject *object)
 {
-        GrPreferences *self = GR_PREFERENCES (object);
+        GrChefDialog *self = GR_CHEF_DIALOG (object);
 
         g_free (self->image_path);
 
-        G_OBJECT_CLASS (gr_preferences_parent_class)->finalize (object);
+        G_OBJECT_CLASS (gr_chef_dialog_parent_class)->finalize (object);
 }
 
 static gboolean
-save_preferences (GrPreferences  *self,
+save_chef_dialog (GrChefDialog  *self,
                   GError        **error)
 {
         g_autoptr(GrChef) chef = NULL;
@@ -153,11 +153,11 @@ save_preferences (GrPreferences  *self,
 }
 
 static gboolean
-window_close (GrPreferences *self)
+window_close (GrChefDialog *self)
 {
         g_autoptr(GError) error = NULL;
 
-        if (!save_preferences (self, &error)) {
+        if (!save_chef_dialog (self, &error)) {
                 gtk_label_set_label (GTK_LABEL (self->error_label), error->message);
                 gtk_revealer_set_reveal_child (GTK_REVEALER (self->error_revealer), TRUE);
         return TRUE;
@@ -167,7 +167,7 @@ window_close (GrPreferences *self)
 }
 
 static void
-gr_preferences_init (GrPreferences *self)
+gr_chef_dialog_init (GrChefDialog *self)
 {
         GrRecipeStore *store;
         g_autoptr(GrChef) chef = NULL;
@@ -216,31 +216,31 @@ gr_preferences_init (GrPreferences *self)
 }
 
 static void
-gr_preferences_class_init (GrPreferencesClass *klass)
+gr_chef_dialog_class_init (GrChefDialogClass *klass)
 {
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-        object_class->finalize = gr_preferences_finalize;
+        object_class->finalize = gr_chef_dialog_finalize;
 
         gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
-                                                     "/org/gnome/Recipes/gr-preferences.ui");
+                                                     "/org/gnome/Recipes/gr-chef-dialog.ui");
 
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, fullname);
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, name);
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, description);
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, image);
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, error_revealer);
-        gtk_widget_class_bind_template_child (widget_class, GrPreferences, error_label);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, fullname);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, name);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, description);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, image);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, error_revealer);
+        gtk_widget_class_bind_template_child (widget_class, GrChefDialog, error_label);
 
         gtk_widget_class_bind_template_callback (widget_class, dismiss_error);
         gtk_widget_class_bind_template_callback (widget_class, image_button_clicked);
 }
 
-GrPreferences *
-gr_preferences_new (GtkWindow *win)
+GrChefDialog *
+gr_chef_dialog_new (GtkWindow *win)
 {
-        return g_object_new (GR_TYPE_PREFERENCES,
+        return g_object_new (GR_TYPE_CHEF_DIALOG,
                              "transient-for", win,
                              "use-header-bar", TRUE,
                              NULL);
diff --git a/src/gr-preferences.h b/src/gr-chef-dialog.h
similarity index 80%
rename from src/gr-preferences.h
rename to src/gr-chef-dialog.h
index cf88276..f84f1de 100644
--- a/src/gr-preferences.h
+++ b/src/gr-chef-dialog.h
@@ -1,4 +1,4 @@
-/* gr-preferences.h:
+/* gr-chef-dialog.h:
  *
  * Copyright (C) 2016 Matthias Clasen <mclasen redhat com>
  *
@@ -24,10 +24,10 @@
 
 G_BEGIN_DECLS
 
-#define GR_TYPE_PREFERENCES (gr_preferences_get_type())
+#define GR_TYPE_CHEF_DIALOG (gr_chef_dialog_get_type())
 
-G_DECLARE_FINAL_TYPE (GrPreferences, gr_preferences, GR, PREFERENCES, GtkDialog)
+G_DECLARE_FINAL_TYPE (GrChefDialog, gr_chef_dialog, GR, CHEF_DIALOG, GtkDialog)
 
-GrPreferences  *gr_preferences_new (GtkWindow *win);
+GrChefDialog *gr_chef_dialog_new (GtkWindow *win);
 
 G_END_DECLS
diff --git a/src/gr-preferences.ui b/src/gr-chef-dialog.ui
similarity index 99%
rename from src/gr-preferences.ui
rename to src/gr-chef-dialog.ui
index cfca188..f06ee67 100644
--- a/src/gr-preferences.ui
+++ b/src/gr-chef-dialog.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="recipes">
   <!-- interface-requires gtk+ 3.8 -->
-  <template class="GrPreferences" parent="GtkDialog">
+  <template class="GrChefDialog" parent="GtkDialog">
     <property name="title" translatable="yes">Preferences</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
diff --git a/src/recipes-ui.gresource.xml b/src/recipes-ui.gresource.xml
index 782c7bc..ed92828 100644
--- a/src/recipes-ui.gresource.xml
+++ b/src/recipes-ui.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/Recipes">
     <file preprocess="xml-stripblanks">gr-category-tile.ui</file>
+    <file preprocess="xml-stripblanks">gr-chef-dialog.ui</file>
     <file preprocess="xml-stripblanks">gr-chef-tile.ui</file>
     <file preprocess="xml-stripblanks">gr-cuisine-tile.ui</file>
     <file preprocess="xml-stripblanks">gr-cuisine-page.ui</file>
@@ -14,7 +15,6 @@
     <file preprocess="xml-stripblanks">gr-ingredient-row.ui</file>
     <file preprocess="xml-stripblanks">gr-list-page.ui</file>
     <file preprocess="xml-stripblanks">gr-meal-row.ui</file>
-    <file preprocess="xml-stripblanks">gr-preferences.ui</file>
     <file preprocess="xml-stripblanks">gr-recipes-page.ui</file>
     <file preprocess="xml-stripblanks">gr-recipe-small-tile.ui</file>
     <file preprocess="xml-stripblanks">gr-recipe-tile.ui</file>


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