aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-09-05 01:04:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-10-06 20:16:21 +0800
commitef05d73b0a06cfc5eaf1a74c7b5c25134d81e328 (patch)
treef500ff7dda030e1ee0fb7d79f639a9b0422ac8a9 /widgets
parent0e064de971dd8b5e565558cd14efdca8ae4dbcb0 (diff)
downloadgsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar.gz
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar.bz2
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar.lz
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar.xz
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.tar.zst
gsoc2013-evolution-ef05d73b0a06cfc5eaf1a74c7b5c25134d81e328.zip
Remove EHintedEntry.
GtkEntry in GTK+ 3.2 now provides this functionality through the new GtkEntry:placeholder-text property.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/Makefile.am2
-rw-r--r--widgets/misc/e-hinted-entry.c293
-rw-r--r--widgets/misc/e-hinted-entry.h73
3 files changed, 0 insertions, 368 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index cd5cada041..79bc14bcbe 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -38,7 +38,6 @@ widgetsinclude_HEADERS = \
e-contact-marker.h \
e-dateedit.h \
e-focus-tracker.h \
- e-hinted-entry.h \
e-image-chooser.h \
e-import-assistant.h \
e-map.h \
@@ -123,7 +122,6 @@ libemiscwidgets_la_SOURCES = \
e-contact-marker.c \
e-dateedit.c \
e-focus-tracker.c \
- e-hinted-entry.c \
e-image-chooser.c \
e-import-assistant.c \
e-map.c \
diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c
deleted file mode 100644
index 21a4fff58e..0000000000
--- a/widgets/misc/e-hinted-entry.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * e-hinted-entry.c
- *
- * This program 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 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-hinted-entry.h"
-
-struct _EHintedEntryPrivate {
- gchar *hint;
- guint hint_shown : 1;
-};
-
-enum {
- PROP_0,
- PROP_HINT,
- PROP_HINT_SHOWN
-};
-
-G_DEFINE_TYPE (
- EHintedEntry,
- e_hinted_entry,
- GTK_TYPE_ENTRY)
-
-static void
-hinted_entry_show_hint (EHintedEntry *entry)
-{
- GtkStyle *style;
- const GdkColor *color;
- const gchar *hint;
-
- entry->priv->hint_shown = TRUE;
-
- hint = e_hinted_entry_get_hint (entry);
- gtk_entry_set_text (GTK_ENTRY (entry), hint);
-
- style = gtk_widget_get_style (GTK_WIDGET (entry));
- color = &style->text[GTK_STATE_INSENSITIVE];
- gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, color);
-
- g_object_notify (G_OBJECT (entry), "hint-shown");
-}
-
-static void
-hinted_entry_show_text (EHintedEntry *entry,
- const gchar *text)
-{
- entry->priv->hint_shown = FALSE;
-
- gtk_entry_set_text (GTK_ENTRY (entry), text);
-
- gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
-
- g_object_notify (G_OBJECT (entry), "hint-shown");
-}
-
-static void
-hinted_entry_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_HINT:
- e_hinted_entry_set_hint (
- E_HINTED_ENTRY (object),
- g_value_get_string (value));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-hinted_entry_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_HINT:
- g_value_set_string (
- value, e_hinted_entry_get_hint (
- E_HINTED_ENTRY (object)));
- return;
-
- case PROP_HINT_SHOWN:
- g_value_set_boolean (
- value, e_hinted_entry_get_hint_shown (
- E_HINTED_ENTRY (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-hinted_entry_finalize (GObject *object)
-{
- EHintedEntryPrivate *priv;
-
- priv = E_HINTED_ENTRY (object)->priv;
-
- g_free (priv->hint);
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (e_hinted_entry_parent_class)->finalize (object);
-}
-
-static void
-hinted_entry_grab_focus (GtkWidget *widget)
-{
- GtkWidgetClass *chain_class;
-
- /* We don't want hints to be selected so we chain to
- * the GtkEntry parent if we have a hint set */
- chain_class = e_hinted_entry_parent_class;
- if (e_hinted_entry_get_hint_shown (E_HINTED_ENTRY (widget)))
- chain_class = g_type_class_peek_parent (chain_class);
-
- /* Chain up to parent's grab_focus() method. */
- GTK_WIDGET_CLASS (chain_class)->grab_focus (widget);
-}
-
-static gboolean
-hinted_entry_focus_in_event (GtkWidget *widget,
- GdkEventFocus *event)
-{
- EHintedEntry *entry = E_HINTED_ENTRY (widget);
-
- if (e_hinted_entry_get_hint_shown (entry))
- hinted_entry_show_text (entry, "");
-
- /* Chain up to parent's focus_in_event() method. */
- return GTK_WIDGET_CLASS (e_hinted_entry_parent_class)->
- focus_in_event (widget, event);
-}
-
-static gboolean
-hinted_entry_focus_out_event (GtkWidget *widget,
- GdkEventFocus *event)
-{
- EHintedEntry *entry = E_HINTED_ENTRY (widget);
- const gchar *text;
-
- text = e_hinted_entry_get_text (entry);
-
- if (text == NULL || *text == '\0')
- hinted_entry_show_hint (E_HINTED_ENTRY (widget));
-
- /* Chain up to parent's focus_out_event() method. */
- return GTK_WIDGET_CLASS (e_hinted_entry_parent_class)->
- focus_out_event (widget, event);
-}
-
-static void
-e_hinted_entry_class_init (EHintedEntryClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- g_type_class_add_private (class, sizeof (EHintedEntryPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->set_property = hinted_entry_set_property;
- object_class->get_property = hinted_entry_get_property;
- object_class->finalize = hinted_entry_finalize;
-
- widget_class = GTK_WIDGET_CLASS (class);
- widget_class->grab_focus = hinted_entry_grab_focus;
- widget_class->focus_in_event = hinted_entry_focus_in_event;
- widget_class->focus_out_event = hinted_entry_focus_out_event;
-
- g_object_class_install_property (
- object_class,
- PROP_HINT,
- g_param_spec_string (
- "hint",
- "Hint",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_HINT_SHOWN,
- g_param_spec_boolean (
- "hint-shown",
- "Hint Shown",
- NULL,
- FALSE,
- G_PARAM_READABLE));
-}
-
-static void
-e_hinted_entry_init (EHintedEntry *entry)
-{
- entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- entry, E_TYPE_HINTED_ENTRY, EHintedEntryPrivate);
- entry->priv->hint = g_strdup (""); /* hint must never be NULL */
- hinted_entry_show_hint (entry);
-}
-
-GtkWidget *
-e_hinted_entry_new (void)
-{
- return g_object_new (E_TYPE_HINTED_ENTRY, NULL);
-}
-
-const gchar *
-e_hinted_entry_get_hint (EHintedEntry *entry)
-{
- g_return_val_if_fail (E_IS_HINTED_ENTRY (entry), NULL);
-
- return entry->priv->hint;
-}
-
-void
-e_hinted_entry_set_hint (EHintedEntry *entry,
- const gchar *hint)
-{
- g_return_if_fail (E_IS_HINTED_ENTRY (entry));
-
- if (hint == NULL)
- hint = "";
-
- g_free (entry->priv->hint);
- entry->priv->hint = g_strdup (hint);
-
- if (e_hinted_entry_get_hint_shown (entry))
- gtk_entry_set_text (GTK_ENTRY (entry), hint);
-
- g_object_notify (G_OBJECT (entry), "hint");
-}
-
-gboolean
-e_hinted_entry_get_hint_shown (EHintedEntry *entry)
-{
- g_return_val_if_fail (E_IS_HINTED_ENTRY (entry), FALSE);
-
- return entry->priv->hint_shown;
-}
-
-const gchar *
-e_hinted_entry_get_text (EHintedEntry *entry)
-{
- const gchar *text = "";
-
- /* XXX This clumsily overrides gtk_entry_get_text(). */
-
- g_return_val_if_fail (E_IS_HINTED_ENTRY (entry), NULL);
-
- if (!e_hinted_entry_get_hint_shown (entry))
- text = gtk_entry_get_text (GTK_ENTRY (entry));
-
- return text;
-}
-
-void
-e_hinted_entry_set_text (EHintedEntry *entry,
- const gchar *text)
-{
- /* XXX This clumsily overrides gtk_entry_set_text(). */
-
- g_return_if_fail (E_IS_HINTED_ENTRY (entry));
-
- if (text == NULL)
- text = "";
-
- if (*text == '\0' && !gtk_widget_has_focus (GTK_WIDGET (entry)))
- hinted_entry_show_hint (entry);
- else
- hinted_entry_show_text (entry, text);
-}
diff --git a/widgets/misc/e-hinted-entry.h b/widgets/misc/e-hinted-entry.h
deleted file mode 100644
index 02379d4ad7..0000000000
--- a/widgets/misc/e-hinted-entry.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * e-hinted-entry.h
- *
- * This program 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 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef E_HINTED_ENTRY_H
-#define E_HINTED_ENTRY_H
-
-#include <gtk/gtk.h>
-
-/* Standard GObject macros */
-#define E_TYPE_HINTED_ENTRY \
- (e_hinted_entry_get_type ())
-#define E_HINTED_ENTRY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), E_TYPE_HINTED_ENTRY, EHintedEntry))
-#define E_HINTED_ENTRY_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_CAST \
- ((cls), E_TYPE_HINTED_ENTRY, EHintedEntryClass))
-#define E_IS_HINTED_ENTRY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), E_TYPE_HINTED_ENTRY))
-#define E_IS_HINTED_ENTRY_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_TYPE \
- ((cls), E_TYPE_HINTED_ENTRY))
-#define E_HINTED_ENTRY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), E_TYPE_HINTED_ENTRY, EHintedEntryClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EHintedEntry EHintedEntry;
-typedef struct _EHintedEntryClass EHintedEntryClass;
-typedef struct _EHintedEntryPrivate EHintedEntryPrivate;
-
-struct _EHintedEntry {
- GtkEntry parent;
- EHintedEntryPrivate *priv;
-};
-
-struct _EHintedEntryClass {
- GtkEntryClass parent_class;
-};
-
-GType e_hinted_entry_get_type (void);
-GtkWidget * e_hinted_entry_new (void);
-const gchar * e_hinted_entry_get_hint (EHintedEntry *entry);
-void e_hinted_entry_set_hint (EHintedEntry *entry,
- const gchar *hint);
-gboolean e_hinted_entry_get_hint_shown (EHintedEntry *entry);
-const gchar * e_hinted_entry_get_text (EHintedEntry *entry);
-void e_hinted_entry_set_text (EHintedEntry *entry,
- const gchar *text);
-
-G_END_DECLS
-
-#endif /* E_HINTED_ENTRY_H */