You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/06/22 01:11:21 UTC

svn commit: r1352725 - in /incubator/ooo/trunk/main: configure.in sfx2/source/appl/shutdowniconunx.cxx

Author: arielch
Date: Thu Jun 21 23:11:20 2012
New Revision: 1352725

URL: http://svn.apache.org/viewvc?rev=1352725&view=rev
Log:
i119392 - Make GTK Quickstarter buildable with gtk 2.10.x

Modified:
    incubator/ooo/trunk/main/configure.in
    incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx

Modified: incubator/ooo/trunk/main/configure.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/configure.in?rev=1352725&r1=1352724&r2=1352725&view=diff
==============================================================================
--- incubator/ooo/trunk/main/configure.in (original)
+++ incubator/ooo/trunk/main/configure.in Thu Jun 21 23:11:20 2012
@@ -5937,7 +5937,7 @@ if test  "$test_gtk" = "yes"; then
       BUILD_TYPE="$BUILD_TYPE GTK"
 
       if test "x$enable_systray" = "xyes"; then
-         PKG_CHECK_MODULES(GTK_2_16,gtk+-2.0 >= 2.16.0,
+         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
                            [ENABLE_SYSTRAY_GTK="TRUE"
                             BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
                            [ENABLE_SYSTRAY_GTK=""])

Modified: incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx?rev=1352725&r1=1352724&r2=1352725&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/appl/shutdowniconunx.cxx Thu Jun 21 23:11:20 2012
@@ -313,20 +313,29 @@ static void refresh_menu( GtkWidget *pMe
     gtk_widget_set_sensitive( pDisableMenuItem, !bModal);
 }
 
+static void activate_cb( GtkStatusIcon *status_icon,
+                         gpointer pMenu )
+{
+    refresh_menu( GTK_WIDGET( pMenu ) );
+
+    gtk_menu_popup( GTK_MENU( pMenu ), NULL, NULL,
+                    gtk_status_icon_position_menu,
+                    status_icon, 0, gtk_get_current_event_time() );
+}
 
-static gboolean display_menu_cb( GtkWidget *,
-								 GdkEventButton *event, GtkWidget *pMenu )
+static void popup_menu_cb(GtkStatusIcon *status_icon,
+                          guint button,
+                          guint activate_time,
+                          gpointer pMenu)
 {
-	if (event->button == 2)
-		return sal_False;
+	if (button == 2)
+		return;
 
-	refresh_menu( pMenu );
+	refresh_menu( GTK_WIDGET( pMenu ) );
 
 	gtk_menu_popup( GTK_MENU( pMenu ), NULL, NULL,
                     gtk_status_icon_position_menu,
-                    pTrayIcon, 0, event->time );
-
-	return sal_True;
+                    status_icon, button, activate_time );
 }
 
 void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
@@ -359,16 +368,23 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sy
 	GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_LARGE_START + SV_ICON_ID_OFFICE );
     g_object_set( G_OBJECT( pTrayIcon ),
                   "pixbuf", pPixbuf,
-                  "title", aLabel.getStr(),
+                  "title", aLabel.getStr(),/* Since 2.18 */
+                  "tooltip-text", aLabel.getStr(), /* Since 2.16 */
                   NULL );
 	g_object_unref( pPixbuf );
 
-    gtk_status_icon_set_tooltip_text( pTrayIcon, aLabel.getStr() );
+	// gtk_status_icon_set_tooltip_text is available since 2.16
+    // so use instead deprecated gtk_status_icon_set_tooltip
+   gtk_status_icon_set_tooltip( pTrayIcon, aLabel.getStr() );
 
 	GtkWidget *pMenu = gtk_menu_new();
 
-    g_signal_connect( pTrayIcon, "button-press-event",
-                      G_CALLBACK( display_menu_cb ), pMenu );
+	// Signal "button-press-event" is available since 2.14
+    // Use "activate" and "popup-menu" instead
+    g_signal_connect( pTrayIcon, "activate",
+                      G_CALLBACK( activate_cb ), pMenu );
+    g_signal_connect( pTrayIcon, "popup-menu",
+                      G_CALLBACK( popup_menu_cb ), pMenu );
 
     g_signal_connect( pMenu, "deactivate",
                       G_CALLBACK (menu_deactivate_cb), NULL);