[gedit/wip/redesign2] Rename GeditMenu to GeditMenuHelper



commit e8bab4866a024eecd30bb9a3efbb073b36e3caa7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Jan 2 14:38:14 2014 +0100

    Rename GeditMenu to GeditMenuHelper

 gedit/Makefile.am                           |    4 +-
 gedit/{gedit-menu.c => gedit-menu-helper.c} |   76 +++++++++++++-------------
 gedit/gedit-menu-helper.h                   |   62 ++++++++++++++++++++++
 gedit/gedit-menu.h                          |   62 ----------------------
 gedit/gedit-window-activatable.c            |    6 +-
 gedit/gedit-window-activatable.h            |   10 ++--
 6 files changed, 110 insertions(+), 110 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index c0a5a32..91a2351 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -133,7 +133,7 @@ INST_H_FILES =                              \
        gedit-document.h                \
        gedit-encodings.h               \
        gedit-encodings-combo-box.h     \
-       gedit-menu.h                    \
+       gedit-menu-helper.h             \
        gedit-message-bus.h             \
        gedit-message.h                 \
        gedit-panel.h                   \
@@ -162,7 +162,7 @@ libgedit_private_la_SOURCES =               \
        gedit-app-activatable.c         \
        gedit-view-activatable.c        \
        gedit-window-activatable.c      \
-       gedit-menu.c                    \
+       gedit-menu-helper.c             \
        gedit-resources.c
 
 libgedit_c_files =                     \
diff --git a/gedit/gedit-menu.c b/gedit/gedit-menu-helper.c
similarity index 59%
rename from gedit/gedit-menu.c
rename to gedit/gedit-menu-helper.c
index 32bdcd6..152e746 100644
--- a/gedit/gedit-menu.c
+++ b/gedit/gedit-menu-helper.c
@@ -1,5 +1,5 @@
 /*
- * gedit-menu.c
+ * gedit-menu-helper.c
  * This file is part of gedit
  *
  * Copyright (C) 2014 - Ignacio Casal Quinteiro
@@ -19,18 +19,18 @@
  */
 
 
-#include "gedit-menu.h"
+#include "gedit-menu-helper.h"
 #include <string.h>
 
 static guint last_merge_id = 0;
 
 
-typedef struct _GeditMenuPrivate
+typedef struct _GeditMenuHelperPrivate
 {
        GMenuModel *model;
        guint merge_id;
        gboolean dispose_has_run;
-} GeditMenuPrivate;
+} GeditMenuHelperPrivate;
 
 enum
 {
@@ -38,33 +38,33 @@ enum
        PROP_MODEL
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (GeditMenu, gedit_menu, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GeditMenuHelper, gedit_menu_helper, G_TYPE_OBJECT)
 
 static void
-gedit_menu_dispose (GObject *object)
+gedit_menu_helper_dispose (GObject *object)
 {
-       GeditMenu *menu = GEDIT_MENU (object);
-       GeditMenuPrivate *priv = gedit_menu_get_instance_private (menu);
+       GeditMenuHelper *menu = GEDIT_MENU_HELPER (object);
+       GeditMenuHelperPrivate *priv = gedit_menu_helper_get_instance_private (menu);
 
        if (!priv->dispose_has_run)
        {
-               gedit_menu_remove_items (menu);
+               gedit_menu_helper_remove_items (menu);
                priv->dispose_has_run = TRUE;
        }
 
        g_clear_object (&priv->model);
 
-       G_OBJECT_CLASS (gedit_menu_parent_class)->dispose (object);
+       G_OBJECT_CLASS (gedit_menu_helper_parent_class)->dispose (object);
 }
 
 static void
-gedit_menu_get_property (GObject    *object,
-                         guint       prop_id,
-                         GValue     *value,
-                         GParamSpec *pspec)
+gedit_menu_helper_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
 {
-       GeditMenu *menu = GEDIT_MENU (object);
-       GeditMenuPrivate *priv = gedit_menu_get_instance_private (menu);
+       GeditMenuHelper *menu = GEDIT_MENU_HELPER (object);
+       GeditMenuHelperPrivate *priv = gedit_menu_helper_get_instance_private (menu);
 
        switch (prop_id)
        {
@@ -78,13 +78,13 @@ gedit_menu_get_property (GObject    *object,
 }
 
 static void
-gedit_menu_set_property (GObject     *object,
-                         guint         prop_id,
-                         const GValue *value,
-                         GParamSpec   *pspec)
+gedit_menu_helper_set_property (GObject     *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
 {
-       GeditMenu *menu = GEDIT_MENU (object);
-       GeditMenuPrivate *priv = gedit_menu_get_instance_private (menu);
+       GeditMenuHelper *menu = GEDIT_MENU_HELPER (object);
+       GeditMenuHelperPrivate *priv = gedit_menu_helper_get_instance_private (menu);
 
        switch (prop_id)
        {
@@ -98,13 +98,13 @@ gedit_menu_set_property (GObject     *object,
 }
 
 static void
-gedit_menu_class_init (GeditMenuClass *klass)
+gedit_menu_helper_class_init (GeditMenuHelperClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       object_class->dispose = gedit_menu_dispose;
-       object_class->get_property = gedit_menu_get_property;
-       object_class->set_property = gedit_menu_set_property;
+       object_class->dispose = gedit_menu_helper_dispose;
+       object_class->get_property = gedit_menu_helper_get_property;
+       object_class->set_property = gedit_menu_helper_set_property;
 
        g_object_class_install_property (object_class,
                                         PROP_MODEL,
@@ -118,31 +118,31 @@ gedit_menu_class_init (GeditMenuClass *klass)
 }
 
 static void
-gedit_menu_init (GeditMenu *menu)
+gedit_menu_helper_init (GeditMenuHelper *menu)
 {
-       GeditMenuPrivate *priv;
+       GeditMenuHelperPrivate *priv;
 
-       priv = gedit_menu_get_instance_private (menu);
+       priv = gedit_menu_helper_get_instance_private (menu);
 
        priv->merge_id = ++last_merge_id;
 }
 
-GeditMenu *
-_gedit_menu_new (GMenuModel *model)
+GeditMenuHelper *
+_gedit_menu_helper_new (GMenuModel *model)
 {
        return g_object_new (GEDIT_TYPE_MENU, "model", model, NULL);
 }
 
 void
-gedit_menu_add_menu_item (GeditMenu *menu,
-                          GMenuItem *item)
+gedit_menu_helper_add_menu_item (GeditMenuHelper *menu,
+                                 GMenuItem       *item)
 {
-       GeditMenuPrivate *priv;
+       GeditMenuHelperPrivate *priv;
 
        g_return_if_fail (GEDIT_IS_MENU (menu));
        g_return_if_fail (G_IS_MENU_ITEM (item));
 
-       priv = gedit_menu_get_instance_private (menu);
+       priv = gedit_menu_helper_get_instance_private (menu);
 
        if (priv->model != NULL)
        {
@@ -152,12 +152,12 @@ gedit_menu_add_menu_item (GeditMenu *menu,
 }
 
 void
-gedit_menu_remove_items (GeditMenu *menu)
+gedit_menu_helper_remove_items (GeditMenuHelper *menu)
 {
-       GeditMenuPrivate *priv;
+       GeditMenuHelperPrivate *priv;
        gint i, n_items;
 
-       priv = gedit_menu_get_instance_private (menu);
+       priv = gedit_menu_helper_get_instance_private (menu);
 
        n_items = g_menu_model_get_n_items (priv->model);
        i = 0;
diff --git a/gedit/gedit-menu-helper.h b/gedit/gedit-menu-helper.h
new file mode 100644
index 0000000..79db8c5
--- /dev/null
+++ b/gedit/gedit-menu-helper.h
@@ -0,0 +1,62 @@
+/*
+ * gedit-menu-helper.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2014 - Ignacio Casal Quinteiro
+ *
+ * gedit is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * gedit 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gedit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GEDIT_MENU_HELPER_H__
+#define __GEDIT_MENU_HELPER_H__
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define GEDIT_TYPE_MENU                        (gedit_menu_helper_get_type ())
+#define GEDIT_MENU_HELPER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MENU, 
GeditMenuHelper))
+#define GEDIT_MENU_HELPER_CONST(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MENU, 
GeditMenuHelper const))
+#define GEDIT_MENU_HELPER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_MENU, 
GeditMenuHelperClass))
+#define GEDIT_IS_MENU(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_MENU))
+#define GEDIT_IS_MENU_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_MENU))
+#define GEDIT_MENU_HELPER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_MENU, 
GeditMenuHelperClass))
+
+typedef struct _GeditMenuHelper                 GeditMenuHelper;
+typedef struct _GeditMenuHelperClass    GeditMenuHelperClass;
+
+struct _GeditMenuHelper
+{
+       GObject parent;
+};
+
+struct _GeditMenuHelperClass
+{
+       GObjectClass parent_class;
+};
+
+GType                     gedit_menu_helper_get_type            (void) G_GNUC_CONST;
+
+GeditMenuHelper         *_gedit_menu_helper_new                 (GMenuModel        *model);
+
+void                      gedit_menu_helper_add_menu_item       (GeditMenuHelper   *menu,
+                                                                 GMenuItem         *item);
+
+void                      gedit_menu_helper_remove_items        (GeditMenuHelper   *menu);
+
+G_END_DECLS
+
+#endif /* __GEDIT_MENU_HELPER_H__ */
diff --git a/gedit/gedit-window-activatable.c b/gedit/gedit-window-activatable.c
index 52e390f..142fcda 100644
--- a/gedit/gedit-window-activatable.c
+++ b/gedit/gedit-window-activatable.c
@@ -125,11 +125,11 @@ gedit_window_activatable_update_state (GeditWindowActivatable *activatable)
        }
 }
 
-GeditMenu *
+GeditMenuHelper *
 gedit_window_activatable_get_menu_ext (GeditWindowActivatable *activatable,
                                        const gchar            *extension_point)
 {
-       GeditMenu *menu = NULL;
+       GeditMenuHelper *menu = NULL;
        GeditWindow *window;
        GMenuModel *model;
        gint i, n_items;
@@ -153,7 +153,7 @@ gedit_window_activatable_get_menu_ext (GeditWindowActivatable *activatable,
                        GMenuModel *section;
 
                        section = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
-                       menu = _gedit_menu_new (section);
+                       menu = _gedit_menu_helper_new (section);
                }
 
                g_free (id);
diff --git a/gedit/gedit-window-activatable.h b/gedit/gedit-window-activatable.h
index de5e962..16cbecc 100644
--- a/gedit/gedit-window-activatable.h
+++ b/gedit/gedit-window-activatable.h
@@ -23,7 +23,7 @@
 #define __GEDIT_WINDOW_ACTIVATABLE_H__
 
 #include <glib-object.h>
-#include <gedit/gedit-menu.h>
+#include <gedit/gedit-menu-helper.h>
 
 G_BEGIN_DECLS
 
@@ -63,12 +63,12 @@ void         gedit_window_activatable_update_state  (GeditWindowActivatable *activatable
  * @activatable: A #GeditWindowActivatable.
  * @extension_point: the extension point section of the menu to get.
  *
- * Gets the GeditMenu for @extension_point.
+ * Gets the #GeditMenuHelper for @extension_point.
  *
- * Returns: (transfer full): a #GeditMenu for the specific section or %NULL if not found.
+ * Returns: (transfer full): a #GeditMenuHelper for the specific section or %NULL if not found.
  */
-GeditMenu *gedit_window_activatable_get_menu_ext (GeditWindowActivatable *activatable,
-                                                  const gchar            *extension_point);
+GeditMenuHelper *gedit_window_activatable_get_menu_ext (GeditWindowActivatable *activatable,
+                                                        const gchar            *extension_point);
 
 G_END_DECLS
 


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