2012-04-01 [colin] 3.8.0cvs36
[claws.git] / src / plugins / trayicon / trayicon.c
index 2068e25c09aa30e74f29e412f409550798122b99..5c79e5b3e1bc505834daa220d894ac7044ab155a 100644 (file)
@@ -42,6 +42,9 @@
 #include "alertpanel.h"
 #include "account.h"
 #include "gtk/manage_window.h"
+#ifdef USE_NEW_ADDRBOOK
+       #include "addressbook-dbus.h"
+#endif
 
 #include "trayicon_prefs.h"
 
@@ -238,7 +241,7 @@ static gboolean trayicon_close_hook(gpointer source, gpointer data)
                        *close_allowed = FALSE;
                        focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));
                        
-                       if (gtkut_widget_get_visible(GTK_WIDGET(mainwin->window)))
+                       if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
                                main_window_hide(mainwin);
                }
        }
@@ -250,7 +253,7 @@ static gboolean trayicon_got_iconified_hook(gpointer source, gpointer data)
        MainWindow *mainwin = mainwindow_get_mainwindow();
 
        if (trayicon_prefs.hide_when_iconified
-                       && gtkut_widget_get_visible(GTK_WIDGET(mainwin->window))
+                       && gtk_widget_get_visible(GTK_WIDGET(mainwin->window))
                        && !gtk_window_get_skip_taskbar_hint(GTK_WINDOW(mainwin->window))) {
                focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));
                gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), TRUE);
@@ -283,8 +286,9 @@ static gboolean click_cb(GtkWidget * widget,
 
        switch (event->button) {
        case 1:
-               if (gtkut_widget_get_visible(GTK_WIDGET(mainwin->window))) {
-                       if ((gdk_window_get_state(GTK_WIDGET(mainwin->window)->window)&GDK_WINDOW_STATE_ICONIFIED)
+               if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window))) {
+                       if ((gdk_window_get_state(gtk_widget_get_window(
+                               GTK_WIDGET(mainwin->window)))&GDK_WINDOW_STATE_ICONIFIED)
                                        || mainwindow_is_obscured()) {
                                gtk_window_deiconify(GTK_WINDOW(mainwin->window));
                                gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), FALSE);
@@ -347,9 +351,7 @@ static void create_trayicon()
 {
        GtkActionGroup *action_group;
        trayicon = gtk_status_icon_new();
-#if GTK_CHECK_VERSION(2,18,0)
        gtk_status_icon_set_title(GTK_STATUS_ICON(trayicon), _("Claws Mail"));
-#endif
        g_signal_connect(G_OBJECT(trayicon), "button-press-event",
                G_CALLBACK(click_cb), NULL);
 
@@ -432,7 +434,7 @@ int plugin_init(gchar **error)
        if (trayicon_prefs.hide_at_startup && claws_is_starting()) {
                MainWindow *mainwin = mainwindow_get_mainwindow();
 
-               if (gtkut_widget_get_visible(GTK_WIDGET(mainwin->window)))
+               if (gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
                        main_window_hide(mainwin);
                main_set_show_at_startup(FALSE);
        }
@@ -531,7 +533,16 @@ static void trayicon_compose_acc_cb( GtkMenuItem *menuitem, gpointer data )
 
 static void trayicon_addressbook_cb( GtkAction *action, gpointer data )
 {
+#ifndef USE_NEW_ADDRBOOK
        addressbook_open(NULL);
+#else
+       GError* error = NULL;
+       addressbook_dbus_open(FALSE, &error);
+       if (error) {
+               g_warning("%s", error->message);
+               g_error_free(error);
+       }
+#endif
 }
 
 static void trayicon_toggle_offline_cb( GtkAction *action, gpointer data )