[gitg] Make gitg compile with Gtk+ 3.0 if available.



commit 101ff9c7409a95a3cb41d951b5388b04ff44c371
Author: Steve Frécinaux <code istique net>
Date:   Fri May 28 17:03:51 2010 +0200

    Make gitg compile with Gtk+ 3.0 if available.
    
    The selection is done by checking first if gtk+-3.0 is available and
    fall back on gtk+-2.0 otherwise.
    
    This patch also bumps the gtk+ 2.0 requirement to 2.20 because it is
    needed for gtk_widget_get_mapped().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619953

 configure.ac                   |   11 ++++++++++-
 gitg/gitg-cell-renderer-path.h |    2 +-
 gitg/gitg-commit-view.c        |    2 +-
 gitg/gitg-diff-line-renderer.c |    6 +++---
 gitg/gitg-repository.h         |    2 +-
 gitg/gitg-utils.c              |    4 ++--
 gitg/gitg-window.c             |    8 ++++----
 7 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 90d17aa..5fe15a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,8 +45,17 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
 
 AM_GLIB_GNU_GETTEXT
 
+PKG_CHECK_EXISTS([gtk+-3.0 >= 2.90],
+		 [
+			GTK_REQUIRED=gtk+-3.0
+			GTK_REQUIRED_VERSION=2.90.0
+		 ],[
+			GTK_REQUIRED=gtk+-2.0
+			GTK_REQUIRED_VERSION=2.20.0
+		 ])
+
 PKG_CHECK_MODULES(PACKAGE, [
-	gtk+-2.0 >= 2.16.0
+	$GTK_REQUIRED >= $GTK_REQUIRED_VERSION
 	gthread-2.0
 	gtksourceview-2.0 >= 2.8
 	gio-2.0
diff --git a/gitg/gitg-cell-renderer-path.h b/gitg/gitg-cell-renderer-path.h
index 4729466..c3a91be 100644
--- a/gitg/gitg-cell-renderer-path.h
+++ b/gitg/gitg-cell-renderer-path.h
@@ -23,7 +23,7 @@
 #ifndef __GITG_CELL_RENDERER_PATH_H__
 #define __GITG_CELL_RENDERER_PATH_H__
 
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
 #include "gitg-ref.h"
 
 G_BEGIN_DECLS
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index 0888cdd..99e90bd 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -1191,7 +1191,7 @@ gitg_commit_view_set_repository(GitgCommitView *view, GitgRepository *repository
 	if (repository)
 		view->priv->repository = g_object_ref(repository);
 
-	if (GTK_WIDGET_MAPPED(GTK_WIDGET(view)))
+	if (gtk_widget_get_mapped(GTK_WIDGET(view)))
 		initialize_commit(view);
 
 	g_object_notify(G_OBJECT(view), "repository");
diff --git a/gitg/gitg-diff-line-renderer.c b/gitg/gitg-diff-line-renderer.c
index 37e9a1e..1c218b9 100644
--- a/gitg/gitg-diff-line-renderer.c
+++ b/gitg/gitg-diff-line-renderer.c
@@ -121,7 +121,7 @@ gitg_diff_line_renderer_render_impl (GtkCellRenderer      *cell,
 	pango_layout_set_text (layout, old_str, -1);
 	gtk_paint_layout (widget->style,
 	                  window,
-	                  GTK_WIDGET_STATE (widget),
+	                  gtk_widget_get_state (widget),
 	                  FALSE,
 	                  NULL,
 	                  widget,
@@ -133,7 +133,7 @@ gitg_diff_line_renderer_render_impl (GtkCellRenderer      *cell,
 	pango_layout_set_text (layout, new_str, -1);
 	gtk_paint_layout (widget->style,
 	                  window,
-	                  GTK_WIDGET_STATE (widget),
+	                  gtk_widget_get_state (widget),
 	                  FALSE,
 	                  NULL,
 	                  widget,
@@ -146,7 +146,7 @@ gitg_diff_line_renderer_render_impl (GtkCellRenderer      *cell,
 
 	gtk_paint_vline (widget->style,
 	                 window,
-	                 GTK_WIDGET_STATE (widget),
+	                 gtk_widget_get_state (widget),
 	                 NULL,
 	                 widget,
 	                 NULL,
diff --git a/gitg/gitg-repository.h b/gitg/gitg-repository.h
index 307e4a0..799358b 100644
--- a/gitg/gitg-repository.h
+++ b/gitg/gitg-repository.h
@@ -22,7 +22,7 @@
 #ifndef __GITG_REPOSITORY_H__
 #define __GITG_REPOSITORY_H__
 
-#include <gtk/gtktreemodel.h>
+#include <gtk/gtk.h>
 
 #include "gitg-revision.h"
 #include "gitg-runner.h"
diff --git a/gitg/gitg-utils.c b/gitg/gitg-utils.c
index c8d1e97..485a80f 100644
--- a/gitg/gitg-utils.c
+++ b/gitg/gitg-utils.c
@@ -518,7 +518,7 @@ gitg_utils_find_cell_at_pos (GtkTreeView *tree_view, GtkTreeViewColumn *column,
 
 	gtk_tree_view_column_cell_set_cell_data (column, model, &iter, FALSE, FALSE);
 
-	cells = gtk_tree_view_column_get_cell_renderers (column);
+	cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
 	GtkCellRenderer *ret = NULL;
 
 	for (item = cells; item; item = g_list_next (item))
@@ -588,7 +588,7 @@ gitg_utils_restore_pane_position (GtkPaned *paned, gint position, gboolean rever
 {
 	g_return_if_fail (GTK_IS_PANED (paned));
 
-	if (GTK_WIDGET_MAPPED (paned))
+	if (gtk_widget_get_mapped (GTK_WIDGET (paned)))
 	{
 		paned_set_position (paned, position, reversed);
 
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 95eda15..bd19b2f 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -728,25 +728,25 @@ save_state(GitgWindow *window)
 	gitg_settings_set_window_width(settings, allocation->width);
 	gitg_settings_set_window_height(settings, allocation->height);
 
-	if (GTK_WIDGET_MAPPED (window->priv->vpaned_main))
+	if (gtk_widget_get_mapped (window->priv->vpaned_main))
 	{
 		gitg_settings_set_vpaned_main_position (settings,
 			                                    gtk_paned_get_position(GTK_PANED(window->priv->vpaned_main)));
 	}
 
-	if (GTK_WIDGET_MAPPED (window->priv->vpaned_commit))
+	if (gtk_widget_get_mapped (window->priv->vpaned_commit))
 	{
 		gitg_settings_set_vpaned_commit_position (settings,
 			                                      gtk_paned_get_position(GTK_PANED(window->priv->vpaned_commit)));
 	}
 
-	if (GTK_WIDGET_MAPPED (window->priv->hpaned_commit1))
+	if (gtk_widget_get_mapped (window->priv->hpaned_commit1))
 	{
 		gitg_settings_set_hpaned_commit1_position (settings,
 			                                       gtk_paned_get_position(GTK_PANED(window->priv->hpaned_commit1)));
 	}
 
-	if (GTK_WIDGET_MAPPED (window->priv->hpaned_commit2))
+	if (gtk_widget_get_mapped (window->priv->hpaned_commit2))
 	{
 		gitg_settings_set_hpaned_commit2_position (settings,
 			                                       GTK_WIDGET (window->priv->hpaned_commit2)->allocation.width -



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]