gimp r24866 - in trunk: . app/widgets



Author: neo
Date: Mon Feb 11 20:19:03 2008
New Revision: 24866
URL: http://svn.gnome.org/viewvc/gimp?rev=24866&view=rev

Log:
2008-02-11  Sven Neumann  <sven gimp org>

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimplanguageentry.[ch]
	* app/widgets/gimptexteditor.c: turned language entry into a 
widget.



Added:
   trunk/app/widgets/gimplanguageentry.c
   trunk/app/widgets/gimplanguageentry.h
Modified:
   trunk/ChangeLog
   trunk/app/widgets/Makefile.am
   trunk/app/widgets/gimptexteditor.c
   trunk/app/widgets/widgets-types.h

Modified: trunk/app/widgets/Makefile.am
==============================================================================
--- trunk/app/widgets/Makefile.am	(original)
+++ trunk/app/widgets/Makefile.am	Mon Feb 11 20:19:03 2008
@@ -189,6 +189,8 @@
 	gimpimageview.h			\
 	gimpitemtreeview.c		\
 	gimpitemtreeview.h		\
+	gimplanguageentry.c		\
+	gimplanguageentry.h		\
 	gimplanguagestore.c		\
 	gimplanguagestore.h		\
 	gimplanguagestore-parser.c	\

Added: trunk/app/widgets/gimplanguageentry.c
==============================================================================
--- (empty file)
+++ trunk/app/widgets/gimplanguageentry.c	Mon Feb 11 20:19:03 2008
@@ -0,0 +1,109 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimplanguageentry.c
+ * Copyright (C) 2008  Sven Neumann <sven gimp org>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "widgets-types.h"
+
+#include "gimplanguagestore.h"
+#include "gimplanguageentry.h"
+
+
+static void   gimp_language_entry_set_property (GObject      *object,
+                                                guint         property_id,
+                                                const GValue *value,
+                                                GParamSpec   *pspec);
+static void   gimp_language_entry_get_property (GObject      *object,
+                                                guint         property_id,
+                                                GValue       *value,
+                                                GParamSpec   *pspec);
+
+
+G_DEFINE_TYPE (GimpLanguageEntry, gimp_language_entry, GTK_TYPE_ENTRY)
+
+static void
+gimp_language_entry_class_init (GimpLanguageEntryClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->set_property = gimp_language_entry_set_property;
+  object_class->get_property = gimp_language_entry_get_property;
+}
+
+static void
+gimp_language_entry_init (GimpLanguageEntry *entry)
+{
+  GtkListStore       *store;
+  GtkEntryCompletion *completion;
+
+  store = gimp_language_store_new (FALSE);
+
+  completion = g_object_new (GTK_TYPE_ENTRY_COMPLETION,
+                             "model",             store,
+                             "text-column",       GIMP_LANGUAGE_STORE_LANGUAGE,
+                             "inline-completion", TRUE,
+                             NULL);
+
+  gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+
+  g_object_unref (completion);
+  g_object_unref (store);
+}
+
+static void
+gimp_language_entry_set_property (GObject      *object,
+                                  guint         property_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
+{
+  GimpLanguageEntry *entry = GIMP_LANGUAGE_ENTRY (object);
+
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_language_entry_get_property (GObject      *object,
+                              guint         property_id,
+                              GValue       *value,
+                              GParamSpec   *pspec)
+{
+  GimpLanguageEntry *entry = GIMP_LANGUAGE_ENTRY (object);
+
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+GtkWidget *
+gimp_language_entry_new (void)
+{
+  return g_object_new (GIMP_TYPE_LANGUAGE_ENTRY, NULL);
+}

Added: trunk/app/widgets/gimplanguageentry.h
==============================================================================
--- (empty file)
+++ trunk/app/widgets/gimplanguageentry.h	Mon Feb 11 20:19:03 2008
@@ -0,0 +1,52 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimplanguageentry.h
+ * Copyright (C) 2008  Sven Neumann <sven gimp org>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_LANGUAGE_ENTRY_H__
+#define __GIMP_LANGUAGE_ENTRY_H__
+
+
+#define GIMP_TYPE_LANGUAGE_ENTRY            (gimp_language_entry_get_type ())
+#define GIMP_LANGUAGE_ENTRY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LANGUAGE_ENTRY, GimpLanguageEntry))
+#define GIMP_LANGUAGE_ENTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LANGUAGE_ENTRY, GimpLanguageEntryClass))
+#define GIMP_IS_LANGUAGE_ENTRY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LANGUAGE_ENTRY))
+#define GIMP_IS_LANGUAGE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LANGUAGE_ENTRY))
+#define GIMP_LANGUAGE_ENTRY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LANGUAGE_ENTRY, GimpLanguageEntryClass))
+
+
+typedef struct _GimpLanguageEntryClass  GimpLanguageEntryClass;
+
+struct _GimpLanguageEntryClass
+{
+  GtkEntryClass  parent_class;
+};
+
+struct _GimpLanguageEntry
+{
+  GtkEntry       parent_instance;
+};
+
+
+GType       gimp_language_entry_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_language_entry_new      (void);
+
+
+#endif  /* __GIMP_LANGUAGE_ENTRY_H__ */

Modified: trunk/app/widgets/gimptexteditor.c
==============================================================================
--- trunk/app/widgets/gimptexteditor.c	(original)
+++ trunk/app/widgets/gimptexteditor.c	Mon Feb 11 20:19:03 2008
@@ -31,7 +31,7 @@
 
 #include "gimphelp-ids.h"
 #include "gimpmenufactory.h"
-#include "gimplanguagestore.h"
+#include "gimplanguageentry.h"
 #include "gimptexteditor.h"
 #include "gimpuimanager.h"
 
@@ -46,14 +46,12 @@
 };
 
 
-static void        gimp_text_editor_finalize           (GObject         *object);
+static void   gimp_text_editor_finalize     (GObject         *object);
 
-static GtkWidget * gimp_text_editor_language_entry_new (void);
-
-static void        gimp_text_editor_text_changed       (GtkTextBuffer   *buffer,
-                                                        GimpTextEditor  *editor);
-static void        gimp_text_editor_font_toggled       (GtkToggleButton *button,
-                                                        GimpTextEditor  *editor);
+static void   gimp_text_editor_text_changed (GtkTextBuffer   *buffer,
+                                             GimpTextEditor  *editor);
+static void   gimp_text_editor_font_toggled (GtkToggleButton *button,
+                                             GimpTextEditor  *editor);
 
 
 G_DEFINE_TYPE (GimpTextEditor, gimp_text_editor, GIMP_TYPE_DIALOG)
@@ -188,7 +186,7 @@
       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
       gtk_widget_show (label);
 
-      entry = gimp_text_editor_language_entry_new ();
+      entry = gimp_language_entry_new ();
       gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
       gtk_widget_show (entry);
 
@@ -352,30 +350,6 @@
 
 /*  private functions  */
 
-static GtkWidget *
-gimp_text_editor_language_entry_new (void)
-{
-  GtkWidget          *entry;
-  GtkListStore       *store;
-  GtkEntryCompletion *completion;
-
-  entry = gtk_entry_new ();
-
-  completion = gtk_entry_completion_new ();
-  gtk_entry_completion_set_text_column (completion,
-                                        GIMP_LANGUAGE_STORE_LANGUAGE);
-  gtk_entry_completion_set_inline_completion (completion, TRUE);
-
-  store = gimp_language_store_new (FALSE);
-  gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (store));
-  g_object_unref (store);
-
-  gtk_entry_set_completion (GTK_ENTRY (entry), completion);
-  g_object_unref (completion);
-
-  return entry;
-}
-
 static void
 gimp_text_editor_text_changed (GtkTextBuffer  *buffer,
                                GimpTextEditor *editor)

Modified: trunk/app/widgets/widgets-types.h
==============================================================================
--- trunk/app/widgets/widgets-types.h	(original)
+++ trunk/app/widgets/widgets-types.h	Mon Feb 11 20:19:03 2008
@@ -170,12 +170,16 @@
 typedef struct _GimpImageParasiteView        GimpImageParasiteView;
 typedef struct _GimpImagePropView            GimpImagePropView;
 typedef struct _GimpImageProfileView         GimpImageProfileView;
+typedef struct _GimpLanguageStore            GimpLanguageStore;
+typedef struct _GimpLanguageEntry            GimpLanguageEntry;
 typedef struct _GimpMessageBox               GimpMessageBox;
 typedef struct _GimpProgressBox              GimpProgressBox;
 typedef struct _GimpSizeBox                  GimpSizeBox;
 typedef struct _GimpStrokeEditor             GimpStrokeEditor;
 typedef struct _GimpTemplateEditor           GimpTemplateEditor;
 typedef struct _GimpThumbBox                 GimpThumbBox;
+typedef struct _GimpUnitStore                GimpUnitStore;
+typedef struct _GimpUnitComboBox             GimpUnitComboBox;
 
 
 /*  views  */
@@ -208,9 +212,6 @@
 /*  misc utilities & constructors  */
 
 typedef struct _GimpDialogFactory            GimpDialogFactory;
-typedef struct _GimpLanguageStore            GimpLanguageStore;
-typedef struct _GimpUnitStore                GimpUnitStore;
-typedef struct _GimpUnitComboBox             GimpUnitComboBox;
 
 
 /*  structs  */



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