]> saetta.ns0.it Git - libgtkmaskedentry/commitdiff
Plugin for libgtkform.
authorAndrea Zagli <azagli@libero.it>
Sat, 26 Jun 2010 16:23:12 +0000 (18:23 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 26 Jun 2010 16:23:12 +0000 (18:23 +0200)
12 files changed:
configure.ac
docs/reference/gtkmaskedentry-undeclared.txt [deleted file]
docs/reference/gtkmaskedentry-undocumented.txt [deleted file]
docs/reference/gtkmaskedentry-unused.txt [deleted file]
docs/reference/gtkmaskedentry.args [deleted file]
docs/reference/gtkmaskedentry.hierarchy [deleted file]
docs/reference/gtkmaskedentry.interfaces [deleted file]
docs/reference/gtkmaskedentry.prerequisites [deleted file]
docs/reference/gtkmaskedentry.signals [deleted file]
src/Makefile.am
src/gtkformwidgetmaskedentry.c [new file with mode: 0644]
src/gtkformwidgetmaskedentry.h [new file with mode: 0644]

index 3195684dde6a8c3227f4db834fb836a66005780a..e96e92cfd3871e94fcf6de797ebd0d92100ef514 100644 (file)
@@ -30,10 +30,20 @@ GTK_DOC_CHECK(1.0)
 
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
 PKG_CHECK_EXISTS(gladeui-1.0 >= 3.2.0, [GLADEUI_FOUND=yes], [GLADEUI_FOUND=no])
+PKG_CHECK_EXISTS(libgtkform >= 0.2.0, [LIBGTKFORM_FOUND=yes], [LIBGTKFORM_FOUND=no])
 
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
+AM_CONDITIONAL(LIBGTKFORM_FOUND, test $LIBGTKFORM_FOUND = yes)
+
+if test $LIBGTKFORM_FOUND = yes; then
+PKG_CHECK_MODULES(GTKFORM, libgtkform >= 0.2.0)
+
+AC_SUBST(GTKFORM_CFLAGS)
+AC_SUBST(GTKFORM_LIBS)
+fi
+
 # Output files
 AC_CONFIG_FILES([
   libgtkmaskedentry.pc
diff --git a/docs/reference/gtkmaskedentry-undeclared.txt b/docs/reference/gtkmaskedentry-undeclared.txt
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/docs/reference/gtkmaskedentry-undocumented.txt b/docs/reference/gtkmaskedentry-undocumented.txt
deleted file mode 100644 (file)
index 825630c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-59% symbol docs coverage.
-10 symbols documented.
-0 symbols incomplete.
-7 not documented.
-
-
-GtkCellRendererMasked
-GtkMaskedEntry
-gtk_masked_entry_get_mask
-gtk_masked_entry_get_text
-
-
-gtkcellrenderermasked:Short_Description
-gtkmaskedentry:Long_Description
-gtkmaskedentry:Short_Description
diff --git a/docs/reference/gtkmaskedentry-unused.txt b/docs/reference/gtkmaskedentry-unused.txt
deleted file mode 100644 (file)
index 4fcebfe..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-GtkCellRendererMaskedClass
-GtkMaskedEntryClass
diff --git a/docs/reference/gtkmaskedentry.args b/docs/reference/gtkmaskedentry.args
deleted file mode 100644 (file)
index 3f5fd46..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<ARG>
-<NAME>GtkMaskedEntry::mask</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>The mask</NICK>
-<BLURB>The mask.</BLURB>
-<DEFAULT>""</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GtkMaskedEntry::tab-inside</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Tabulation inside the widget</NICK>
-<BLURB>Whether pressing tab moves between mask's parts or outside the widget.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GtkCellRendererMasked::mask</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Mask</NICK>
-<BLURB>Mask.</BLURB>
-<DEFAULT>NULL</DEFAULT>
-</ARG>
-
diff --git a/docs/reference/gtkmaskedentry.hierarchy b/docs/reference/gtkmaskedentry.hierarchy
deleted file mode 100644 (file)
index 1c316eb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-GObject
-  GInitiallyUnowned
-    GtkObject
-      GtkWidget
-        GtkEntry
-          GtkMaskedEntry
-        GtkContainer
-          GtkMenuShell
-            GtkMenu
-      GtkCellRenderer
-        GtkCellRendererText
-          GtkCellRendererMasked
-  GtkStyle
-  GdkDrawable
-    GdkWindow
-  GdkDragContext
-  GtkTooltip
-  GdkScreen
-  GtkEntryBuffer
-  GdkPixbuf
-  GtkSettings
-GInterface
-  GTypePlugin
-  AtkImplementorIface
-  GtkBuildable
-  GtkEditable
-  GtkCellEditable
-  GIcon
diff --git a/docs/reference/gtkmaskedentry.interfaces b/docs/reference/gtkmaskedentry.interfaces
deleted file mode 100644 (file)
index 2cfe9a3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-GtkWidget AtkImplementorIface GtkBuildable
-GtkEntry GtkCellEditable AtkImplementorIface GtkBuildable GtkEditable
-GtkMaskedEntry GtkCellEditable AtkImplementorIface GtkBuildable GtkEditable
-GtkContainer AtkImplementorIface GtkBuildable
-GtkMenuShell AtkImplementorIface GtkBuildable
-GtkMenu AtkImplementorIface GtkBuildable
diff --git a/docs/reference/gtkmaskedentry.prerequisites b/docs/reference/gtkmaskedentry.prerequisites
deleted file mode 100644 (file)
index 5c1f531..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-GtkCellEditable GtkWidget
-GIcon GObject
diff --git a/docs/reference/gtkmaskedentry.signals b/docs/reference/gtkmaskedentry.signals
deleted file mode 100644 (file)
index e69de29..0000000
index 3a98c0474f3e977d3b5d635e4cd95cc3c5723c50..b4b8e76a3061602c777a522343c7aad6097652f3 100644 (file)
@@ -1,15 +1,36 @@
 INCLUDES = $(WARN_CFLAGS) \
            $(DISABLE_DEPRECATED_CFLAGS) \
-           $(GTK_CFLAGS)
+           $(GTK_CFLAGS) \
+           $(GTKFORM_CFLAGS)
 
-LIBS = $(GTK_LIBS)
+LIBS = $(GTK_LIBS) \
+       $(GTKFORM_LIBS)
 
 lib_LTLIBRARIES = libgtkmaskedentry.la
 
+if LIBGTKFORM_FOUND
+GTKFORM_C = gtkformwidgetmaskedentry.c
+GTKFORM_H = gtkformwidgetmaskedentry.h
+libgtkformmodulesdir = `pkg-config --variable=modulesdir libgtkform`
+else
+GTKFORM_C =
+GTKFORM_H =
+libgtkformmodulesdir =
+endif
+
 libgtkmaskedentry_la_SOURCES = gtkmaskedentry.c \
-                               gtkcellrenderermasked.c
+                               gtkcellrenderermasked.c \
+                               $(GTKFORM_C)
 
 libgtkmaskedentry_la_LDFLAGS = -no-undefined
 
 include_HEADERS = gtkmaskedentry.h \
-                  gtkcellrenderermasked.h
+                  gtkcellrenderermasked.h \
+                  $(GTKFORM_H)
+
+install-exec-hook:
+       cd $(libgtkformmodulesdir) && \
+       ln -s $(libdir)/libgtkmaskedentry.so .
+
+uninstall-hook:
+       rm -f $(libgtkformmodulesdir)/libgtkmaskedentry.so
diff --git a/src/gtkformwidgetmaskedentry.c b/src/gtkformwidgetmaskedentry.c
new file mode 100644 (file)
index 0000000..985b7a3
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ *
+ * 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
+ */
+
+#include <gtk/gtk.h>
+
+#include "gtkmaskedentry.h"
+#include "gtkformwidgetmaskedentry.h"
+
+enum
+{
+       PROP_0,
+       PROP_STRINGIFY_WITH_MASK
+};
+
+static void gtk_form_widget_masked_entry_class_init (GtkFormWidgetMaskedEntryClass *klass);
+static void gtk_form_widget_masked_entry_init (GtkFormWidgetMaskedEntry *gtk_form_widget_masked_entry);
+
+static void gtk_form_widget_masked_entry_set_property (GObject *object,
+                                      guint property_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec);
+static void gtk_form_widget_masked_entry_get_property (GObject *object,
+                                      guint property_id,
+                                      GValue *value,
+                                      GParamSpec *pspec);
+
+#define GTK_FORM_WIDGET_MASKED_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY, GtkFormWidgetMaskedEntryPrivate))
+
+typedef struct _GtkFormWidgetMaskedEntryPrivate GtkFormWidgetMaskedEntryPrivate;
+struct _GtkFormWidgetMaskedEntryPrivate
+       {
+               gboolean stringify_with_mask;
+       };
+
+
+G_DEFINE_TYPE (GtkFormWidgetMaskedEntry, gtk_form_widget_masked_entry, TYPE_GTK_FORM_WIDGET)
+
+static void
+gtk_form_widget_masked_entry_class_init (GtkFormWidgetMaskedEntryClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
+
+       object_class->set_property = gtk_form_widget_masked_entry_set_property;
+       object_class->get_property = gtk_form_widget_masked_entry_get_property;
+
+       widget_class->get_value_stringify = gtk_form_widget_masked_entry_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_masked_entry_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_masked_entry_set_editable;
+
+       g_object_class_install_property (object_class, PROP_STRINGIFY_WITH_MASK,
+                                        g_param_spec_boolean ("stringify-with-mask",
+                                                          "GtkFormWidgetMaskedEntry::get_value_stringify returns with mask",
+                                                          "GtkFormWidgetMaskedEntry::get_value_stringify returns with mask",
+                                                          TRUE,
+                                                          G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetMaskedEntryPrivate));
+}
+
+static void
+gtk_form_widget_masked_entry_init (GtkFormWidgetMaskedEntry *gtk_form_widget_masked_entry)
+{
+}
+
+/**
+ * gtk_form_widget_masked_entry_new:
+ *
+ * Returns: the newly created #GtkFormWidgetMaskedEntry.
+ */
+GtkFormWidget
+*gtk_form_widget_masked_entry_new ()
+{
+       return g_object_new (gtk_form_widget_masked_entry_get_type (), NULL);
+}
+
+/**
+ * gtk_form_widget_masked_entry_get_value_stringify:
+ * @widget:
+ *
+ */
+gchar
+*gtk_form_widget_masked_entry_get_value_stringify (GtkFormWidget *fwidget)
+{
+       GtkFormWidgetMaskedEntryPrivate *priv = GTK_FORM_WIDGET_MASKED_ENTRY_GET_PRIVATE (fwidget);
+
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);
+
+       if (priv->stringify_with_mask)
+               {
+                       return g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
+               }
+       else
+               {
+                       return g_strdup (gtk_masked_entry_get_text (GTK_MASKED_ENTRY (w)));
+               }
+}
+
+/**
+ * gtk_form_widget_masked_entry_set_value_stringify:
+ * @fwidget:
+ * @value:
+ *
+ */
+gboolean
+gtk_form_widget_masked_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
+{
+       gboolean ret = FALSE;
+       GtkWidget *w;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       gtk_entry_set_text (GTK_ENTRY (w), value);
+
+       ret = TRUE;
+
+       return ret;
+}
+
+/**
+ * gtk_form_widget_set_editable:
+ * @fwidget:
+ * @editable:
+ *
+ */
+void
+gtk_form_widget_masked_entry_set_editable (GtkFormWidget *fwidget, gboolean editable)
+{
+       GtkWidget *w;
+
+       g_object_get (G_OBJECT (fwidget),
+                     "widget", &w,
+                     NULL);
+
+       gtk_editable_set_editable (GTK_EDITABLE (w), editable);
+}
+
+/* PRIVATE */
+static void
+gtk_form_widget_masked_entry_set_property (GObject *object,
+                                guint property_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+       GtkFormWidgetMaskedEntry *widget_entry = (GtkFormWidgetMaskedEntry *)object;
+
+       GtkFormWidgetMaskedEntryPrivate *priv = GTK_FORM_WIDGET_MASKED_ENTRY_GET_PRIVATE (widget_entry);
+
+       switch (property_id)
+               {
+                       case PROP_STRINGIFY_WITH_MASK:
+                               priv->stringify_with_mask = g_value_get_boolean (value);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
+
+static void
+gtk_form_widget_masked_entry_get_property (GObject *object,
+                                guint property_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+       GtkFormWidgetMaskedEntry *widget_entry = (GtkFormWidgetMaskedEntry *)object;
+
+       GtkFormWidgetMaskedEntryPrivate *priv = GTK_FORM_WIDGET_MASKED_ENTRY_GET_PRIVATE (widget_entry);
+
+       switch (property_id)
+               {
+                       case PROP_STRINGIFY_WITH_MASK:
+                               g_value_set_boolean (value, priv->stringify_with_mask);
+                               break;
+
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+         }
+}
diff --git a/src/gtkformwidgetmaskedentry.h b/src/gtkformwidgetmaskedentry.h
new file mode 100644 (file)
index 0000000..1ce4c3a
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ *
+ * 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
+ */
+
+#ifndef __LIBGTK_FORM_WIDGET_ENTRY_H__
+#define __LIBGTK_FORM_WIDGET_ENTRY_H__
+
+#include <libgtkform/widget.h>
+
+
+G_BEGIN_DECLS
+
+
+#define GTK_FORM_TYPE_WIDGET_MASKED_ENTRY                 (gtk_form_widget_masked_entry_get_type ())
+#define GTK_FORM_WIDGET_MASKED_ENTRY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY, GtkFormWidgetMaskedEntry))
+#define GTK_FORM_WIDGET_MASKED_ENTRY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY, GtkFormWidgetMaskedEntryClass))
+#define GTK_FORM_IS_WIDGET_MASKED_ENTRY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY))
+#define GTK_FORM_IS_WIDGET_MASKED_ENTRY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY))
+#define GTK_FORM_WIDGET_MASKED_ENTRY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_FORM_TYPE_WIDGET_MASKED_ENTRY, GtkFormWidgetMaskedEntryClass))
+
+
+typedef struct _GtkFormWidgetMaskedEntry GtkFormWidgetMaskedEntry;
+typedef struct _GtkFormWidgetMaskedEntryClass GtkFormWidgetMaskedEntryClass;
+
+struct _GtkFormWidgetMaskedEntry
+       {
+               GtkFormWidget parent;
+       };
+
+struct _GtkFormWidgetMaskedEntryClass
+       {
+               GtkFormWidgetClass parent_class;
+       };
+
+GType gtk_form_widget_masked_entry_get_type (void) G_GNUC_CONST;
+
+GtkFormWidget *gtk_form_widget_masked_entry_new (void);
+
+gchar *gtk_form_widget_masked_entry_get_value_stringify (GtkFormWidget *widget);
+
+gboolean gtk_form_widget_masked_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
+
+void gtk_form_widget_masked_entry_set_editable (GtkFormWidget *fwidget, gboolean editable);
+
+
+G_END_DECLS
+
+
+#endif /* __LIBGTK_FORM_WIDGET_ENTRY_H__ */