[tepl] Amtk: rename AmtkMenuFactory to AmtkFactoryMenu



commit 2fa4748bacff69a8dd75dfe3055622e55e7207de
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Jul 17 14:52:36 2017 +0200

    Amtk: rename AmtkMenuFactory to AmtkFactoryMenu
    
    There will be:
    AmtkFactory
    AmtkFactoryMenu
    AmtkFactoryToolbar
    
    In the docs, when sorting the classes in alphabetical order, all the
    factories will be easier to find, they will be grouped together.

 amtk/Makefile.am                                  |    4 +-
 amtk/{amtk-menu-factory.c => amtk-factory-menu.c} |   92 ++++++++++----------
 amtk/amtk-factory-menu.h                          |   67 +++++++++++++++
 amtk/amtk-menu-factory.h                          |   67 ---------------
 amtk/amtk-types.h                                 |    2 +-
 amtk/amtk.h                                       |    2 +-
 docs/reference/tepl-3.0-sections.txt              |   30 ++++----
 docs/reference/tepl-docs.xml.in                   |    2 +-
 po/POTFILES.in                                    |    2 +-
 tests/test-menu.c                                 |   12 ++--
 10 files changed, 140 insertions(+), 140 deletions(-)
---
diff --git a/amtk/Makefile.am b/amtk/Makefile.am
index a887715..78a0574 100644
--- a/amtk/Makefile.am
+++ b/amtk/Makefile.am
@@ -17,7 +17,7 @@ amtk_public_headers =                         \
        amtk-action-map.h                       \
        amtk-application-window.h               \
        amtk-factory.h                          \
-       amtk-menu-factory.h                     \
+       amtk-factory-menu.h                     \
        amtk-menu-item.h                        \
        amtk-menu-shell.h                       \
        amtk-types.h                            \
@@ -30,7 +30,7 @@ amtk_public_c_files =                         \
        amtk-action-map.c                       \
        amtk-application-window.c               \
        amtk-factory.c                          \
-       amtk-menu-factory.c                     \
+       amtk-factory-menu.c                     \
        amtk-menu-item.c                        \
        amtk-menu-shell.c                       \
        amtk-utils.c
diff --git a/amtk/amtk-menu-factory.c b/amtk/amtk-factory-menu.c
similarity index 70%
rename from amtk/amtk-menu-factory.c
rename to amtk/amtk-factory-menu.c
index 0e5ee80..736e418 100644
--- a/amtk/amtk-menu-factory.c
+++ b/amtk/amtk-factory-menu.c
@@ -17,24 +17,24 @@
  * along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "amtk-menu-factory.h"
+#include "amtk-factory-menu.h"
 #include "amtk-action-info.h"
 #include "amtk-action-info-central-store.h"
 #include "amtk-menu-item.h"
 
 /**
- * SECTION:amtk-menu-factory
+ * SECTION:amtk-factory-menu
  * @Short_description: A factory that creates #GtkMenuItem's
- * @Title: AmtkMenuFactory
+ * @Title: AmtkFactoryMenu
  *
- * #AmtkMenuFactory permits to create #GtkMenuItem's from #AmtkActionInfo's.
+ * #AmtkFactoryMenu permits to create #GtkMenuItem's from #AmtkActionInfo's.
  *
  * A #GtkApplication can be associated so that when a menu item is created,
  * gtk_application_set_accels_for_action() is called. See
- * amtk_menu_factory_create_menu_item() for more details.
+ * amtk_factory_menu_create_menu_item() for more details.
  */
 
-struct _AmtkMenuFactoryPrivate
+struct _AmtkFactoryMenuPrivate
 {
        GtkApplication *app;
 };
@@ -48,20 +48,20 @@ enum
 
 static GParamSpec *properties[N_PROPERTIES];
 
-G_DEFINE_TYPE_WITH_PRIVATE (AmtkMenuFactory, amtk_menu_factory, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (AmtkFactoryMenu, amtk_factory_menu, G_TYPE_OBJECT)
 
 static void
-amtk_menu_factory_get_property (GObject    *object,
+amtk_factory_menu_get_property (GObject    *object,
                                 guint       prop_id,
                                 GValue     *value,
                                 GParamSpec *pspec)
 {
-       AmtkMenuFactory *factory = AMTK_MENU_FACTORY (object);
+       AmtkFactoryMenu *factory = AMTK_FACTORY_MENU (object);
 
        switch (prop_id)
        {
                case PROP_APPLICATION:
-                       g_value_set_object (value, amtk_menu_factory_get_application (factory));
+                       g_value_set_object (value, amtk_factory_menu_get_application (factory));
                        break;
 
                default:
@@ -71,12 +71,12 @@ amtk_menu_factory_get_property (GObject    *object,
 }
 
 static void
-amtk_menu_factory_set_property (GObject      *object,
+amtk_factory_menu_set_property (GObject      *object,
                                 guint         prop_id,
                                 const GValue *value,
                                 GParamSpec   *pspec)
 {
-       AmtkMenuFactory *factory = AMTK_MENU_FACTORY (object);
+       AmtkFactoryMenu *factory = AMTK_FACTORY_MENU (object);
 
        switch (prop_id)
        {
@@ -92,30 +92,30 @@ amtk_menu_factory_set_property (GObject      *object,
 }
 
 static void
-amtk_menu_factory_dispose (GObject *object)
+amtk_factory_menu_dispose (GObject *object)
 {
-       AmtkMenuFactory *factory = AMTK_MENU_FACTORY (object);
+       AmtkFactoryMenu *factory = AMTK_FACTORY_MENU (object);
 
        g_clear_object (&factory->priv->app);
 
-       G_OBJECT_CLASS (amtk_menu_factory_parent_class)->dispose (object);
+       G_OBJECT_CLASS (amtk_factory_menu_parent_class)->dispose (object);
 }
 
 static void
-amtk_menu_factory_class_init (AmtkMenuFactoryClass *klass)
+amtk_factory_menu_class_init (AmtkFactoryMenuClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       object_class->get_property = amtk_menu_factory_get_property;
-       object_class->set_property = amtk_menu_factory_set_property;
-       object_class->dispose = amtk_menu_factory_dispose;
+       object_class->get_property = amtk_factory_menu_get_property;
+       object_class->set_property = amtk_factory_menu_set_property;
+       object_class->dispose = amtk_factory_menu_dispose;
 
        /**
-        * AmtkMenuFactory:application:
+        * AmtkFactoryMenu:application:
         *
-        * The associated #GtkApplication. #AmtkMenuFactory has a strong
+        * The associated #GtkApplication. #AmtkFactoryMenu has a strong
         * reference to the #GtkApplication (which means that once the menu is
-        * created you should free the #AmtkMenuFactory).
+        * created you should free the #AmtkFactoryMenu).
         *
         * Since: 3.0
         */
@@ -132,63 +132,63 @@ amtk_menu_factory_class_init (AmtkMenuFactoryClass *klass)
 }
 
 static void
-amtk_menu_factory_init (AmtkMenuFactory *factory)
+amtk_factory_menu_init (AmtkFactoryMenu *factory)
 {
-       factory->priv = amtk_menu_factory_get_instance_private (factory);
+       factory->priv = amtk_factory_menu_get_instance_private (factory);
 }
 
 /**
- * amtk_menu_factory_new:
+ * amtk_factory_menu_new:
  * @application: (nullable): a #GtkApplication, or %NULL.
  *
- * Creates a new #AmtkMenuFactory object. Associating a #GtkApplication is
+ * Creates a new #AmtkFactoryMenu object. Associating a #GtkApplication is
  * optional.
  *
- * Returns: a new #AmtkMenuFactory.
+ * Returns: a new #AmtkFactoryMenu.
  * Since: 3.0
  */
-AmtkMenuFactory *
-amtk_menu_factory_new (GtkApplication *application)
+AmtkFactoryMenu *
+amtk_factory_menu_new (GtkApplication *application)
 {
        g_return_val_if_fail (application == NULL || GTK_IS_APPLICATION (application), NULL);
 
-       return g_object_new (AMTK_TYPE_MENU_FACTORY,
+       return g_object_new (AMTK_TYPE_FACTORY_MENU,
                             "application", application,
                             NULL);
 }
 
 /**
- * amtk_menu_factory_new_with_default_application:
+ * amtk_factory_menu_new_with_default_application:
  *
- * Calls amtk_menu_factory_new() with g_application_get_default().
+ * Calls amtk_factory_menu_new() with g_application_get_default().
  *
- * Returns: a new #AmtkMenuFactory with the default #GtkApplication.
+ * Returns: a new #AmtkFactoryMenu with the default #GtkApplication.
  * Since: 3.0
  */
-AmtkMenuFactory *
-amtk_menu_factory_new_with_default_application (void)
+AmtkFactoryMenu *
+amtk_factory_menu_new_with_default_application (void)
 {
-       return amtk_menu_factory_new (GTK_APPLICATION (g_application_get_default ()));
+       return amtk_factory_menu_new (GTK_APPLICATION (g_application_get_default ()));
 }
 
 /**
- * amtk_menu_factory_get_application:
- * @factory: an #AmtkMenuFactory.
+ * amtk_factory_menu_get_application:
+ * @factory: an #AmtkFactoryMenu.
  *
- * Returns: (transfer none): the #AmtkMenuFactory:application.
+ * Returns: (transfer none): the #AmtkFactoryMenu:application.
  * Since: 3.0
  */
 GtkApplication *
-amtk_menu_factory_get_application (AmtkMenuFactory *factory)
+amtk_factory_menu_get_application (AmtkFactoryMenu *factory)
 {
-       g_return_val_if_fail (AMTK_IS_MENU_FACTORY (factory), NULL);
+       g_return_val_if_fail (AMTK_IS_FACTORY_MENU (factory), NULL);
 
        return factory->priv->app;
 }
 
 /**
- * amtk_menu_factory_create_menu_item:
- * @factory: an #AmtkMenuFactory.
+ * amtk_factory_menu_create_menu_item:
+ * @factory: an #AmtkFactoryMenu.
  * @action_name: an action name.
  *
  * Creates a new #GtkMenuItem for @action_name. The #AmtkActionInfoCentralStore
@@ -200,7 +200,7 @@ amtk_menu_factory_get_application (AmtkMenuFactory *factory)
  * The icon is set. And the tooltip is set with
  * amtk_menu_item_set_long_description().
  *
- * If the #AmtkMenuFactory:application is non-%NULL, this function also calls
+ * If the #AmtkFactoryMenu:application is non-%NULL, this function also calls
  * gtk_application_set_accels_for_action() with the accelerators returned by
  * amtk_action_info_get_accels() (this will erase previously set accelerators
  * for that action, if any).
@@ -209,7 +209,7 @@ amtk_menu_factory_get_application (AmtkMenuFactory *factory)
  * Since: 3.0
  */
 GtkWidget *
-amtk_menu_factory_create_menu_item (AmtkMenuFactory *factory,
+amtk_factory_menu_create_menu_item (AmtkFactoryMenu *factory,
                                    const gchar     *action_name)
 {
        AmtkActionInfoCentralStore *central_store;
@@ -219,7 +219,7 @@ amtk_menu_factory_create_menu_item (AmtkMenuFactory *factory,
        const gchar *icon_name;
        const gchar *tooltip;
 
-       g_return_val_if_fail (AMTK_IS_MENU_FACTORY (factory), NULL);
+       g_return_val_if_fail (AMTK_IS_FACTORY_MENU (factory), NULL);
        g_return_val_if_fail (action_name != NULL, NULL);
 
        central_store = amtk_action_info_central_store_get_instance ();
diff --git a/amtk/amtk-factory-menu.h b/amtk/amtk-factory-menu.h
new file mode 100644
index 0000000..9a918bd
--- /dev/null
+++ b/amtk/amtk-factory-menu.h
@@ -0,0 +1,67 @@
+/*
+ * This file is part of Amtk - Actions, Menus and Toolbars Kit
+ *
+ * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Amtk is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Amtk is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMTK_FACTORY_MENU_H
+#define AMTK_FACTORY_MENU_H
+
+#if !defined (AMTK_H_INSIDE) && !defined (AMTK_COMPILATION)
+#error "Only <amtk/amtk.h> can be included directly."
+#endif
+
+#include <gtk/gtk.h>
+#include <amtk/amtk-types.h>
+
+G_BEGIN_DECLS
+
+#define AMTK_TYPE_FACTORY_MENU             (amtk_factory_menu_get_type ())
+#define AMTK_FACTORY_MENU(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), AMTK_TYPE_FACTORY_MENU, 
AmtkFactoryMenu))
+#define AMTK_FACTORY_MENU_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), AMTK_TYPE_FACTORY_MENU, 
AmtkFactoryMenuClass))
+#define AMTK_IS_FACTORY_MENU(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AMTK_TYPE_FACTORY_MENU))
+#define AMTK_IS_FACTORY_MENU_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), AMTK_TYPE_FACTORY_MENU))
+#define AMTK_FACTORY_MENU_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), AMTK_TYPE_FACTORY_MENU, 
AmtkFactoryMenuClass))
+
+typedef struct _AmtkFactoryMenuClass    AmtkFactoryMenuClass;
+typedef struct _AmtkFactoryMenuPrivate  AmtkFactoryMenuPrivate;
+
+struct _AmtkFactoryMenu
+{
+       GObject parent;
+
+       AmtkFactoryMenuPrivate *priv;
+};
+
+struct _AmtkFactoryMenuClass
+{
+       GObjectClass parent_class;
+};
+
+GType                  amtk_factory_menu_get_type                      (void);
+
+AmtkFactoryMenu *      amtk_factory_menu_new                           (GtkApplication *application);
+
+AmtkFactoryMenu *      amtk_factory_menu_new_with_default_application  (void);
+
+GtkApplication *       amtk_factory_menu_get_application               (AmtkFactoryMenu *factory);
+
+GtkWidget *            amtk_factory_menu_create_menu_item              (AmtkFactoryMenu *factory,
+                                                                        const gchar     *action_name);
+
+G_END_DECLS
+
+#endif /* AMTK_FACTORY_MENU_H */
diff --git a/amtk/amtk-types.h b/amtk/amtk-types.h
index c5f0767..f6dddb6 100644
--- a/amtk/amtk-types.h
+++ b/amtk/amtk-types.h
@@ -34,7 +34,7 @@ typedef struct _AmtkActionInfoStore           AmtkActionInfoStore;
 typedef struct _AmtkActionInfoCentralStore     AmtkActionInfoCentralStore;
 typedef struct _AmtkApplicationWindow          AmtkApplicationWindow;
 typedef struct _AmtkFactory                    AmtkFactory;
-typedef struct _AmtkMenuFactory                        AmtkMenuFactory;
+typedef struct _AmtkFactoryMenu                        AmtkFactoryMenu;
 typedef struct _AmtkMenuShell                  AmtkMenuShell;
 
 G_END_DECLS
diff --git a/amtk/amtk.h b/amtk/amtk.h
index c6e8ba3..f6c793f 100644
--- a/amtk/amtk.h
+++ b/amtk/amtk.h
@@ -30,7 +30,7 @@
 #include <amtk/amtk-action-map.h>
 #include <amtk/amtk-application-window.h>
 #include <amtk/amtk-factory.h>
-#include <amtk/amtk-menu-factory.h>
+#include <amtk/amtk-factory-menu.h>
 #include <amtk/amtk-menu-item.h>
 #include <amtk/amtk-menu-shell.h>
 #include <amtk/amtk-utils.h>
diff --git a/docs/reference/tepl-3.0-sections.txt b/docs/reference/tepl-3.0-sections.txt
index d1143ad..25dcba5 100644
--- a/docs/reference/tepl-3.0-sections.txt
+++ b/docs/reference/tepl-3.0-sections.txt
@@ -107,22 +107,22 @@ amtk_factory_get_type
 </SECTION>
 
 <SECTION>
-<FILE>amtk-menu-factory</FILE>
-AmtkMenuFactory
-amtk_menu_factory_new
-amtk_menu_factory_new_with_default_application
-amtk_menu_factory_get_application
-amtk_menu_factory_create_menu_item
+<FILE>amtk-factory-menu</FILE>
+AmtkFactoryMenu
+amtk_factory_menu_new
+amtk_factory_menu_new_with_default_application
+amtk_factory_menu_get_application
+amtk_factory_menu_create_menu_item
 <SUBSECTION Standard>
-AMTK_IS_MENU_FACTORY
-AMTK_IS_MENU_FACTORY_CLASS
-AMTK_MENU_FACTORY
-AMTK_MENU_FACTORY_CLASS
-AMTK_MENU_FACTORY_GET_CLASS
-AMTK_TYPE_MENU_FACTORY
-AmtkMenuFactoryClass
-AmtkMenuFactoryPrivate
-amtk_menu_factory_get_type
+AMTK_FACTORY_MENU
+AMTK_FACTORY_MENU_CLASS
+AMTK_FACTORY_MENU_GET_CLASS
+AMTK_IS_FACTORY_MENU
+AMTK_IS_FACTORY_MENU_CLASS
+AMTK_TYPE_FACTORY_MENU
+AmtkFactoryMenuClass
+AmtkFactoryMenuPrivate
+amtk_factory_menu_get_type
 </SECTION>
 
 <SECTION>
diff --git a/docs/reference/tepl-docs.xml.in b/docs/reference/tepl-docs.xml.in
index d82a1a2..9009483 100644
--- a/docs/reference/tepl-docs.xml.in
+++ b/docs/reference/tepl-docs.xml.in
@@ -25,7 +25,7 @@
       <xi:include href="xml/amtk-action-info-central-store.xml"/>
       <xi:include href="xml/amtk-action-map.xml"/>
       <xi:include href="xml/amtk-factory.xml"/>
-      <xi:include href="xml/amtk-menu-factory.xml"/>
+      <xi:include href="xml/amtk-factory-menu.xml"/>
       <xi:include href="xml/amtk-menu-item.xml"/>
       <xi:include href="xml/amtk-menu-shell.xml"/>
       <xi:include href="xml/amtk-utils.xml"/>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0bee7e4..213322b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,7 +5,7 @@ amtk/amtk-action-info-store.c
 amtk/amtk-action-map.c
 amtk/amtk-application-window.c
 amtk/amtk-factory.c
-amtk/amtk-menu-factory.c
+amtk/amtk-factory-menu.c
 amtk/amtk-menu-item.c
 amtk/amtk-menu-shell.c
 amtk/amtk-utils.c
diff --git a/tests/test-menu.c b/tests/test-menu.c
index e4d49c9..4814dd9 100644
--- a/tests/test-menu.c
+++ b/tests/test-menu.c
@@ -90,12 +90,12 @@ static GtkWidget *
 create_file_submenu (void)
 {
        GtkMenuShell *file_submenu;
-       AmtkMenuFactory *factory;
+       AmtkFactoryMenu *factory;
 
        file_submenu = GTK_MENU_SHELL (gtk_menu_new ());
 
-       factory = amtk_menu_factory_new_with_default_application ();
-       gtk_menu_shell_append (file_submenu, amtk_menu_factory_create_menu_item (factory, "app.quit"));
+       factory = amtk_factory_menu_new_with_default_application ();
+       gtk_menu_shell_append (file_submenu, amtk_factory_menu_create_menu_item (factory, "app.quit"));
        g_object_unref (factory);
 
        return GTK_WIDGET (file_submenu);
@@ -105,12 +105,12 @@ static GtkWidget *
 create_help_submenu (void)
 {
        GtkMenuShell *help_submenu;
-       AmtkMenuFactory *factory;
+       AmtkFactoryMenu *factory;
 
        help_submenu = GTK_MENU_SHELL (gtk_menu_new ());
 
-       factory = amtk_menu_factory_new_with_default_application ();
-       gtk_menu_shell_append (help_submenu, amtk_menu_factory_create_menu_item (factory, "app.about"));
+       factory = amtk_factory_menu_new_with_default_application ();
+       gtk_menu_shell_append (help_submenu, amtk_factory_menu_create_menu_item (factory, "app.about"));
        g_object_unref (factory);
 
        return GTK_WIDGET (help_submenu);


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