[glade/wip/beniofel/popover: 3/19] Add an editor for GtkPopover



commit ea851e5cdded976961f4185d365384dec3fc20e9
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Nov 19 07:53:42 2014 +0100

    Add an editor for GtkPopover

 plugins/gtk+/Makefile.am                       |    3 +
 plugins/gtk+/glade-gtk-popover.c               |   13 ++
 plugins/gtk+/glade-gtk-resources.gresource.xml |    1 +
 plugins/gtk+/glade-popover-editor.c            |   69 ++++++++++
 plugins/gtk+/glade-popover-editor.h            |   57 ++++++++
 plugins/gtk+/glade-popover-editor.ui           |  165 ++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in                       |    6 +-
 7 files changed, 312 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 8e15d89..7e502c1 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -135,6 +135,7 @@ libgladegtk_la_SOURCES =            \
        glade-misc-editor.c             \
        glade-model-data.c              \
        glade-notebook-editor.c         \
+       glade-popover-editor.c          \
        glade-progress-bar-editor.c     \
        glade-real-tree-view-editor.c   \
        glade-recent-action-editor.c    \
@@ -214,6 +215,7 @@ noinst_HEADERS =                    \
        glade-misc-editor.h             \
        glade-model-data.h              \
        glade-notebook-editor.h         \
+       glade-popover-editor.h          \
        glade-progress-bar-editor.h     \
        glade-real-tree-view-editor.h   \
        glade-recent-action-editor.h    \
@@ -291,6 +293,7 @@ UI_FILES =                          \
        glade-message-dialog-editor.ui  \
        glade-misc-editor.ui            \
        glade-notebook-editor.ui        \
+       glade-popover-editor.ui         \
        glade-progress-bar-editor.ui    \
        glade-real-tree-view-editor.ui  \
        glade-recent-action-editor.ui   \
diff --git a/plugins/gtk+/glade-gtk-popover.c b/plugins/gtk+/glade-gtk-popover.c
index 2d80bad..b60e6ff 100644
--- a/plugins/gtk+/glade-gtk-popover.c
+++ b/plugins/gtk+/glade-gtk-popover.c
@@ -25,6 +25,8 @@
 #include <glib/gi18n-lib.h>
 #include <gladeui/glade.h>
 
+#include "glade-popover-editor.h"
+
 GObject *
 glade_gtk_popover_constructor (GType type,
                                guint n_construct_properties,
@@ -43,3 +45,14 @@ glade_gtk_popover_constructor (GType type,
 
   return ret_obj;
 }
+
+GladeEditable *
+glade_gtk_popover_create_editable (GladeWidgetAdaptor * adaptor,
+                                   GladeEditorPageType  type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    return (GladeEditable *) glade_popover_editor_new ();
+  else
+    return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+}
+
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index e9e5d02..f3a9ec6 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -31,6 +31,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-misc-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-progress-bar-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-notebook-editor.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">glade-popover-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-real-tree-view-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-action-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-dialog-editor.ui</file>
diff --git a/plugins/gtk+/glade-popover-editor.c b/plugins/gtk+/glade-popover-editor.c
new file mode 100644
index 0000000..8421094
--- /dev/null
+++ b/plugins/gtk+/glade-popover-editor.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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:
+ *   Matthias Clasen <mclasen redhat com>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "glade-popover-editor.h"
+
+static void glade_popover_editor_grab_focus (GtkWidget * widget);
+
+struct _GladePopoverEditorPrivate
+{
+  GtkWidget *embed;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GladePopoverEditor, glade_popover_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_popover_editor_class_init (GladePopoverEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->grab_focus = glade_popover_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-popover-editor.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GladePopoverEditor, embed);
+}
+
+static void
+glade_popover_editor_init (GladePopoverEditor * self)
+{
+  self->priv = glade_popover_editor_get_instance_private (self);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_popover_editor_grab_focus (GtkWidget * widget)
+{
+  GladePopoverEditor *editor = GLADE_POPOVER_EDITOR (widget);
+
+  gtk_widget_grab_focus (editor->priv->embed);
+}
+
+GtkWidget *
+glade_popover_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_POPOVER_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-popover-editor.h b/plugins/gtk+/glade-popover-editor.h
new file mode 100644
index 0000000..eeb35a6
--- /dev/null
+++ b/plugins/gtk+/glade-popover-editor.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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:
+ *   Matthias Clasen <mclasen redhat com>
+ */
+#ifndef _GLADE_POPOVER_EDITOR_H_
+#define _GLADE_POPOVER_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_POPOVER_EDITOR                  (glade_popover_editor_get_type ())
+#define GLADE_POPOVER_EDITOR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_POPOVER_EDITOR, GladePopoverEditor))
+#define GLADE_POPOVER_EDITOR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_POPOVER_EDITOR, GladePopoverEditorClass))
+#define GLADE_IS_POPOVER_EDITOR(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_POPOVER_EDITOR))
+#define GLADE_IS_POPOVER_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_POPOVER_EDITOR))
+#define GLADE_POPOVER_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_POPOVER_EDITOR, 
GladePopoverEditorClass))
+
+typedef struct _GladePopoverEditor        GladePopoverEditor;
+typedef struct _GladePopoverEditorClass   GladePopoverEditorClass;
+typedef struct _GladePopoverEditorPrivate GladePopoverEditorPrivate;
+
+struct _GladePopoverEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladePopoverEditorPrivate *priv;
+};
+
+struct _GladePopoverEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_popover_editor_get_type       (void) G_GNUC_CONST;
+GtkWidget       *glade_popover_editor_new            (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_POPOVER_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-popover-editor.ui b/plugins/gtk+/glade-popover-editor.ui
new file mode 100644
index 0000000..69219f3
--- /dev/null
+++ b/plugins/gtk+/glade-popover-editor.ui
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 
+
+libgladegtk - Glade UI Designer Gtk+ support plugin
+Copyright (C) 2014 Red Hat, Inc.
+
+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 library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Author: Matthias Clasen <mclasen redhat com>
+
+-->
+<interface domain="glade">
+  <requires lib="gtk+" version="3.10"/>
+  <requires lib="gladeui" version="0.0"/>
+  <template class="GladePopoverEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkGrid" id="grid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">6</property>
+        <child>
+          <object class="GladeEditorTable" id="embed">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="title">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="label" translatable="yes">Popover Attributes</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="relative_to_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">relative-to</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="relative_to_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">relative-to</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">2</property>
+            <property name="width">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="position_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">position</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+            <property name="width">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="position_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">position</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="width">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="modal_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">modal</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">4</property>
+            <property name="width">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="modal_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">modal</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">4</property>
+            <property name="width">4</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="relative_to_label"/>
+      <editor id="relative_to_editor"/>
+      <editor id="position_label"/>
+      <editor id="position_editor"/>
+      <editor id="modal_label"/>
+      <editor id="modal_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index f12dc09..5ae0b80 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -3360,9 +3360,11 @@
       
       <glade-widget-class name="GtkPopover" generic-name="popover" _title="Popover">
         <constructor-function>glade_gtk_popover_constructor</constructor-function>
+        <create-editable-function>glade_gtk_popover_create_editable</create-editable-function>
         <properties>
-          <property id="relative-to" ignore="True"/>
-          <property id="position" ignore="True"/>
+          <property id="relative-to" ignore="True" custom-layout="True"/>
+          <property id="position" ignore="True" custom-layout="True"/>
+          <property id="modal" ignore="True" custom-layout="True"/>
         </properties>
       </glade-widget-class>
 


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