[seahorse] Debug changes and fixes
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Debug changes and fixes
- Date: Mon, 25 Jul 2011 17:45:47 +0000 (UTC)
commit 8ce2a2f0636d48499d385def4d80301eb30bf142
Author: Stef Walter <stefw collabora co uk>
Date: Mon Jul 25 18:43:56 2011 +0200
Debug changes and fixes
* Use --enable-debug=yes to enable passive debug message code (default).
* Use --disable-debug to disable all debug code.
* Use --enable-debug=full to enable debug compilation and extras.
configure.ac | 40 ++++++++++++++++++++++------------
gkr/seahorse-gkr-add-item.c | 5 +--
gkr/seahorse-gkr-dialogs.c | 3 +-
gkr/seahorse-gkr-keyring-commands.c | 6 -----
libegg/egg-datetime.c | 19 +++++++++------
libseahorse/seahorse-commands.c | 17 --------------
libseahorse/seahorse-context.c | 19 ----------------
libseahorse/seahorse-object-widget.c | 6 +---
libseahorse/seahorse-passphrase.c | 3 --
libseahorse/seahorse-util.c | 2 +-
pgp/seahorse-gpg-options.c | 4 +--
pgp/seahorse-gpgme-source.c | 5 ----
pgp/seahorse-pgp-key-properties.c | 9 +------
pgp/seahorse-server-source.c | 7 +-----
ssh/seahorse-ssh-askpass.c | 6 ++--
15 files changed, 50 insertions(+), 101 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b9803c0..503af18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,7 +222,7 @@ if test "$try_ldap" = yes ; then
LIBS="$MY_LDAPLIBS $NETLIBS $LIBS"
AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
- AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234);],
+ AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234); ber_free(NULL, 0);],
[cv_func_ldap_init=yes],[cv_func_ldap_init=no])
AC_MSG_RESULT([$cv_func_ldap_init])
@@ -425,22 +425,34 @@ fi
AM_CONDITIONAL(WITH_SSH, test "$enable_ssh" = "yes")
-dnl ****************************************************************************
-
+# -----------------------------------------------------------------------------
# Debug mode
-AC_ARG_ENABLE(debug,
- AC_HELP_STRING([--enable-debug],
- [Compile binaries in debug mode]))
-
-if test "$enable_debug" = "yes"; then
- CFLAGS="$CFLAGS -g -O0 -DBONOBO_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -Wall"
- AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
- echo "enabling debug compile mode"
-else
- dnl AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
- echo "disabling debug compile mode"
+#
+
+AC_MSG_CHECKING([for debug mode])
+AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug=no/yes/full],
+ [Turn on or off debugging]))
+
+if test "$enable_debug" != "no"; then
+ AC_DEFINE_UNQUOTED(WITH_DEBUG, 1, [Print debug output])
+ AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
fi
+if test "$enable_debug" = "full"; then
+ debug_status="full"
+ CFLAGS="$CFLAGS -g -O0 -Werror -Wall"
+ CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED"
+ CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
+elif test "$enable_debug" = "no"; then
+ debug_status="no"
+ AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
+else
+ debug_status="yes"
+fi
+
+AC_MSG_RESULT($debug_status)
+
# Fatal Messages mode
AC_ARG_ENABLE(fatal-messages,
AC_HELP_STRING([--enable-fatal-messages],
diff --git a/gkr/seahorse-gkr-add-item.c b/gkr/seahorse-gkr-add-item.c
index 182ed00..4c9ba79 100644
--- a/gkr/seahorse-gkr-add-item.c
+++ b/gkr/seahorse-gkr-add-item.c
@@ -136,8 +136,7 @@ seahorse_gkr_add_item_show (GtkWindow *parent)
GtkCellRenderer *cell;
GtkListStore *store;
GtkTreeIter iter;
- gint i;
-
+
swidget = seahorse_widget_new_allow_multiple ("gkr-add-item", parent);
g_return_if_fail (swidget);
@@ -151,7 +150,7 @@ seahorse_gkr_add_item_show (GtkWindow *parent)
keyrings = seahorse_context_find_objects (NULL, SEAHORSE_GKR, SEAHORSE_USAGE_OTHER,
SEAHORSE_LOCATION_LOCAL);
- for (i = 0, l = keyrings; l; l = g_list_next (l)) {
+ for (l = keyrings; l; l = g_list_next (l)) {
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, seahorse_gkr_keyring_get_name (l->data), -1);
if (seahorse_gkr_keyring_get_is_default (l->data))
diff --git a/gkr/seahorse-gkr-dialogs.c b/gkr/seahorse-gkr-dialogs.c
index 1c3eca3..5ab8528 100644
--- a/gkr/seahorse-gkr-dialogs.c
+++ b/gkr/seahorse-gkr-dialogs.c
@@ -44,8 +44,7 @@ update_wait_cursor (GtkWidget *dialog, gpointer unused)
cursor = (GdkCursor*)g_object_get_data (G_OBJECT (dialog), "wait-cursor");
if (!cursor) {
cursor = gdk_cursor_new (GDK_WATCH);
- g_object_set_data_full (G_OBJECT (dialog), "wait-cursor", cursor,
- (GDestroyNotify)gdk_cursor_unref);
+ g_object_set_data_full (G_OBJECT (dialog), "wait-cursor", cursor, g_object_unref);
}
/* Indicate that we're loading stuff */
diff --git a/gkr/seahorse-gkr-keyring-commands.c b/gkr/seahorse-gkr-keyring-commands.c
index 3a3ce30..ef26d70 100644
--- a/gkr/seahorse-gkr-keyring-commands.c
+++ b/gkr/seahorse-gkr-keyring-commands.c
@@ -144,7 +144,6 @@ static void
on_keyring_unlock (GtkAction *action, SeahorseGkrKeyringCommands *self)
{
SeahorseView *view;
- SeahorseGkrKeyring *keyring;
GList *keys, *l;
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING_COMMANDS (self));
@@ -154,7 +153,6 @@ on_keyring_unlock (GtkAction *action, SeahorseGkrKeyringCommands *self)
keys = seahorse_view_get_selected_matching (view, &keyring_predicate);
for (l = keys; l; l = g_list_next (l)) {
- keyring = SEAHORSE_GKR_KEYRING (l->data);
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING (l->data));
gnome_keyring_unlock (seahorse_gkr_keyring_get_name (l->data), NULL,
on_keyring_unlock_done, g_object_ref (self), g_object_unref);
@@ -185,7 +183,6 @@ static void
on_keyring_lock (GtkAction *action, SeahorseGkrKeyringCommands *self)
{
SeahorseView *view;
- SeahorseGkrKeyring *keyring;
GList *keyrings, *l;
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING_COMMANDS (self));
@@ -195,7 +192,6 @@ on_keyring_lock (GtkAction *action, SeahorseGkrKeyringCommands *self)
keyrings = seahorse_view_get_selected_matching (view, &keyring_predicate);
for (l = keyrings; l; l = g_list_next (l)) {
- keyring = SEAHORSE_GKR_KEYRING (l->data);
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING (l->data));
gnome_keyring_lock (seahorse_gkr_keyring_get_name (l->data),
on_keyring_lock_done, g_object_ref (self), g_object_unref);
@@ -265,7 +261,6 @@ static void
on_keyring_password (GtkAction *action, SeahorseGkrKeyringCommands *self)
{
SeahorseView *view;
- SeahorseGkrKeyring *keyring;
GList *keys, *l;
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING_COMMANDS (self));
@@ -275,7 +270,6 @@ on_keyring_password (GtkAction *action, SeahorseGkrKeyringCommands *self)
keys = seahorse_view_get_selected_matching (view, &keyring_predicate);
for (l = keys; l; l = g_list_next (l)) {
- keyring = SEAHORSE_GKR_KEYRING (l->data);
g_return_if_fail (SEAHORSE_IS_GKR_KEYRING (l->data));
gnome_keyring_change_password (seahorse_gkr_keyring_get_name (l->data), NULL, NULL,
on_change_password_done, g_object_ref (self), g_object_unref);
diff --git a/libegg/egg-datetime.c b/libegg/egg-datetime.c
index 6e52f5f..15303b5 100644
--- a/libegg/egg-datetime.c
+++ b/libegg/egg-datetime.c
@@ -827,7 +827,7 @@ popup_position (GtkWidget *widget, GtkWindow *popup)
GtkRequisition requisition;
gint x, y, width, height;
- gtk_widget_size_request (GTK_WIDGET (popup), &requisition);
+ gtk_widget_get_preferred_size (GTK_WIDGET (popup), &requisition, NULL);
gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
gtk_widget_get_allocation (widget, &allocation);
@@ -857,12 +857,14 @@ popup_show (GtkWindow *popup)
gtk_grab_add (GTK_WIDGET (popup));
cursor = gdk_cursor_new (GDK_ARROW);
- gdk_pointer_grab (gtk_widget_get_window (GTK_WIDGET (popup)), TRUE,
- (GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_POINTER_MOTION_MASK),
- NULL, cursor, GDK_CURRENT_TIME);
- gdk_cursor_unref (cursor);
+ gdk_device_grab (gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_display_get_default ())),
+ gtk_widget_get_window (GTK_WIDGET (popup)),
+ GDK_OWNERSHIP_APPLICATION,
+ TRUE,
+ (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK),
+ cursor,
+ GDK_CURRENT_TIME);
+ g_object_unref (cursor);
}
static void
@@ -870,7 +872,8 @@ popup_hide (GtkWindow *popup)
{
gtk_widget_hide (GTK_WIDGET (popup));
gtk_grab_remove (GTK_WIDGET (popup));
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ gdk_device_ungrab (gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_display_get_default ())),
+ GDK_CURRENT_TIME);
}
/*
diff --git a/libseahorse/seahorse-commands.c b/libseahorse/seahorse-commands.c
index a9106c8..9904b04 100644
--- a/libseahorse/seahorse-commands.c
+++ b/libseahorse/seahorse-commands.c
@@ -60,22 +60,6 @@ seahorse_commands_real_delete_objects (SeahorseCommands* self, GList* obj)
return NULL;
}
-static GObject*
-seahorse_commands_constructor (GType type, guint n_props, GObjectConstructParam *props)
-{
- GObject *obj = G_OBJECT_CLASS (seahorse_commands_parent_class)->constructor (type, n_props, props);
- SeahorseCommands *self = NULL;
- SeahorseCommandsPrivate *pv;
-
- if (obj) {
- pv = SEAHORSE_COMMANDS_GET_PRIVATE (obj);
- self = SEAHORSE_COMMANDS (obj);
-
- }
-
- return obj;
-}
-
static void
seahorse_commands_init (SeahorseCommands *self)
{
@@ -147,7 +131,6 @@ seahorse_commands_class_init (SeahorseCommandsClass *klass)
seahorse_commands_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorseCommandsPrivate));
- gobject_class->constructor = seahorse_commands_constructor;
gobject_class->dispose = seahorse_commands_dispose;
gobject_class->finalize = seahorse_commands_finalize;
gobject_class->set_property = seahorse_commands_set_property;
diff --git a/libseahorse/seahorse-context.c b/libseahorse/seahorse-context.c
index 04a033d..353857a 100644
--- a/libseahorse/seahorse-context.c
+++ b/libseahorse/seahorse-context.c
@@ -968,25 +968,6 @@ seahorse_context_find_objects (SeahorseContext *sctx, GQuark ktype,
}
/**
-* key: a pointer to a key to verify (hashkey)
-* value: a seahorse object
-* user_data: ignored
-*
-* Asserts that the @key is the same as the one stored in @value
-*
-**/
-static void
-verify_each_object (gpointer key, gpointer value, gpointer user_data)
-{
- gpointer k;
-
- g_assert (SEAHORSE_IS_OBJECT (value));
- k = hashkey_by_source (seahorse_object_get_source (value),
- seahorse_object_get_id (value));
- g_assert (k == key);
-}
-
-/**
* seahorse_context_remove_object:
* @sctx: The #SeahorseContext (can be NULL)
* @sobj: The #SeahorseObject to remove
diff --git a/libseahorse/seahorse-object-widget.c b/libseahorse/seahorse-object-widget.c
index 551b494..024e17d 100644
--- a/libseahorse/seahorse-object-widget.c
+++ b/libseahorse/seahorse-object-widget.c
@@ -141,11 +141,9 @@ seahorse_object_widget_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
SeahorseObjectWidget *self;
- SeahorseWidget *swidget;
-
+
self = SEAHORSE_OBJECT_WIDGET (object);
- swidget = SEAHORSE_WIDGET (object);
-
+
switch (prop_id) {
/* Watches object for destroy */
case PROP_OBJECT:
diff --git a/libseahorse/seahorse-passphrase.c b/libseahorse/seahorse-passphrase.c
index ea84c90..44eec78 100644
--- a/libseahorse/seahorse-passphrase.c
+++ b/libseahorse/seahorse-passphrase.c
@@ -187,7 +187,6 @@ seahorse_passphrase_prompt_show (const gchar *title, const gchar *description,
GtkDialog *dialog;
GtkWidget *w;
GtkWidget *box;
- GtkWidget *ebox;
GtkTable *table;
GtkWidget *wvbox;
GtkWidget *chbox;
@@ -243,7 +242,6 @@ seahorse_passphrase_prompt_show (const gchar *title, const gchar *description,
/* The first entry if we have one */
if (confirm) {
- ebox = gtk_hbox_new (FALSE, HIG_LARGE);
msg = utf8_validate (prompt);
w = gtk_label_new (msg);
g_free (msg);
@@ -262,7 +260,6 @@ seahorse_passphrase_prompt_show (const gchar *title, const gchar *description,
}
/* The second and main entry */
- ebox = gtk_hbox_new (FALSE, HIG_LARGE);
msg = utf8_validate (confirm ? _("Confirm:") : prompt);
w = gtk_label_new (msg);
g_free (msg);
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index 2c7aec2..5bfb323 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -1589,7 +1589,7 @@ seahorse_util_determine_popup_menu_position (GtkMenu *menu, int *x, int *y,
widget = GTK_WIDGET (gdata);
- gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
gdk_window_get_origin (gtk_widget_get_window (widget), &menu_xpos, &menu_ypos);
diff --git a/pgp/seahorse-gpg-options.c b/pgp/seahorse-gpg-options.c
index aa6158d..d4a69bc 100644
--- a/pgp/seahorse-gpg-options.c
+++ b/pgp/seahorse-gpg-options.c
@@ -392,14 +392,12 @@ process_conf_edits (GArray *lines, const gchar *options[], gchar *values[])
gchar *t;
gchar *n;
gchar *line;
- gsize length;
guint i, j;
for (j = 0; j < lines->len; j++) {
line = g_array_index (lines, gchar*, j);
g_assert (line != NULL);
- length = strlen(line);
-
+
/*
* Does this line have an ending?
* We use this below when appending lines.
diff --git a/pgp/seahorse-gpgme-source.c b/pgp/seahorse-gpgme-source.c
index b8d1a44..b2cd86b 100644
--- a/pgp/seahorse-gpgme-source.c
+++ b/pgp/seahorse-gpgme-source.c
@@ -732,14 +732,12 @@ static SeahorseLoadOperation*
seahorse_load_operation_start (SeahorseGpgmeSource *psrc, const gchar **pattern,
guint parts, gboolean secret)
{
- SeahorseGpgmeSourcePrivate *priv;
SeahorseLoadOperation *lop;
gpgme_error_t err;
GList *keys, *l;
SeahorseObject *sobj;
g_assert (SEAHORSE_IS_GPGME_SOURCE (psrc));
- priv = psrc->pv;
lop = g_object_new (SEAHORSE_TYPE_LOAD_OPERATION, NULL);
lop->psrc = psrc;
@@ -932,7 +930,6 @@ static SeahorseOperation*
seahorse_gpgme_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream *output)
{
SeahorseGpgmeOperation *pop;
- SeahorseGpgmeSource *psrc;
SeahorseGpgmeKey *pkey;
SeahorseObject *object;
ExportContext *ctx;
@@ -942,8 +939,6 @@ seahorse_gpgme_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream
g_return_val_if_fail (SEAHORSE_IS_GPGME_SOURCE (sksrc), NULL);
g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
-
- psrc = SEAHORSE_GPGME_SOURCE (sksrc);
pop = seahorse_gpgme_operation_new (_("Exporting Keys"));
g_return_val_if_fail (pop != NULL, NULL);
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 7ea3be4..8081045 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -1635,12 +1635,11 @@ do_trust (SeahorseWidget *swidget)
/* Local keys */
} else {
guint trust;
- gboolean trusted, managed;
+ gboolean managed;
const gchar *icon = NULL;
trust = seahorse_pgp_key_get_trust (pkey);
-
- trusted = FALSE;
+
managed = FALSE;
switch (trust) {
@@ -1652,14 +1651,12 @@ do_trust (SeahorseWidget *swidget)
/* Trust is specified manually */
case SEAHORSE_VALIDITY_ULTIMATE:
- trusted = TRUE;
managed = FALSE;
icon = SEAHORSE_STOCK_SIGN_OK;
break;
/* Trust is specified manually */
case SEAHORSE_VALIDITY_NEVER:
- trusted = FALSE;
managed = FALSE;
icon = SEAHORSE_STOCK_SIGN_BAD;
break;
@@ -1667,14 +1664,12 @@ do_trust (SeahorseWidget *swidget)
/* We manage the trust through this page */
case SEAHORSE_VALIDITY_FULL:
case SEAHORSE_VALIDITY_MARGINAL:
- trusted = TRUE;
managed = TRUE;
icon = SEAHORSE_STOCK_SIGN_OK;
break;
/* We manage the trust through this page */
case SEAHORSE_VALIDITY_UNKNOWN:
- trusted = FALSE;
managed = TRUE;
icon = SEAHORSE_STOCK_SIGN;
break;
diff --git a/pgp/seahorse-server-source.c b/pgp/seahorse-server-source.c
index c90933f..0b84bd8 100644
--- a/pgp/seahorse-server-source.c
+++ b/pgp/seahorse-server-source.c
@@ -154,8 +154,7 @@ static void
seahorse_server_source_dispose (GObject *gobject)
{
SeahorseServerSource *ssrc;
- SeahorseSource *sksrc;
-
+
/*
* Note that after this executes the rest of the object should
* still work without a segfault. This basically nullifies the
@@ -165,7 +164,6 @@ seahorse_server_source_dispose (GObject *gobject)
*/
ssrc = SEAHORSE_SERVER_SOURCE (gobject);
- sksrc = SEAHORSE_SOURCE (gobject);
g_assert (ssrc->priv);
/* Clear out all the operations */
@@ -302,10 +300,7 @@ seahorse_server_source_take_operation (SeahorseServerSource *ssrc, SeahorseOpera
static SeahorseOperation*
seahorse_server_source_load (SeahorseSource *src)
{
- SeahorseServerSource *ssrc;
-
g_assert (SEAHORSE_IS_SOURCE (src));
- ssrc = SEAHORSE_SERVER_SOURCE (src);
/* We should never be called directly */
return NULL;
diff --git a/ssh/seahorse-ssh-askpass.c b/ssh/seahorse-ssh-askpass.c
index d4d30f9..aad85a3 100644
--- a/ssh/seahorse-ssh-askpass.c
+++ b/ssh/seahorse-ssh-askpass.c
@@ -37,7 +37,7 @@ static gchar*
askpass_command (const gchar *cmd, const gchar *arg)
{
const gchar* env;
- gchar *t, *ret;
+ gchar *t;
int fd;
/* Try an open the connection with seahorse */
@@ -68,8 +68,8 @@ askpass_command (const gchar *cmd, const gchar *arg)
/* Read the setting */
t = g_new0 (gchar, 512);
- ret = fgets (t, 512, seahorse_link);
-
+ fgets (t, 512, seahorse_link);
+
/* Make sure it worked */
if (ferror (seahorse_link)) {
g_warning ("error reading from seahorse");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]