Permalink
Browse files

Support both gtk2 and gtk3

As the GTK3 port isn't fully complete yet use GTK2 by default.
The GTK3 port can be activated by running ./jb configure gtk3=yes
  • Loading branch information...
1 parent a4db50d commit f27e2dd433e7a5fdf55f605b000ac13c0540f40f @epienbroek committed Nov 24, 2012
View
@@ -152,6 +152,7 @@ jb_package_init (void)
TRUE);
/* misc */
+ jb_variable_add_bool("gtk3", "enable GTK3 support", NULL, 0,FALSE);
jb_variable_add_bool("compile-warnings", NULL, NULL, 0, FALSE);
jb_variable_add_bool("debug", NULL, NULL, 0, FALSE);
jb_variable_add_bool("regression-tests", NULL, NULL, 0, FALSE);
@@ -164,9 +165,15 @@ jb_package_configure (void)
{
jb_check_glibc();
- jb_require_packages("GNOME", "gnome", "glib-2.0 >= 2.14 gthread-2.0 gconf-2.0 >= 2.4.0 gtk+-3.0 libgnome-2.0 >= 2.14.0 gnome-vfs-2.0 libxml-2.0 libnotify >= 0.4.1");
+ jb_require_packages("GNOME", "gnome", "glib-2.0 >= 2.14 gthread-2.0 gconf-2.0 >= 2.4.0 libgnome-2.0 >= 2.14.0 gnome-vfs-2.0 libxml-2.0 libnotify >= 0.4.1");
jb_require_packages("D-Bus", "dbus", "dbus-glib-1");
+ if (jb_variable_get_bool("gtk3")) {
+ jb_require_packages("GTK", "gtk", "gtk+-3.0");
+ } else {
+ jb_require_packages("GTK", "gtk", "gtk+-2.0 libgnomeui-2.0");
+ }
+
jb_check_packages_for_options("GMime", "gmime", "gmime-2.6",
"hotmail",
"imap",
@@ -451,6 +458,7 @@ jb_package_add_resources (void)
jb_compile_options_add_package(object->compile_options, "gettext");
jb_compile_options_add_package(object->compile_options, "gnome");
+ jb_compile_options_add_package(object->compile_options, "gtk");
jb_compile_options_add_package(object->compile_options, "dbus");
jb_group_add_dbus_interface(group,
@@ -494,6 +502,7 @@ jb_package_add_resources (void)
"mn-stock",
"mn-util",
"mn-vfs",
+ "mn-widget.c",
"mn-xml",
"nautilus-cell-renderer-pixbuf-emblem",
NULL);
View
@@ -357,25 +357,32 @@ egg_tray_icon_update_manager_window (EggTrayIcon *icon,
}
}
+#if GTK_CHECK_VERSION(3,0,0)
static gboolean
transparent_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
-#if 0
- gdk_window_clear_area (widget->window, event->area.x, event->area.y,
- event->area.width, event->area.height);
-#endif
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- //gdk_cairo_region (cr, event->region);
cairo_fill (cr);
return FALSE;
}
+#else
+static gboolean
+transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+{
+ gdk_window_clear_area (widget->window, event->area.x, event->area.y,
+ event->area.width, event->area.height);
+ return FALSE;
+}
+#endif
static void
make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
gpointer user_data)
{
- //gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+#if !GTK_CHECK_VERSION(3,0,0)
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+#endif
}
static void
@@ -386,9 +393,15 @@ make_transparent (GtkWidget *widget, gpointer user_data)
gtk_widget_set_app_paintable (widget, TRUE);
gtk_widget_set_double_buffered (widget, FALSE);
- //gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect (widget, "draw",
- G_CALLBACK (transparent_draw), NULL);
+ G_CALLBACK (transparent_draw), NULL);
+#else
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ g_signal_connect (widget, "expose_event",
+ G_CALLBACK (transparent_expose_event), NULL);
+#endif
+
g_signal_connect_after (widget, "style_set",
G_CALLBACK (make_transparent_again), NULL);
}
View
@@ -24,7 +24,13 @@
#define __EGG_TRAY_ICON_H__
#include <gtk/gtk.h>
+
+#if GTK_CHECK_VERSION(3,0,0)
#include <gtk/gtkx.h>
+#else
+#include <gtk/gtkplug.h>
+#endif
+
#include <gdk/gdkx.h>
G_BEGIN_DECLS
View
@@ -30,7 +30,7 @@ class MN:About:Dialog from Gtk:About:Dialog
{
class_init (class)
{
-#if 0
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_about_dialog_set_email_hook(self_activate_link_cb, "mailto:", NULL);
gtk_about_dialog_set_url_hook(self_activate_link_cb, NULL, NULL);
#endif
@@ -28,7 +28,11 @@
%{
#include <glib/gi18n.h>
+#if GTK_CHECK_VERSION(3,0,0)
#include <libgnome/libgnome.h>
+#else
+#include <libgnomeui/libgnomeui.h>
+#endif
#include "mn-mailbox-private.h"
#include "mn-shell.h"
#include "mn-util.h"
@@ -377,7 +381,9 @@ class MN:Authenticated:Mailbox from MN:Mailbox (abstract)
/* keep the title in sync with gnome-authentication-manager */
-#if 0
+#if GTK_CHECK_VERSION(3,0,0)
+ return FALSE;
+#else
/* translators: header capitalization */
selfp->auth_dialog = gnome_password_dialog_new(_("Authentication Required"),
message,
@@ -410,8 +416,6 @@ class MN:Authenticated:Mailbox from MN:Mailbox (abstract)
gtk_widget_destroy(selfp->auth_dialog);
return ok;
-#else
- return FALSE;
#endif
}
View
@@ -26,6 +26,9 @@ class MN:Dialog from Gtk:Dialog (abstract)
init (self)
{
gtk_container_set_border_width(GTK_CONTAINER(self), 5);
+#if !GTK_CHECK_VERSION(3,0,0)
+ gtk_dialog_set_has_separator(GTK_DIALOG(self), FALSE);
+#endif
gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), 2);
}
}
@@ -38,7 +38,11 @@ typedef GtkFileChooserDialog *(*MNFileChooserButtonCreateDialogFunction) (gpoint
%{
#include <glib/gi18n.h>
+#if GTK_CHECK_VERSION(3,0,0)
#include <libgnome/libgnome.h>
+#else
+#include <libgnomeui/libgnomeui.h>
+#endif
#include "mn-util.h"
%}
@@ -211,7 +215,7 @@ class MN:File:Chooser:Button from Gtk:HBox
GDK_THREADS_ENTER();
-#if 0
+#if !GTK_CHECK_VERSION(3,0,0)
if (results)
{
GnomeVFSGetFileInfoResult *result = results->data;
Oops, something went wrong.

0 comments on commit f27e2dd

Please sign in to comment.