static void noticeview_2ndbutton_pressed(GtkButton *button, NoticeView *noticeview);
static gboolean noticeview_icon_pressed (GtkWidget *widget, GdkEventButton *evt,
NoticeView *noticeview);
+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);
+static gboolean noticeview_enter_notify(GtkWidget *widget,
+ GdkEventCrossing *event,
+ NoticeView *textview);
+
+static GdkCursor *hand_cursor = NULL;
NoticeView *noticeview_create(MainWindow *mainwin)
{
debug_print("Creating notice view...\n");
noticeview = g_new0(NoticeView, 1);
+ if (!hand_cursor)
+ hand_cursor = gdk_cursor_new(GDK_HAND2);
+
noticeview->window = mainwin->window;
vbox = gtk_vbox_new(FALSE, 4);
g_signal_connect(G_OBJECT(evtbox), "button-press-event",
G_CALLBACK(noticeview_icon_pressed),
(gpointer) noticeview);
+ g_signal_connect(G_OBJECT(evtbox), "visibility-notify-event",
+ G_CALLBACK(noticeview_visi_notify), noticeview);
+ g_signal_connect(G_OBJECT(evtbox), "motion-notify-event",
+ G_CALLBACK(noticeview_visi_notify), noticeview);
+ g_signal_connect(G_OBJECT(evtbox), "leave-notify-event",
+ G_CALLBACK(noticeview_leave_notify), noticeview);
+ g_signal_connect(G_OBJECT(evtbox), "enter-notify-event",
+ G_CALLBACK(noticeview_enter_notify), noticeview);
gtk_container_add(GTK_CONTAINER(evtbox), icon);
gtk_box_pack_start(GTK_BOX(hbox), evtbox, FALSE, TRUE, 0);
noticeview->icon = icon;
noticeview->text = text;
noticeview->button = widget;
- noticeview->button2 = widget2;
-
- noticeview->visible = TRUE;
+ noticeview->button2= widget2;
+ noticeview->evtbox = evtbox;
+ noticeview->visible= TRUE;
return noticeview;
}
return FALSE;
}
+static gboolean noticeview_visi_notify(GtkWidget *widget,
+ GdkEventVisibility *event,
+ NoticeView *noticeview)
+{
+ if (noticeview->icon_clickable)
+ gdk_window_set_cursor(noticeview->evtbox->window, hand_cursor);
+ 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)
+{
+ gdk_window_set_cursor(noticeview->evtbox->window, NULL);
+ return FALSE;
+}
+
+static gboolean noticeview_enter_notify(GtkWidget *widget,
+ GdkEventCrossing *event,
+ NoticeView *noticeview)
+{
+ if (noticeview->icon_clickable)
+ gdk_window_set_cursor(noticeview->evtbox->window, hand_cursor);
+ return FALSE;
+}
+
void noticeview_set_2ndbutton_text(NoticeView *noticeview, const char *text)
{
g_return_if_fail(noticeview);