[glade] Added GladeRecentChooserMenuEditor.



commit da112b7d61adbb218d4c65d50485ab1fb0331637
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun May 5 21:55:04 2013 +0900

    Added GladeRecentChooserMenuEditor.
    
    An editor which embeds a GladeActivatableEditor and a GladeRecentChooserEditor

 plugins/gtk+/Makefile.am                         |    3 +
 plugins/gtk+/glade-gtk-recent-chooser-menu.c     |    4 +-
 plugins/gtk+/glade-gtk-resources.gresource.xml   |    1 +
 plugins/gtk+/glade-recent-chooser-editor.c       |    6 +-
 plugins/gtk+/glade-recent-chooser-menu-editor.c  |   48 ++++++++++++++++++
 plugins/gtk+/glade-recent-chooser-menu-editor.h  |   57 ++++++++++++++++++++++
 plugins/gtk+/glade-recent-chooser-menu-editor.ui |   39 +++++++++++++++
 plugins/gtk+/gtk+.xml.in                         |   21 +++++++-
 po/POTFILES.in                                   |    2 +
 9 files changed, 174 insertions(+), 7 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index fbdcab6..534fce9 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -107,6 +107,7 @@ libgladegtk_la_SOURCES =            \
        glade-recent-action-editor.c \
        glade-recent-chooser-dialog-editor.c \
        glade-recent-chooser-editor.c   \
+       glade-recent-chooser-menu-editor.c \
        glade-recent-chooser-widget-editor.c \
        glade-store-editor.c            \
        glade-string-list.c             \
@@ -159,6 +160,7 @@ noinst_HEADERS =                    \
        glade-recent-action-editor.h \
        glade-recent-chooser-dialog-editor.h \
        glade-recent-chooser-editor.h   \
+       glade-recent-chooser-menu-editor.h \
        glade-recent-chooser-widget-editor.h \
        glade-store-editor.h            \
        glade-string-list.h             \
@@ -209,6 +211,7 @@ UI_FILES =                          \
        glade-recent-action-editor.ui \
        glade-recent-chooser-dialog-editor.ui \
        glade-recent-chooser-editor.ui  \
+       glade-recent-chooser-menu-editor.ui \
        glade-recent-chooser-widget-editor.ui \
        glade-tool-button-editor.ui     \
        glade-widget-editor.ui          \
diff --git a/plugins/gtk+/glade-gtk-recent-chooser-menu.c b/plugins/gtk+/glade-gtk-recent-chooser-menu.c
index 4b8687e..fd925c0 100644
--- a/plugins/gtk+/glade-gtk-recent-chooser-menu.c
+++ b/plugins/gtk+/glade-gtk-recent-chooser-menu.c
@@ -25,14 +25,14 @@
 #include <glib/gi18n-lib.h>
 #include <gladeui/glade.h>
 
-#include "glade-activatable-editor.h"
+#include "glade-recent-chooser-menu-editor.h"
 
 GladeEditable *
 glade_gtk_recent_chooser_menu_create_editable (GladeWidgetAdaptor * adaptor,
                                               GladeEditorPageType type)
 {
   if (type == GLADE_PAGE_GENERAL)
-    return (GladeEditable *) glade_activatable_editor_new (adaptor, NULL);
+    return (GladeEditable *) glade_recent_chooser_menu_editor_new ();
 
   return GWA_GET_CLASS (GTK_TYPE_MENU)->create_editable (adaptor, type);
 }
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 3800cbe..fff48bd 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -21,6 +21,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-widget-editor.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-menu-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-tool-button-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-widget-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-window-editor.ui</file>
diff --git a/plugins/gtk+/glade-recent-chooser-editor.c b/plugins/gtk+/glade-recent-chooser-editor.c
index 9ecf0ce..65fe988 100644
--- a/plugins/gtk+/glade-recent-chooser-editor.c
+++ b/plugins/gtk+/glade-recent-chooser-editor.c
@@ -76,11 +76,11 @@ glade_recent_chooser_editor_load (GladeEditable *editable,
   if (gwidget)
     {
       GObject *object = glade_widget_get_object (gwidget);
-      gboolean is_recent_action = GTK_IS_RECENT_ACTION (object);
+      gboolean has_show_numbers = (GTK_IS_RECENT_ACTION (object) || GTK_IS_RECENT_CHOOSER_MENU (object));
 
       /* Update subclass specific editor visibility */
-      gtk_widget_set_visible (priv->select_multiple_editor, !is_recent_action);
-      gtk_widget_set_visible (priv->show_numbers_editor, is_recent_action);
+      gtk_widget_set_visible (priv->select_multiple_editor, !has_show_numbers);
+      gtk_widget_set_visible (priv->show_numbers_editor, has_show_numbers);
     }
 }
 
diff --git a/plugins/gtk+/glade-recent-chooser-menu-editor.c b/plugins/gtk+/glade-recent-chooser-menu-editor.c
new file mode 100644
index 0000000..eb8f6f2
--- /dev/null
+++ b/plugins/gtk+/glade-recent-chooser-menu-editor.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Tristan Van Berkom.
+ *
+ * This library 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.
+ *
+ * This library 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+
+#include "glade-recent-chooser-menu-editor.h"
+
+G_DEFINE_TYPE (GladeRecentChooserMenuEditor, glade_recent_chooser_menu_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_recent_chooser_menu_editor_class_init (GladeRecentChooserMenuEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-recent-chooser-menu-editor.ui");
+}
+
+static void
+glade_recent_chooser_menu_editor_init (GladeRecentChooserMenuEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_recent_chooser_menu_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-recent-chooser-menu-editor.h b/plugins/gtk+/glade-recent-chooser-menu-editor.h
new file mode 100644
index 0000000..4bfd805
--- /dev/null
+++ b/plugins/gtk+/glade-recent-chooser-menu-editor.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013 Tristan Van Berkom.
+ *
+ * This library 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.
+ *
+ * This library 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+#ifndef _GLADE_RECENT_CHOOSER_MENU_EDITOR_H_
+#define _GLADE_RECENT_CHOOSER_MENU_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include "glade-window-editor.h"
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR              (glade_recent_chooser_menu_editor_get_type ())
+#define GLADE_RECENT_CHOOSER_MENU_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR, GladeRecentChooserMenuEditor))
+#define GLADE_RECENT_CHOOSER_MENU_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR, GladeRecentChooserMenuEditorClass))
+#define GLADE_IS_RECENT_CHOOSER_MENU_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR))
+#define GLADE_IS_RECENT_CHOOSER_MENU_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR))
+#define GLADE_RECENT_CHOOSER_MENU_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_RECENT_CHOOSER_MENU_EDITOR, GladeRecentChooserMenuEditorClass))
+
+typedef struct _GladeRecentChooserMenuEditor        GladeRecentChooserMenuEditor;
+typedef struct _GladeRecentChooserMenuEditorClass   GladeRecentChooserMenuEditorClass;
+typedef struct _GladeRecentChooserMenuEditorPrivate GladeRecentChooserMenuEditorPrivate;
+
+struct _GladeRecentChooserMenuEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeRecentChooserMenuEditorPrivate *priv;
+};
+
+struct _GladeRecentChooserMenuEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_recent_chooser_menu_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_recent_chooser_menu_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_RECENT_CHOOSER_MENU_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-recent-chooser-menu-editor.ui 
b/plugins/gtk+/glade-recent-chooser-menu-editor.ui
new file mode 100644
index 0000000..7dba22e
--- /dev/null
+++ b/plugins/gtk+/glade-recent-chooser-menu-editor.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <!-- interface-requires gladeui 0.0 -->
+  <template class="GladeRecentChooserMenuEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GladeActivatableEditor" id="embed">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">4</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GladeRecentChooserEditor" id="recentchoosereditor">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="recentchoosereditor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index e90592e..859c581 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1918,7 +1918,6 @@ embedded in another object</_tooltip>
       <actions>
         <action id="launch_editor" _name="Edit&#8230;" stock="gtk-edit" important="True"/>
       </actions>
-
       <properties>
         <property id="accel-group" since="2.14"/>
         <property id="accel-path" since="2.14"/>
@@ -1936,7 +1935,25 @@ embedded in another object</_tooltip>
       <create-editable-function>glade_gtk_recent_chooser_menu_create_editable</create-editable-function>
       <set-property-function>glade_gtk_recent_chooser_menu_set_property</set-property-function>
       <properties>
-       <property id="select-multiple" disabled="True"/>
+
+       <!-- GtkActivatable -->
+       <property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False" 
needs-sync="True"
+                 optional="True" optional-default="False"/>
+       <property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" save="False" 
needs-sync="True"
+                 since="2.16" default="False" optional="True" optional-default="False"/>
+
+       <!-- Claim the GladeRecentChooserEditor properties  -->
+       <property id="recent-manager" custom-layout="True"/>
+       <property id="filter" custom-layout="True"/>
+       <property id="limit" custom-layout="True"/>
+       <property id="sort-type" custom-layout="True"/>
+       <property id="show-private" custom-layout="True"/>
+       <property id="show-tips" custom-layout="True"/>
+       <property id="show-icons" custom-layout="True"/>
+       <property id="show-not-found" custom-layout="True"/>
+       <property id="select-multiple" custom-layout="True"/>
+       <property id="local-only" custom-layout="True"/>
+       <property id="show-numbers" custom-layout="True"/>
       </properties>
     </glade-widget-class>
     
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 70903e6..7269873 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -136,6 +136,7 @@ plugins/gtk+/glade-model-data.c
 plugins/gtk+/glade-recent-action-editor.c
 plugins/gtk+/glade-recent-chooser-dialog-editor.c
 plugins/gtk+/glade-recent-chooser-editor.c
+plugins/gtk+/glade-recent-chooser-menu-editor.c
 plugins/gtk+/glade-recent-chooser-widget-editor.c
 plugins/gtk+/glade-store-editor.c
 plugins/gtk+/glade-string-list.c
@@ -164,6 +165,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-recent-action-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-chooser-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-chooser-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-recent-chooser-menu-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-chooser-widget-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-tool-button-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-widget-editor.ui


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