2012-12-10 [mones] 3.9.0cvs45
[claws.git] / src / addr_compl.c
index 16bfa248db66956ce8b282e4f3243e2a6e2de898..d7467aad1804c0a3dd68d0dbee07646abb477947 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
  *
- * Copyright (C) 2000-2011 by Alfons Hoogervorst & The Claws Mail Team.
+ * Copyright (C) 2000-2012 by Alfons Hoogervorst & The Claws Mail Team.
  *
  * 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
@@ -20,6 +20,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 #include "defs.h"
 
@@ -42,6 +43,7 @@
 #include "claws.h"
 #include "hooks.h"
 #include "gtkutils.h"
+#include "stock_pixmap.h"
 #include <pthread.h>
 
 #ifndef USE_NEW_ADDRBOOK
@@ -252,35 +254,32 @@ void addr_compl_add_address1(const char *str, address_entry *ae)
 static gint add_address(const gchar *name, const gchar *address, 
                        const gchar *nick, const gchar *alias, GList *grp_emails)
 {
-       address_entry    *ae;
-       gboolean is_group = FALSE;
+       address_entry *ae;
 
-       if (!name || !address) {
-               if (!address && !nick && !alias && grp_emails) {
-                       is_group = TRUE;
-               } else
-                       return -1;
-       }
+       if (!address && !grp_emails)
+               return -1;
 
-       ae = g_new0(address_entry, 1);
+       if (!name)
+               name = "";
 
+       ae = g_new0(address_entry, 1);
        cm_return_val_if_fail(ae != NULL, -1);
 
-       ae->name    = g_strdup(name);
+       ae->name = g_strdup(name);
        ae->address = g_strdup(address);
        ae->grp_emails = grp_emails;
        g_address_list = g_list_prepend(g_address_list, ae);
 
        addr_compl_add_address1(name, ae);
+
        if (address != NULL && *address != '\0')
                addr_compl_add_address1(address, ae);
 
        if (nick != NULL && *nick != '\0')
                addr_compl_add_address1(nick, ae);
 
-       if ( alias != NULL && *alias != '\0') {
+       if (alias != NULL && *alias != '\0')
                addr_compl_add_address1(alias, ae);
-       }
 
        return 0;
 }
@@ -860,11 +859,20 @@ static void addrcompl_resize_window( CompletionWindow *cw ) {
        gint x, y, width, height, depth;
 
        /* Get current geometry of window */
+#if !GTK_CHECK_VERSION(3, 0, 0)
        gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height, &depth );
+#else
+       gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height );
+#endif
 
        /* simple _hide breaks size requisition !? */
+#if !GTK_CHECK_VERSION(3, 0, 0)
        gtk_widget_hide_all( cw->window );
        gtk_widget_show_all( cw->window );
+#else
+       gtk_widget_hide( cw->window );
+       gtk_widget_show( cw->window );
+#endif
        gtk_widget_size_request( cw->list_view, &r );
 
        /* Adjust window height to available screen space */
@@ -1370,7 +1378,11 @@ static void address_completion_create_completion_window( GtkEntry *entry_ )
                GTK_SHADOW_OUT);
        /* Use entry widget to create initial window */
        gdkwin = gtk_widget_get_window(entry),
+#if !GTK_CHECK_VERSION(3, 0, 0)
        gdk_window_get_geometry(gdkwin, &x, &y, &width, &height, &depth);
+#else
+       gdk_window_get_geometry(gdkwin, &x, &y, &width, &height);
+#endif
        gdk_window_get_origin (gdkwin, &x, &y);
        y += height;
        gtk_window_move(GTK_WINDOW(window), x, y);