[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:26660] Trayicon patch for 2.2.0beta2 (left click, right click and middle
From:       Serial <serialcleaner () gmx ! net>
Date:       2005-12-27 9:54:02
Message-ID: 20051227105402.21e3bb01.serialcleaner () gmx ! net
[Download RAW message or body]

Hello,

With this patch, we can hide/unhide the sylpheed window with left click, the middle click does a mail \
retrieval for all accounts and right click pops up a menu where is, at this moment, the quit item menu.

Regards,

Serial


["sylpheed-trayicon-2.2.0beta2.patch" (application/octet-stream)]

diff -aur svn/sylpheed/src/mainwindow.c sylpheed-SVN/src/mainwindow.c
--- svn/sylpheed/src/mainwindow.c	2005-12-26 16:31:04.000000000 +0100
+++ sylpheed-SVN/src/mainwindow.c	2005-12-26 16:33:49.000000000 +0100
@@ -1294,6 +1294,10 @@
 	g_free(ac_name);
 }
 
+void main_inc_all_account_mail (MainWindow	*mainwin){
+	inc_all_account_mail_cb(mainwin, 0, NULL);
+}
+
 MainWindow *main_window_get(void)
 {
 	if (mainwin_list)
@@ -2781,6 +2785,11 @@
 		(mainwin, !GTK_CHECK_MENU_ITEM(widget)->active);
 }
 
+void main_app_exit (MainWindow *mainwin)
+{
+	app_exit_cb(mainwin, 0, NULL);
+}
+
 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
 	if (prefs_common.confirm_on_exit) {
diff -aur svn/sylpheed/src/mainwindow.h sylpheed-SVN/src/mainwindow.h
--- svn/sylpheed/src/mainwindow.h	2005-12-11 17:21:55.000000000 +0100
+++ sylpheed-SVN/src/mainwindow.h	2005-12-26 16:33:49.000000000 +0100
@@ -170,5 +170,7 @@
 void main_window_set_menu_sensitive	(MainWindow	*mainwin);
 
 void main_window_popup			(MainWindow	*mainwin);
+void main_inc_all_account_mail		(MainWindow	*mainwin);
+void main_app_exit			(MainWindow	*mainwin);
 
 #endif /* __MAINWINDOW_H__ */
diff -aur svn/sylpheed/src/trayicon.c sylpheed-SVN/src/trayicon.c
--- svn/sylpheed/src/trayicon.c	2005-12-11 17:21:54.000000000 +0100
+++ sylpheed-SVN/src/trayicon.c	2005-12-26 16:33:49.000000000 +0100
@@ -41,6 +41,7 @@
 static GtkWidget *trayicon_img;
 static GtkWidget *eventbox;
 static GtkTooltips *trayicon_tip;
+static GtkMenu *trayicon_menu;
 
 static void trayicon_button_pressed	(GtkWidget	*widget,
 					 GdkEventButton	*event,
@@ -48,8 +49,12 @@
 static void trayicon_destroy_cb		(GtkWidget	*widget,
 					 gpointer	 data);
 
+static void trayicon_main_app_exit	(MainWindow *mainwin);
+
 GtkWidget *trayicon_create(MainWindow *mainwin)
 {
+	GtkMenuItem *trayicon_menuitem_quit;
+
 	trayicon = GTK_WIDGET(egg_tray_icon_new("Sylpheed"));
 	g_signal_connect(G_OBJECT(trayicon), "destroy",
 			 G_CALLBACK(trayicon_destroy_cb), mainwin);
@@ -65,6 +70,13 @@
 	trayicon_tip = gtk_tooltips_new();
 	gtk_tooltips_set_tip(trayicon_tip, trayicon, _("Sylpheed"), NULL);
 
+	trayicon_menu = (GtkMenu *) gtk_menu_new();
+	trayicon_menuitem_quit = (GtkMenuItem *) gtk_menu_item_new_with_label(_("Exit"));
+	gtk_menu_attach(trayicon_menu, (GtkWidget *)trayicon_menuitem_quit, 0, 1, 0, 1);
+	gtk_widget_show((GtkWidget *)trayicon_menuitem_quit);
+	g_signal_connect(G_OBJECT(trayicon_menuitem_quit), "button_press_event",
+			 G_CALLBACK(trayicon_main_app_exit), mainwin);
+
 	gtk_widget_show_all(trayicon);
 
 	return trayicon;
@@ -93,7 +105,23 @@
 	MainWindow *mainwin = (MainWindow *)data;
 
 	if (event && event->button == 1)
-		gtk_window_present(GTK_WINDOW(mainwin->window));
+		if ( gtk_window_get_skip_taskbar_hint(GTK_WINDOW(mainwin->window)) == 0 ){
+			gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), 1);
+			gtk_widget_hide(GTK_WIDGET(mainwin->window));
+		}else{
+			gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), 0);
+			gtk_widget_show(GTK_WIDGET(mainwin->window));
+		}
+	if (event && event->button == 2)
+		main_inc_all_account_mail((MainWindow *)mainwin);
+	if (event && event->button == 3)
+		gtk_menu_popup(trayicon_menu, NULL, NULL, NULL, NULL, 3, gtk_get_current_event_time() );
+		
+}
+
+static void trayicon_main_app_exit(MainWindow *mainwin)
+{
+	main_app_exit(mainwin);
 }
 
 static gboolean trayicon_restore(gpointer data)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic