2008-09-08 [colin] 3.5.0cvs94
[claws.git] / src / noticeview.c
index 21b3d9aab39bc94f5546bb83fdbb258849014ada..bacaff1010b43ae23fb671849d37b876bae03a65 100644 (file)
@@ -1,10 +1,10 @@
 /* 
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ * Copyright (C) 2002 Hiroyuki Yamamoto & 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
@@ -52,9 +52,6 @@ static gboolean noticeview_icon_pressed       (GtkWidget *widget, GdkEventButton *evt,
 static gboolean noticeview_visi_notify(GtkWidget *widget,
                                       GdkEventVisibility *event,
                                       NoticeView *noticeview);
-static gboolean noticeview_motion_notify(GtkWidget *widget,
-                                      GdkEventMotion *event,
-                                      NoticeView *noticeview);
 static gboolean noticeview_leave_notify(GtkWidget *widget,
                                      GdkEventCrossing *event,
                                      NoticeView *textview);
@@ -75,6 +72,7 @@ NoticeView *noticeview_create(MainWindow *mainwin)
        GtkWidget  *widget;
        GtkWidget  *widget2;
        GtkWidget  *evtbox;
+       CLAWS_TIP_DECL();
 
        debug_print("Creating notice view...\n");
        noticeview = g_new0(NoticeView, 1);
@@ -120,14 +118,12 @@ NoticeView *noticeview_create(MainWindow *mainwin)
        gtk_box_pack_start(GTK_BOX(hbox), text, FALSE, FALSE, 0);
 
        widget = gtk_button_new_with_label("");
-       gtk_widget_set_size_request(widget, 120, -1);
        g_signal_connect(G_OBJECT(widget), "clicked", 
                         G_CALLBACK(noticeview_button_pressed),
                         (gpointer) noticeview);
        gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 4);
        
        widget2 = gtk_button_new_with_label("");
-       gtk_widget_set_size_request(widget2, 120, -1);
        g_signal_connect(G_OBJECT(widget2), "clicked", 
                         G_CALLBACK(noticeview_2ndbutton_pressed),
                         (gpointer) noticeview);
@@ -142,7 +138,9 @@ NoticeView *noticeview_create(MainWindow *mainwin)
        noticeview->button2= widget2;
        noticeview->evtbox = evtbox;
        noticeview->visible= TRUE;
-
+#if !(GTK_CHECK_VERSION(2,12,0))
+       noticeview->tooltips = tips;
+#endif
        return noticeview;
 }
 
@@ -166,7 +164,7 @@ void noticeview_show(NoticeView *noticeview)
 
 void noticeview_hide(NoticeView *noticeview)
 {
-       if (noticeview->visible) {
+       if (noticeview && noticeview->visible) {
                gtk_widget_hide(GTK_WIDGET_PTR(noticeview));
                noticeview->visible = FALSE;
        }       
@@ -184,7 +182,7 @@ void noticeview_set_button_text(NoticeView *noticeview, const char *text)
 
        if (text != NULL) {
                gtk_label_set_text
-                       (GTK_LABEL(GTK_BIN(noticeview->button)->child), text);
+                       (GTK_LABEL(gtk_bin_get_child(GTK_BIN((noticeview->button)))), text);
                gtk_widget_show(noticeview->button);
        } else
                gtk_widget_hide(noticeview->button);
@@ -197,7 +195,7 @@ void noticeview_set_button_text(NoticeView *noticeview, const char *text)
 }
 
 void noticeview_set_button_press_callback(NoticeView   *noticeview,
-                                         GtkSignalFunc  callback,
+                                         void          (*callback)(void),
                                          gpointer      *user_data)
 {
        noticeview->press     = (void (*) (NoticeView *, gpointer)) callback;
@@ -229,15 +227,6 @@ static gboolean noticeview_visi_notify(GtkWidget *widget,
        return FALSE;
 }
 
-static gboolean noticeview_motion_notify(GtkWidget *widget,
-                                      GdkEventMotion *event,
-                                      NoticeView *noticeview)
-{
-       if (noticeview->icon_clickable)
-               gdk_window_set_cursor(noticeview->evtbox->window, hand_cursor);
-       return FALSE;
-}
-
 static gboolean noticeview_leave_notify(GtkWidget *widget,
                                      GdkEventCrossing *event,
                                      NoticeView *noticeview)
@@ -261,14 +250,14 @@ void noticeview_set_2ndbutton_text(NoticeView *noticeview, const char *text)
 
        if (text != NULL) {
                gtk_label_set_text
-                       (GTK_LABEL(GTK_BIN(noticeview->button2)->child), text);
+                       (GTK_LABEL(gtk_bin_get_child(GTK_BIN((noticeview->button2)))), text);
                gtk_widget_show(noticeview->button2);
        } else
                gtk_widget_hide(noticeview->button2);
 }
 
 void noticeview_set_2ndbutton_press_callback(NoticeView        *noticeview,
-                                         GtkSignalFunc  callback,
+                                         void          (*callback)(void),
                                          gpointer      *user_data)
 {
        noticeview->press2     = (void (*) (NoticeView *, gpointer)) callback;
@@ -297,3 +286,13 @@ void noticeview_set_icon_clickable(NoticeView *noticeview, gboolean setting)
 {
        noticeview->icon_clickable = setting;
 }              
+
+void noticeview_set_tooltip (NoticeView *noticeview, const gchar *text)
+{
+#if !(GTK_CHECK_VERSION(2,12,0))
+       GtkTooltips *tips = noticeview->tooltips;
+#endif
+       CLAWS_SET_TIP(noticeview->evtbox,
+                       text);
+
+}