diff --git a/gnome/configure.ac b/gnome/configure.ac index e9738278d7cf6d69fdfa2a74141e7444833e9e1d..f87118156f7c36ea952eceaf593b46ef034f9dd8 100644 --- a/gnome/configure.ac +++ b/gnome/configure.ac @@ -15,9 +15,7 @@ AC_PROG_INSTALL AC_HEADER_STDC LT_INIT -dnl Only need these for moving to gtk3 -MIGRATION_CFLAGS="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES" -CFLAGS="$CFLAGS -Wall -Wextra -Wshadow $MIGRATION_CFLAGS" +CFLAGS="$CFLAGS -Wall -Wextra -Wshadow" dnl GCONF utilities AM_GCONF_SOURCE_2 @@ -32,10 +30,10 @@ if echo "$LIBNOTIFY_LIBS" | grep -q gtk+-x11-2.0; then AC_MSG_ERROR([Your libnotify is linked with GTK+2 ! Install libnotify4-dev]) exit 1 fi -PKG_CHECK_MODULES(GTK, gtk+-3.0) +PKG_CHECK_MODULES(GTK, gtk+-3.0, , [PKG_CHECK_MODULES(GTK, gtk+-2.0)]) PKG_CHECK_MODULES(GCONF, gconf-2.0) PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.24) -PKG_CHECK_MODULES(WEBKIT, webkitgtk-3.0) +PKG_CHECK_MODULES(WEBKIT, webkitgtk-3.0,, [PKG_CHECK_MODULES(WEBKIT, webkit-1.0)]) PKG_CHECK_MODULES(X11, x11) PKG_CHECK_MODULES(JAVASCRIPT_CORE_GTK, javascriptcoregtk-3.0, , AC_MSG_RESULT(javascriptcoregtk not installed)) diff --git a/gnome/src/Makefile.am b/gnome/src/Makefile.am index eb80e713779935911dc2f7755b16a91357824bcd..8a0878d10dc1a103152e858a24fe12dfd0127272 100644 --- a/gnome/src/Makefile.am +++ b/gnome/src/Makefile.am @@ -28,13 +28,14 @@ sflphone_client_gnome_SOURCES = \ reqaccount.c \ eel-gconf-extensions.c \ shortcuts.c \ - str_utils.c + str_utils.c \ + gtk2_wrappers.c noinst_HEADERS = actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \ reqaccount.h sflphone_const.h uimanager.h accountlist.h \ sliders.h statusicon.h callable_obj.h conference_obj.h \ shortcuts.h eel-gconf-extensions.h logger.h imwindow.h \ - unused.h str_utils.h + unused.h str_utils.h gtk2_wrappers.h sflphone_client_gnome_LDADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) \ $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(X11_LIBS) \ diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 3ef15b51a39bc946bd2c34ed37619a931a508b2f..977014fefc6841dc89a5892d35347b8419525166 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -40,6 +40,7 @@ #include <gtk/gtk.h> #include "config.h" +#include "gtk2_wrappers.h" #include "str_utils.h" #include "logger.h" #include "actions.h" diff --git a/gnome/src/config/accountlistconfigdialog.c b/gnome/src/config/accountlistconfigdialog.c index 27560b0200c74d898e506bc36f84768f53563fb5..6a8b47f0bff79753dde29220942560adbe7ad779 100644 --- a/gnome/src/config/accountlistconfigdialog.c +++ b/gnome/src/config/accountlistconfigdialog.c @@ -39,6 +39,7 @@ #include "utils.h" #include "unused.h" #include "logger.h" +#include "gtk2_wrappers.h" #include <glib/gi18n.h> #include <string.h> diff --git a/gnome/src/config/addressbook-config.c b/gnome/src/config/addressbook-config.c index 3eb74d378f9db063988bbffe9c3dc1ff3959b0f2..1832d38e8136395bae6d6fc2f882382aedd371ce 100644 --- a/gnome/src/config/addressbook-config.c +++ b/gnome/src/config/addressbook-config.c @@ -29,6 +29,7 @@ */ #include "addressbook-config.h" +#include "gtk2_wrappers.h" #include "str_utils.h" #include "dbus.h" #include "unused.h" diff --git a/gnome/src/config/assistant.c b/gnome/src/config/assistant.c index bc74e9cf2c4122655ce2a14d17f8f1ebf06247a0..beeda0b8adc7efa96725e3068eb087ec99948209 100644 --- a/gnome/src/config/assistant.c +++ b/gnome/src/config/assistant.c @@ -30,6 +30,7 @@ #include <string.h> #include <glib/gi18n.h> +#include "gtk2_wrappers.h" #include "unused.h" #include "assistant.h" #include "logger.h" diff --git a/gnome/src/config/audioconf.c b/gnome/src/config/audioconf.c index 9159586cfe00b65d0b2097f4408aa1eec44887f8..02b1f1f096ab9abb15b7afbe51c0e5f87c3f8691 100644 --- a/gnome/src/config/audioconf.c +++ b/gnome/src/config/audioconf.c @@ -29,6 +29,7 @@ */ #include <glib/gi18n.h> +#include "gtk2_wrappers.h" #include "str_utils.h" #include "audioconf.h" #include "utils.h" diff --git a/gnome/src/config/hooks-config.c b/gnome/src/config/hooks-config.c index 2ff4dc500346fc4cf39a6248acbd2e68dbb8f821..cfbc79e44d4a2d766132089f63c85e2a8370784f 100644 --- a/gnome/src/config/hooks-config.c +++ b/gnome/src/config/hooks-config.c @@ -29,6 +29,7 @@ */ #include <glib/gi18n.h> +#include "gtk2_wrappers.h" #include "str_utils.h" #include "hooks-config.h" #include "dbus.h" diff --git a/gnome/src/config/preferencesdialog.c b/gnome/src/config/preferencesdialog.c index 87c114ac4367897b51335326a97d71994fb51197..fb281af2fd4d6b85389f4aa3514e47e0f72c80f9 100644 --- a/gnome/src/config/preferencesdialog.c +++ b/gnome/src/config/preferencesdialog.c @@ -39,6 +39,7 @@ #include <string.h> #include <assert.h> +#include "gtk2_wrappers.h" #include "eel-gconf-extensions.h" #include "dbus.h" #include "logger.h" diff --git a/gnome/src/config/shortcuts-config.c b/gnome/src/config/shortcuts-config.c index 4c8365dff85cd31feecc6d7fb65bcf6a296d8c2f..f6a31c82c03a17ab84bae5cba7e8b28ecd71bf66 100644 --- a/gnome/src/config/shortcuts-config.c +++ b/gnome/src/config/shortcuts-config.c @@ -28,6 +28,7 @@ * as that of the covered work. */ +#include "gtk2_wrappers.h" #include <glib/gi18n.h> #include <gdk/gdk.h> #include <X11/XKBlib.h> diff --git a/gnome/src/config/tlsadvanceddialog.c b/gnome/src/config/tlsadvanceddialog.c index 7c77eba19ae67b3268fbc1f8b515fa0899b8a135..b3f4c0d61a06e3b3c99aac7aaea77bf1f5ed5204 100644 --- a/gnome/src/config/tlsadvanceddialog.c +++ b/gnome/src/config/tlsadvanceddialog.c @@ -29,6 +29,7 @@ */ #include "tlsadvanceddialog.h" +#include "gtk2_wrappers.h" #include "str_utils.h" #include "sflphone_const.h" #include "mainwindow.h" diff --git a/gnome/src/contacts/calltree.c b/gnome/src/contacts/calltree.c index b945561888aa39ec0bcda383086b20f084fe9df1..1c909b578ece78cc42b2ab0d9ccf0791236383d9 100644 --- a/gnome/src/contacts/calltree.c +++ b/gnome/src/contacts/calltree.c @@ -36,6 +36,7 @@ #include <string.h> #include <stdlib.h> +#include "gtk2_wrappers.h" #include "eel-gconf-extensions.h" #include "unused.h" #include "dbus.h" diff --git a/gnome/src/contacts/searchbar.c b/gnome/src/contacts/searchbar.c index 1ac515b24649874904f06ebb2582ecbc396d04ff..2fc06edb832a224a2a8ccc9fb0845a7e4943ed72 100644 --- a/gnome/src/contacts/searchbar.c +++ b/gnome/src/contacts/searchbar.c @@ -32,6 +32,7 @@ */ #include <glib/gi18n.h> +#include "gtk2_wrappers.h" #include "searchbar.h" #include "calltree.h" #include "calltab.h" @@ -46,18 +47,18 @@ static GtkWidget * searchbox; static GtkWidget * addressbookentry; static GtkWidget * cbox; -static GtkListStore * liststore = NULL; +static GtkListStore * liststore; static gint cboxSignalId; -static GtkWidget *menu = NULL; +static GtkWidget *menu; /** * Searchbar icons */ -static GdkPixbuf *incoming_pixbuf = NULL; -static GdkPixbuf *outgoing_pixbuf = NULL; -static GdkPixbuf *missed_pixbuf = NULL; +static GdkPixbuf *incoming_pixbuf; +static GdkPixbuf *outgoing_pixbuf; +static GdkPixbuf *missed_pixbuf; void searchbar_addressbook_activated(GtkEntry *entry, gchar *arg1 UNUSED, gpointer data UNUSED) { diff --git a/gnome/src/gtk2_wrappers.c b/gnome/src/gtk2_wrappers.c new file mode 100644 index 0000000000000000000000000000000000000000..732ea151e0542e0432950f24d91f9c8bee5e9a34 --- /dev/null +++ b/gnome/src/gtk2_wrappers.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +#include "gtk2_wrappers.h" + +#if !GTK_CHECK_VERSION(3, 0, 0) + +GtkWidget *gtk_box_new(GtkOrientation orientation, gint spacing) +{ + if (orientation == GTK_ORIENTATION_HORIZONTAL) + return gtk_hbox_new(FALSE, spacing); + else + return gtk_vbox_new(FALSE, spacing); +} + +GtkWidget* gtk_button_box_new(GtkOrientation orientation) +{ + if (orientation == GTK_ORIENTATION_HORIZONTAL) + return gtk_hbutton_box_new(); + else + return gtk_vbutton_box_new(); +} + +void +gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition *min_size, GtkRequisition *max_size) +{ + if (max_size) + gtk_widget_size_request(widget, max_size); + else if (min_size) + gtk_widget_size_request(widget, min_size); +} + +GdkPixbuf * +gtk_widget_render_icon_pixbuf(GtkWidget *widget, const gchar *stock_id, GtkIconSize size) +{ + return gtk_widget_render_icon(widget, stock_id, size, NULL); +} + +GtkWidget * +gtk_scale_new_with_range(GtkOrientation orientation, gdouble min, gdouble max, + gdouble step) +{ + if (orientation == GTK_ORIENTATION_HORIZONTAL) + return gtk_hscale_new_with_range(min, max, step); + else + return gtk_vscale_new_with_range(min, max, step); +} + +void +gtk_combo_box_text_append(GtkComboBoxText *combo_box, const gchar *id, const gchar *text) +{ + g_assert(!id); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text); +} + +#endif diff --git a/gnome/src/gtk2_wrappers.h b/gnome/src/gtk2_wrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..aa28a117a34101dcc4dcb89a7c22d42c69512ae9 --- /dev/null +++ b/gnome/src/gtk2_wrappers.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +#ifndef BOX_H_ +#define BOX_H_ + +#include <gtk/gtk.h> + +/* Wrappers needed if using gtk2 */ +#if !GTK_CHECK_VERSION(3, 0, 0) +GtkWidget* +gtk_box_new(GtkOrientation orientation, gint spacing); + +GtkWidget* +gtk_button_box_new(GtkOrientation orientation); + +void +gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition *min_size, GtkRequisition *max_size); + +GdkPixbuf * +gtk_widget_render_icon_pixbuf(GtkWidget *widget, const gchar *stock_id, GtkIconSize size); + +GtkWidget * +gtk_scale_new_with_range(GtkOrientation orientation, gdouble min, gdouble max, + gdouble step); + +void +gtk_combo_box_text_append(GtkComboBoxText *combo_box, const gchar *id, const gchar *text); + +#endif + +#endif // BOX_H_ diff --git a/gnome/src/imwindow.c b/gnome/src/imwindow.c index d7841631faf03ba3e6d63419bd60e6b08e31e444..0ddd14d135815e1c8ef954ebcff511c3e0fd3406 100644 --- a/gnome/src/imwindow.c +++ b/gnome/src/imwindow.c @@ -30,7 +30,11 @@ * as that of the covered work. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + +#include "gtk2_wrappers.h" #include "eel-gconf-extensions.h" #include "logger.h" #include "imwindow.h" @@ -41,9 +45,8 @@ #include <sys/stat.h> /** Local variables */ -static GtkWidget *im_window = NULL; -static GtkWidget *im_notebook = NULL; - +static GtkWidget *im_window; +static GtkWidget *im_notebook; static void im_window_init(); diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index 9b079d739650c89ed326e95d7d4b9303b3af8ed1..c57a325fc22573a65a128a813ca9d123fb69aca5 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -30,8 +30,11 @@ * as that of the covered work. */ +#ifdef HAVE_CONFIG_H #include "config.h" -#include "str_utils.h" +#endif + +#include "gtk2_wrappers.h" #include "actions.h" #include "dbus.h" #include "calltree.h" diff --git a/gnome/src/sliders.c b/gnome/src/sliders.c index ab3e40f02c69fde3f7620717cb13cb770a0e7f4b..1994931edc9a0ea89f661e38e79309c1ef2a2325 100644 --- a/gnome/src/sliders.c +++ b/gnome/src/sliders.c @@ -29,6 +29,7 @@ */ #include <glib/gi18n.h> +#include "gtk2_wrappers.h" #include "sliders.h" #include "dbus/dbus.h" #include "actions.h" diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c index b2b16d5d2ef0b42687a0e2d0130a300161348942..8010757981da22d18dd54e37c43bdbb0f2ab1c9a 100644 --- a/gnome/src/uimanager.c +++ b/gnome/src/uimanager.c @@ -28,7 +28,11 @@ * as that of the covered work. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + +#include "gtk2_wrappers.h" #include "str_utils.h" #include "preferencesdialog.h" #include "logger.h" diff --git a/gnome/src/widget/minidialog.c b/gnome/src/widget/minidialog.c index 46de0379601c3fa128dbf11716d039d7260b6f31..c844bc28e1b524f59f325b098a30ad71641658a7 100644 --- a/gnome/src/widget/minidialog.c +++ b/gnome/src/widget/minidialog.c @@ -26,6 +26,7 @@ #include <gtk/gtk.h> #include "unused.h" #include "sflphone_const.h" +#include "gtk2_wrappers.h" #include "minidialog.h" #define HIG_BOX_SPACE 6