summaryrefslogtreecommitdiff
path: root/egg
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-10-12 16:54:02 +0200
committerStef Walter <stefw@gnome.org>2012-10-17 10:10:49 +0200
commit408f6ee72fc08697003c1aa811b1657f5c673878 (patch)
treefe1141fd5dec31248ce394816f4628889318d401 /egg
parentfe3781f822251b047d1456d0af435d3536b104c5 (diff)
Remove dependency on gtk+
* We depend on gcr which has a dependency on gtk+ but we don't need to depend on it expcilitly. * Remove unused egg-secure-buffer.[ch] code. https://bugzilla.gnome.org/show_bug.cgi?id=686035
Diffstat (limited to 'egg')
-rw-r--r--egg/Makefile.am9
-rw-r--r--egg/egg-entry-buffer.c200
-rw-r--r--egg/egg-entry-buffer.h59
3 files changed, 0 insertions, 268 deletions
diff --git a/egg/Makefile.am b/egg/Makefile.am
index b43b4a65..fe08886a 100644
--- a/egg/Makefile.am
+++ b/egg/Makefile.am
@@ -8,7 +8,6 @@ noinst_LTLIBRARIES = \
libegg-dbus.la \
libegg-secure.la \
libegg-prompt.la \
- libegg-entry-buffer.la \
libegg-hex.la \
libegg-test.la
@@ -77,14 +76,6 @@ libegg_asn1x_la_CFLAGS = \
libegg_secure_la_SOURCES = \
egg-secure-memory.c egg-secure-memory.h
-libegg_entry_buffer_la_SOURCES = \
- egg-entry-buffer.c egg-entry-buffer.h
-
-libegg_entry_buffer_la_CFLAGS = \
- $(GOBJECT_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GTK_CFLAGS)
-
libegg_buffer_la_SOURCES = \
egg-buffer.c egg-buffer.h
diff --git a/egg/egg-entry-buffer.c b/egg/egg-entry-buffer.c
deleted file mode 100644
index cac1f2d3..00000000
--- a/egg/egg-entry-buffer.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* egg-secure-buffer.c - secure memory gtkentry buffer
-
- Copyright (C) 2009 Stefan Walter
-
- The Gnome Keyring Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Keyring 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Stef Walter <stef@memberwebs.com>
-*/
-
-#include "config.h"
-
-#include "egg-entry-buffer.h"
-#include "egg-secure-memory.h"
-
-#include <string.h>
-
-EGG_SECURE_DECLARE (entry_buffer);
-
-/* Initial size of buffer, in bytes */
-#define MIN_SIZE 16
-
-struct _EggEntryBufferPrivate
-{
- gchar *text;
- gsize text_size;
- gsize text_bytes;
- guint text_chars;
-};
-
-G_DEFINE_TYPE (EggEntryBuffer, egg_entry_buffer, GTK_TYPE_ENTRY_BUFFER);
-
-/* --------------------------------------------------------------------------------
- * SECURE IMPLEMENTATIONS OF TEXT BUFFER
- */
-
-static const gchar*
-egg_entry_buffer_real_get_text (GtkEntryBuffer *buffer, gsize *n_bytes)
-{
- EggEntryBuffer *self = EGG_ENTRY_BUFFER (buffer);
- if (n_bytes)
- *n_bytes = self->priv->text_bytes;
- if (!self->priv->text)
- return "";
- return self->priv->text;
-}
-
-static guint
-egg_entry_buffer_real_get_length (GtkEntryBuffer *buffer)
-{
- EggEntryBuffer *self = EGG_ENTRY_BUFFER (buffer);
- return self->priv->text_chars;
-}
-
-static guint
-egg_entry_buffer_real_insert_text (GtkEntryBuffer *buffer, guint position,
- const gchar *chars, guint n_chars)
-{
- EggEntryBuffer *self = EGG_ENTRY_BUFFER (buffer);
- EggEntryBufferPrivate *pv = self->priv;
- gsize n_bytes;
- gsize at;
-
- n_bytes = g_utf8_offset_to_pointer (chars, n_chars) - chars;
-
- /* Need more memory */
- if (n_bytes + pv->text_bytes + 1 > pv->text_size) {
-
- /* Calculate our new buffer size */
- while (n_bytes + pv->text_bytes + 1 > pv->text_size) {
- if (pv->text_size == 0) {
- pv->text_size = MIN_SIZE;
- } else {
- if (2 * pv->text_size < GTK_ENTRY_BUFFER_MAX_SIZE) {
- pv->text_size *= 2;
- } else {
- pv->text_size = GTK_ENTRY_BUFFER_MAX_SIZE;
- if (n_bytes > pv->text_size - pv->text_bytes - 1) {
- n_bytes = pv->text_size - pv->text_bytes - 1;
- n_bytes = g_utf8_find_prev_char (chars, chars + n_bytes + 1) - chars;
- n_chars = g_utf8_strlen (chars, n_bytes);
- }
- break;
- }
- }
- }
-
- pv->text = egg_secure_realloc (pv->text, pv->text_size);
- }
-
- /* Actual text insertion */
- at = g_utf8_offset_to_pointer (pv->text, position) - pv->text;
- g_memmove (pv->text + at + n_bytes, pv->text + at, pv->text_bytes - at);
- memcpy (pv->text + at, chars, n_bytes);
-
- /* Book keeping */
- pv->text_bytes += n_bytes;
- pv->text_chars += n_chars;
- pv->text[pv->text_bytes] = '\0';
-
- gtk_entry_buffer_emit_inserted_text (buffer, position, chars, n_chars);
- return n_chars;
-}
-
-static guint
-egg_entry_buffer_real_delete_text (GtkEntryBuffer *buffer, guint position, guint n_chars)
-{
- EggEntryBuffer *self = EGG_ENTRY_BUFFER (buffer);
- EggEntryBufferPrivate *pv = self->priv;
- gsize start, end;
-
- if (position > pv->text_chars)
- position = pv->text_chars;
- if (position + n_chars > pv->text_chars)
- n_chars = pv->text_chars - position;
-
- if (n_chars > 0) {
- start = g_utf8_offset_to_pointer (pv->text, position) - pv->text;
- end = g_utf8_offset_to_pointer (pv->text, position + n_chars) - pv->text;
-
- g_memmove (pv->text + start, pv->text + end, pv->text_bytes + 1 - end);
- pv->text_chars -= n_chars;
- pv->text_bytes -= (end - start);
-
- gtk_entry_buffer_emit_deleted_text (buffer, position, n_chars);
- }
-
- return n_chars;
-}
-
-/* --------------------------------------------------------------------------------
- *
- */
-
-static void
-egg_entry_buffer_init (EggEntryBuffer *self)
-{
- EggEntryBufferPrivate *pv;
- pv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EGG_TYPE_ENTRY_BUFFER, EggEntryBufferPrivate);
-
- pv->text = NULL;
- pv->text_chars = 0;
- pv->text_bytes = 0;
- pv->text_size = 0;
-}
-
-static void
-egg_entry_buffer_finalize (GObject *obj)
-{
- EggEntryBuffer *self = EGG_ENTRY_BUFFER (obj);
- EggEntryBufferPrivate *pv = self->priv;
-
- if (pv->text) {
- egg_secure_strfree (pv->text);
- pv->text = NULL;
- pv->text_bytes = pv->text_size = 0;
- pv->text_chars = 0;
- }
-
- G_OBJECT_CLASS (egg_entry_buffer_parent_class)->finalize (obj);
-}
-
-static void
-egg_entry_buffer_class_init (EggEntryBufferClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkEntryBufferClass *buffer_class = GTK_ENTRY_BUFFER_CLASS (klass);
-
- gobject_class->finalize = egg_entry_buffer_finalize;
-
- buffer_class->get_text = egg_entry_buffer_real_get_text;
- buffer_class->get_length = egg_entry_buffer_real_get_length;
- buffer_class->insert_text = egg_entry_buffer_real_insert_text;
- buffer_class->delete_text = egg_entry_buffer_real_delete_text;
-
- g_type_class_add_private (gobject_class, sizeof (EggEntryBufferPrivate));
-}
-
-/* --------------------------------------------------------------------------------
- *
- */
-
-GtkEntryBuffer*
-egg_entry_buffer_new (void)
-{
- return g_object_new (EGG_TYPE_ENTRY_BUFFER, NULL);
-}
diff --git a/egg/egg-entry-buffer.h b/egg/egg-entry-buffer.h
deleted file mode 100644
index 1a7208d6..00000000
--- a/egg/egg-entry-buffer.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* egg-secure-buffer.h - secure memory gtkentry buffer
-
- Copyright (C) 2009 Stefan Walter
-
- The Gnome Keyring Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Keyring 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Stef Walter <stef@memberwebs.com>
-*/
-
-#ifndef __EGG_ENTRY_BUFFER_H__
-#define __EGG_ENTRY_BUFFER_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_ENTRY_BUFFER (egg_entry_buffer_get_type ())
-#define EGG_ENTRY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_ENTRY_BUFFER, EggEntryBuffer))
-#define EGG_ENTRY_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_ENTRY_BUFFER, EggEntryBufferClass))
-#define EGG_IS_ENTRY_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_ENTRY_BUFFER))
-#define EGG_IS_ENTRY_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_ENTRY_BUFFER))
-#define EGG_ENTRY_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_ENTRY_BUFFER, EggEntryBufferClass))
-
-typedef struct _EggEntryBuffer EggEntryBuffer;
-typedef struct _EggEntryBufferClass EggEntryBufferClass;
-typedef struct _EggEntryBufferPrivate EggEntryBufferPrivate;
-
-struct _EggEntryBuffer
-{
- GtkEntryBuffer parent;
- EggEntryBufferPrivate *priv;
-};
-
-struct _EggEntryBufferClass
-{
- GtkEntryBufferClass parent_class;
-};
-
-GType egg_entry_buffer_get_type (void) G_GNUC_CONST;
-
-GtkEntryBuffer* egg_entry_buffer_new (void);
-
-G_END_DECLS
-
-#endif /* __EGG_ENTRY_BUFFER_H__ */