[gitg] Build with deprecations and gseal enabled
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Build with deprecations and gseal enabled
- Date: Sun, 30 May 2010 15:23:03 +0000 (UTC)
commit cdb49c40db56b4a31d49bdd75e835e284495c7b5
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun May 30 17:22:54 2010 +0200
Build with deprecations and gseal enabled
configure.ac | 23 ++++++++++++++---
gitg/gitg-color.c | 18 +++++++-------
gitg/gitg-color.h | 16 ++++++------
gitg/gitg-commit-view.c | 20 +++++++++++----
gitg/gitg-debug.c | 6 +++-
gitg/gitg-debug.h | 4 +-
gitg/gitg-diff-line-renderer.c | 9 ++++--
gitg/gitg-dirs.c | 2 +-
gitg/gitg-dirs.h | 6 ++--
gitg/gitg-dnd.c | 8 +++---
gitg/gitg-lane.c | 12 ++++----
gitg/gitg-lane.h | 12 ++++----
gitg/gitg-preferences.c | 2 +-
gitg/gitg-preferences.h | 4 +-
gitg/gitg-repository-dialog.c | 2 +-
gitg/gitg-repository-dialog.h | 2 +-
gitg/gitg-revision-view.c | 20 +++++++-------
gitg/gitg-runner.c | 2 +-
gitg/gitg-runner.h | 2 +-
gitg/gitg-utils.c | 21 ++++++++++------
gitg/gitg-utils.h | 2 +-
gitg/gitg-window.c | 53 ++++++++++++++++++++++++++++-----------
22 files changed, 152 insertions(+), 94 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e37fed8..9a2929c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,13 +66,28 @@ PKG_CHECK_MODULES(PACKAGE, [
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-AC_ARG_ENABLE([bundle],
- AS_HELP_STRING([--enable-bundle],[Enable building bundle (default: disabled)]),
- [enable_bundle=$enableval],
- [enable_bundle=no])
+GNOME_COMPILE_WARNINGS(yes)
if test "x$USE_MAINTAINER_MODE" = "xyes"; then
PACKAGE_CFLAGS="$PACKAGE_CFLAGS -Wall -Werror -Wuninitialized -Wmissing-declarations"
+enable_deprecations="yes"
+fi
+
+
+AC_ARG_ENABLE(deprecations,
+ [AS_HELP_STRING([--enable-deprecations],
+ [warn about deprecated usages [default=no]])],
+ [enable_deprecations=$enableval])
+
+if test "$enable_deprecations" = "yes"; then
+ DISABLE_DEPRECATED_CFLAGS="\
+-DGSEAL_ENABLE \
+-DG_DISABLE_DEPRECATED \
+-DGDK_DISABLE_DEPRECATED \
+-DGTK_DISABLE_DEPRECATED \
+-DGDK_PIXBUF_DISABLE_DEPRECATED \
+-DGNOME_DISABLE_DEPRECATED"
+ AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
fi
AC_SUBST(PACKAGE_CFLAGS)
diff --git a/gitg/gitg-color.c b/gitg/gitg-color.c
index aca68c0..d5eeb85 100644
--- a/gitg/gitg-color.c
+++ b/gitg/gitg-color.c
@@ -45,13 +45,13 @@ static gchar const *palette[] = {
};
void
-gitg_color_reset()
+gitg_color_reset (void)
{
current_index = 0;
}
void
-gitg_color_get(GitgColor *color, gdouble *r, gdouble *g, gdouble *b)
+gitg_color_get (GitgColor *color, gdouble *r, gdouble *g, gdouble *b)
{
gchar const *spec = palette[color->index];
GdkColor c;
@@ -64,7 +64,7 @@ gitg_color_get(GitgColor *color, gdouble *r, gdouble *g, gdouble *b)
}
void
-gitg_color_set_cairo_source(GitgColor *color, cairo_t *cr)
+gitg_color_set_cairo_source (GitgColor *color, cairo_t *cr)
{
gdouble r, g, b;
@@ -73,7 +73,7 @@ gitg_color_set_cairo_source(GitgColor *color, cairo_t *cr)
}
static gint8
-next_index()
+next_index ()
{
gint8 next = current_index++;
@@ -84,7 +84,7 @@ next_index()
}
GitgColor *
-gitg_color_next()
+gitg_color_next (void)
{
GitgColor *res = g_new(GitgColor, 1);
res->ref_count = 1;
@@ -94,14 +94,14 @@ gitg_color_next()
}
GitgColor *
-gitg_color_next_index(GitgColor *color)
+gitg_color_next_index (GitgColor *color)
{
color->index = next_index();
return color;
}
GitgColor *
-gitg_color_copy(GitgColor *color)
+gitg_color_copy (GitgColor *color)
{
GitgColor *copy = g_new(GitgColor, 1);
copy->ref_count = 1;
@@ -111,7 +111,7 @@ gitg_color_copy(GitgColor *color)
}
GitgColor *
-gitg_color_ref(GitgColor *color)
+gitg_color_ref (GitgColor *color)
{
if (!color)
return NULL;
@@ -121,7 +121,7 @@ gitg_color_ref(GitgColor *color)
}
GitgColor *
-gitg_color_unref(GitgColor *color)
+gitg_color_unref (GitgColor *color)
{
if (!color)
return NULL;
diff --git a/gitg/gitg-color.h b/gitg/gitg-color.h
index 3c68ceb..2a3fd1f 100644
--- a/gitg/gitg-color.h
+++ b/gitg/gitg-color.h
@@ -34,14 +34,14 @@ struct _GitgColor
gint8 index;
};
-void gitg_color_reset();
-void gitg_color_get(GitgColor *color, gdouble *r, gdouble *g, gdouble *b);
-void gitg_color_set_cairo_source(GitgColor *color, cairo_t *cr);
+void gitg_color_reset (void);
+void gitg_color_get (GitgColor *color, gdouble *r, gdouble *g, gdouble *b);
+void gitg_color_set_cairo_source (GitgColor *color, cairo_t *cr);
-GitgColor *gitg_color_next();
-GitgColor *gitg_color_next_index(GitgColor *color);
-GitgColor *gitg_color_ref(GitgColor *color);
-GitgColor *gitg_color_copy(GitgColor *color);
-GitgColor *gitg_color_unref(GitgColor *color);
+GitgColor *gitg_color_next (void);
+GitgColor *gitg_color_next_index (GitgColor *color);
+GitgColor *gitg_color_ref (GitgColor *color);
+GitgColor *gitg_color_copy (GitgColor *color);
+GitgColor *gitg_color_unref (GitgColor *color);
#endif /* __GITG_COLOR_H__ */
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index 06e819f..a0cab69 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -1898,12 +1898,17 @@ on_staged_button_press(GtkWidget *widget, GdkEventButton *event, GitgCommitView
}
static gboolean
-on_unstaged_motion(GtkWidget *widget, GdkEventMotion *event, GitgCommitView *view)
+on_unstaged_motion (GtkWidget *widget, GdkEventMotion *event, GitgCommitView *view)
{
if (column_icon_test(view->priv->tree_view_unstaged, event->x, event->y, NULL))
- gdk_window_set_cursor(widget->window, view->priv->hand);
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (widget),
+ view->priv->hand);
+ }
else
- gdk_window_set_cursor(widget->window, NULL);
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
+ }
return FALSE;
}
@@ -1912,9 +1917,14 @@ static gboolean
on_staged_motion(GtkWidget *widget, GdkEventMotion *event, GitgCommitView *view)
{
if (column_icon_test(view->priv->tree_view_staged, event->x, event->y, NULL))
- gdk_window_set_cursor(widget->window, view->priv->hand);
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (widget),
+ view->priv->hand);
+ }
else
- gdk_window_set_cursor(widget->window, NULL);
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
+ }
return FALSE;
}
diff --git a/gitg/gitg-debug.c b/gitg/gitg-debug.c
index 854b2cb..175d035 100644
--- a/gitg/gitg-debug.c
+++ b/gitg/gitg-debug.c
@@ -31,12 +31,14 @@ static guint debug_enabled = GITG_DEBUG_NONE;
debug_enabled |= name; \
}
-void gitg_debug_init()
+void
+gitg_debug_init (void)
{
DEBUG_FROM_ENV(GITG_DEBUG_RUNNER);
}
-gboolean gitg_debug_enabled(guint debug)
+gboolean
+gitg_debug_enabled (guint debug)
{
return debug_enabled & debug;
}
diff --git a/gitg/gitg-debug.h b/gitg/gitg-debug.h
index bdf15b2..5c5a493 100644
--- a/gitg/gitg-debug.h
+++ b/gitg/gitg-debug.h
@@ -31,8 +31,8 @@ enum
GITG_DEBUG_RUNNER = 1 << 0
};
-void gitg_debug_init();
-gboolean gitg_debug_enabled(guint debug);
+void gitg_debug_init (void);
+gboolean gitg_debug_enabled (guint debug);
#endif /* __GITG_DEBUG_H__ */
diff --git a/gitg/gitg-diff-line-renderer.c b/gitg/gitg-diff-line-renderer.c
index 29561dc..ecae376 100644
--- a/gitg/gitg-diff-line-renderer.c
+++ b/gitg/gitg-diff-line-renderer.c
@@ -217,6 +217,7 @@ render_lines (GitgDiffLineRenderer *lr,
gchar new_str[16];
guint xpad;
guint ypad;
+ GtkStyle *style;
PangoLayout *layout = gtk_widget_create_pango_layout (widget, "");
pango_layout_set_width (layout, cell_area->width / 2);
@@ -244,7 +245,9 @@ render_lines (GitgDiffLineRenderer *lr,
g_object_get (lr, "xpad", &xpad, "ypad", &ypad, NULL);
pango_layout_set_text (layout, old_str, -1);
- gtk_paint_layout (widget->style,
+ style = gtk_widget_get_style (widget);
+
+ gtk_paint_layout (style,
window,
gtk_widget_get_state (widget),
FALSE,
@@ -256,7 +259,7 @@ render_lines (GitgDiffLineRenderer *lr,
layout);
pango_layout_set_text (layout, new_str, -1);
- gtk_paint_layout (widget->style,
+ gtk_paint_layout (style,
window,
gtk_widget_get_state (widget),
FALSE,
@@ -269,7 +272,7 @@ render_lines (GitgDiffLineRenderer *lr,
g_object_unref (layout);
- gtk_paint_vline (widget->style,
+ gtk_paint_vline (style,
window,
gtk_widget_get_state (widget),
NULL,
diff --git a/gitg/gitg-dirs.c b/gitg/gitg-dirs.c
index 27ca171..b0e9640 100644
--- a/gitg/gitg-dirs.c
+++ b/gitg/gitg-dirs.c
@@ -24,7 +24,7 @@
#include "config.h"
gchar const *
-gitg_dirs_get_data_dir()
+gitg_dirs_get_data_dir (void)
{
static gchar *datadir = NULL;
diff --git a/gitg/gitg-dirs.h b/gitg/gitg-dirs.h
index ee7cafb..a6a2755 100644
--- a/gitg/gitg-dirs.h
+++ b/gitg/gitg-dirs.h
@@ -25,8 +25,8 @@
#include <glib.h>
-gchar const *gitg_dirs_get_data_dir();
-gchar *gitg_dirs_get_data_filename(gchar const *first, ...) G_GNUC_NULL_TERMINATED;
-void gitg_dirs_initialize(int argc, char **argv);
+gchar const *gitg_dirs_get_data_dir (void);
+gchar *gitg_dirs_get_data_filename (gchar const *first, ...) G_GNUC_NULL_TERMINATED;
+void gitg_dirs_initialize (int argc, char **argv);
#endif /* __GITG_DIRS_H__ */
diff --git a/gitg/gitg-dnd.c b/gitg/gitg-dnd.c
index acb10f5..a55d84d 100644
--- a/gitg/gitg-dnd.c
+++ b/gitg/gitg-dnd.c
@@ -527,7 +527,7 @@ vertical_autoscroll (GitgDndData *data)
GtkAdjustment *adj = gtk_tree_view_get_vadjustment (data->tree_view);
value = CLAMP (gtk_adjustment_get_value (adj) + offset, 0.0,
- adj->upper - adj->page_size);
+ gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
gtk_adjustment_set_value (adj, value);
return TRUE;
@@ -883,7 +883,7 @@ gitg_drag_source_data_get_cb (GtkWidget *widget,
data->xds_destination = g_strdup (destination);
gtk_selection_data_set (selection,
- selection->target,
+ gtk_selection_data_get_target (selection),
8,
(guchar const *)"S",
1);
@@ -891,7 +891,7 @@ gitg_drag_source_data_get_cb (GtkWidget *widget,
else
{
gtk_selection_data_set (selection,
- selection->target,
+ gtk_selection_data_get_target (selection),
8,
(guchar const *)"E",
1);
@@ -916,7 +916,7 @@ gitg_drag_source_data_get_cb (GtkWidget *widget,
data->revision);
gtk_selection_data_set (selection,
- selection->target,
+ gtk_selection_data_get_target (selection),
8,
(guchar const *)treeish,
strlen (treeish));
diff --git a/gitg/gitg-lane.c b/gitg/gitg-lane.c
index 9c7a50a..f03e143 100644
--- a/gitg/gitg-lane.c
+++ b/gitg/gitg-lane.c
@@ -24,7 +24,7 @@
/* GitgLane functions */
GitgLane *
-gitg_lane_copy(GitgLane *lane)
+gitg_lane_copy (GitgLane *lane)
{
GitgLane *copy = g_slice_new(GitgLane);
copy->color = gitg_color_ref(lane->color);
@@ -35,7 +35,7 @@ gitg_lane_copy(GitgLane *lane)
}
GitgLane *
-gitg_lane_dup(GitgLane *lane)
+gitg_lane_dup (GitgLane *lane)
{
GitgLane *dup = g_slice_new(GitgLane);
dup->color = gitg_color_copy(lane->color);
@@ -46,7 +46,7 @@ gitg_lane_dup(GitgLane *lane)
}
void
-gitg_lane_free(GitgLane *lane)
+gitg_lane_free (GitgLane *lane)
{
gitg_color_unref(lane->color);
g_slist_free(lane->from);
@@ -58,13 +58,13 @@ gitg_lane_free(GitgLane *lane)
}
GitgLane *
-gitg_lane_new()
+gitg_lane_new (void)
{
return gitg_lane_new_with_color(NULL);
}
GitgLane *
-gitg_lane_new_with_color(GitgColor *color)
+gitg_lane_new_with_color (GitgColor *color)
{
GitgLane *lane = g_slice_new0(GitgLane);
lane->color = color ? gitg_color_ref(color) : gitg_color_next();
@@ -73,7 +73,7 @@ gitg_lane_new_with_color(GitgColor *color)
}
GitgLaneBoundary *
-gitg_lane_convert_boundary(GitgLane *lane, GitgLaneType type)
+gitg_lane_convert_boundary (GitgLane *lane, GitgLaneType type)
{
GitgLaneBoundary *boundary = g_slice_new(GitgLaneBoundary);
diff --git a/gitg/gitg-lane.h b/gitg/gitg-lane.h
index d679c32..444a944 100644
--- a/gitg/gitg-lane.h
+++ b/gitg/gitg-lane.h
@@ -53,12 +53,12 @@ typedef struct
Hash hash;
} GitgLaneBoundary;
-GitgLane *gitg_lane_new();
-GitgLane *gitg_lane_new_with_color(GitgColor *color);
-GitgLane *gitg_lane_copy(GitgLane *lane);
-GitgLane *gitg_lane_dup(GitgLane *lane);
+GitgLane *gitg_lane_new (void);
+GitgLane *gitg_lane_new_with_color (GitgColor *color);
+GitgLane *gitg_lane_copy (GitgLane *lane);
+GitgLane *gitg_lane_dup (GitgLane *lane);
-void gitg_lane_free(GitgLane *lane);
-GitgLaneBoundary *gitg_lane_convert_boundary(GitgLane *lane, GitgLaneType type);
+void gitg_lane_free (GitgLane *lane);
+GitgLaneBoundary *gitg_lane_convert_boundary (GitgLane *lane, GitgLaneType type);
#endif /* __GITG_LANE_H__ */
diff --git a/gitg/gitg-preferences.c b/gitg/gitg-preferences.c
index 6b93c09..06f63f5 100644
--- a/gitg/gitg-preferences.c
+++ b/gitg/gitg-preferences.c
@@ -545,7 +545,7 @@ gitg_preferences_init(GitgPreferences *self)
}
GitgPreferences *
-gitg_preferences_get_default()
+gitg_preferences_get_default(void)
{
static GitgPreferences *preferences = NULL;
diff --git a/gitg/gitg-preferences.h b/gitg/gitg-preferences.h
index 9ec97aa..ecdb270 100644
--- a/gitg/gitg-preferences.h
+++ b/gitg/gitg-preferences.h
@@ -58,8 +58,8 @@ struct _GitgPreferencesClass {
GObjectClass parent_class;
};
-GType gitg_preferences_get_type(void) G_GNUC_CONST;
-GitgPreferences *gitg_preferences_get_default();
+GType gitg_preferences_get_type (void) G_GNUC_CONST;
+GitgPreferences *gitg_preferences_get_default (void);
G_END_DECLS
diff --git a/gitg/gitg-repository-dialog.c b/gitg/gitg-repository-dialog.c
index e7490b5..de5085b 100644
--- a/gitg/gitg-repository-dialog.c
+++ b/gitg/gitg-repository-dialog.c
@@ -572,7 +572,7 @@ gitg_repository_dialog_present(GitgWindow *window)
}
void
-gitg_repository_dialog_close ()
+gitg_repository_dialog_close (void)
{
if (repository_dialog)
{
diff --git a/gitg/gitg-repository-dialog.h b/gitg/gitg-repository-dialog.h
index 15e1131..e712edb 100644
--- a/gitg/gitg-repository-dialog.h
+++ b/gitg/gitg-repository-dialog.h
@@ -55,7 +55,7 @@ struct _GitgRepositoryDialogClass
GType gitg_repository_dialog_get_type (void) G_GNUC_CONST;
GitgRepositoryDialog *gitg_repository_dialog_present(GitgWindow *window);
-void gitg_repository_dialog_close ();
+void gitg_repository_dialog_close (void);
G_END_DECLS
diff --git a/gitg/gitg-revision-view.c b/gitg/gitg-revision-view.c
index e038d0c..b27dd47 100644
--- a/gitg/gitg-revision-view.c
+++ b/gitg/gitg-revision-view.c
@@ -439,15 +439,15 @@ gitg_revision_view_class_init(GitgRevisionViewClass *klass)
static void
on_diff_files_begin_loading(GitgRunner *runner, GitgRevisionView *self)
{
- GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(GTK_WIDGET(self->priv->diff_files)->window, cursor);
- gdk_cursor_unref(cursor);
+ GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (self->priv->diff_files)), cursor);
+ gdk_cursor_unref (cursor);
}
static void
on_diff_files_end_loading(GitgRunner *runner, gboolean cancelled, GitgRevisionView *self)
{
- gdk_window_set_cursor(GTK_WIDGET(self->priv->diff_files)->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(self->priv->diff_files)), NULL);
}
static gboolean
@@ -531,15 +531,15 @@ on_diff_files_update(GitgRunner *runner, gchar **buffer, GitgRevisionView *self)
static void
on_diff_begin_loading(GitgRunner *runner, GitgRevisionView *self)
{
- GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(GTK_WIDGET(self->priv->diff)->window, cursor);
- gdk_cursor_unref(cursor);
+ GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(self->priv->diff)), cursor);
+ gdk_cursor_unref (cursor);
}
static void
on_diff_end_loading(GitgRunner *runner, gboolean cancelled, GitgRevisionView *self)
{
- gdk_window_set_cursor(GTK_WIDGET(self->priv->diff)->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(self->priv->diff)), NULL);
if (cancelled)
return;
@@ -666,8 +666,8 @@ update_parents(GitgRevisionView *self, GitgRevision *revision)
GtkWidget *widget = make_parent_label(self, parents[i]);
gtk_table_attach(self->priv->parents, widget, 0, 1, i, i + 1, GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 0, 0);
- gtk_widget_realize(widget);
- gdk_window_set_cursor(widget->window, cursor);
+ gtk_widget_realize (widget);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
/* find subject */
gitg_utils_sha1_to_hash(parents[i], hash);
diff --git a/gitg/gitg-runner.c b/gitg/gitg-runner.c
index 96cb021..6c9991e 100644
--- a/gitg/gitg-runner.c
+++ b/gitg/gitg-runner.c
@@ -97,7 +97,7 @@ async_data_free (AsyncData *data)
}
GQuark
-gitg_runner_error_quark()
+gitg_runner_error_quark (void)
{
static GQuark quark = 0;
diff --git a/gitg/gitg-runner.h b/gitg/gitg-runner.h
index 54a5c16..300919a 100644
--- a/gitg/gitg-runner.h
+++ b/gitg/gitg-runner.h
@@ -91,7 +91,7 @@ void gitg_runner_cancel (GitgRunner *runner);
void gitg_runner_set_environment (GitgRunner *runner, gchar const **environment);
void gitg_runner_add_environment (GitgRunner *runner, gchar const *key, gchar const *value);
-GQuark gitg_runner_error_quark ();
+GQuark gitg_runner_error_quark (void);
G_END_DECLS
diff --git a/gitg/gitg-utils.c b/gitg/gitg-utils.c
index 705d19b..361c7e3 100644
--- a/gitg/gitg-utils.c
+++ b/gitg/gitg-utils.c
@@ -367,20 +367,22 @@ gitg_utils_menu_position_under_widget (GtkMenu *menu,
GtkWidget *w = GTK_WIDGET (user_data);
GtkRequisition requisition;
- gdk_window_get_origin (w->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (w), x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (w, &alloc);
+
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{
- *x += w->allocation.x + w->allocation.width - requisition.width;
+ *x += alloc.x + alloc.width - requisition.width;
}
else
{
- *x += w->allocation.x;
+ *x += alloc.x;
}
- *y += w->allocation.y + w->allocation.height;
-
+ *y += alloc.y + alloc.height;
*push_in = TRUE;
}
@@ -407,7 +409,7 @@ gitg_utils_menu_position_under_tree_view (GtkMenu *menu,
GtkTreePath *path;
GdkRectangle rect;
- gdk_window_get_origin (GTK_WIDGET (tree)->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (tree)), x, y);
path = gtk_tree_model_get_path (model, &iter);
gtk_tree_view_get_cell_area (tree, path,
@@ -435,7 +437,7 @@ gitg_utils_menu_position_under_tree_view (GtkMenu *menu,
}
gchar *
-gitg_utils_get_monospace_font_name()
+gitg_utils_get_monospace_font_name (void)
{
GConfClient *client = gconf_client_get_default();
gchar *name = gconf_client_get_string(client, "/desktop/gnome/interface/monospace_font_name", NULL);
@@ -562,7 +564,10 @@ paned_set_position (GtkPaned *paned, gint position, gboolean reversed)
}
else
{
- gtk_paned_set_position (paned, GTK_WIDGET (paned)->allocation.width - position);
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (GTK_WIDGET (paned), &alloc);
+
+ gtk_paned_set_position (paned, alloc.width - position);
}
}
diff --git a/gitg/gitg-utils.h b/gitg/gitg-utils.h
index fe3008b..ff1dec0 100644
--- a/gitg/gitg-utils.h
+++ b/gitg/gitg-utils.h
@@ -61,7 +61,7 @@ gint gitg_utils_sort_names(gchar const *s1, gchar const *s2);
void gitg_utils_menu_position_under_widget(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data);
void gitg_utils_menu_position_under_tree_view(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data);
-gchar *gitg_utils_get_monospace_font_name();
+gchar *gitg_utils_get_monospace_font_name (void);
void gitg_utils_set_monospace_font(GtkWidget *widget);
gchar *gitg_utils_timestamp_to_str(guint64 timestamp);
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 32f49cb..ac55e82 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -752,39 +752,54 @@ static void
save_state(GitgWindow *window)
{
GitgSettings *settings = gitg_settings_get_default();
- GtkAllocation *allocation = &(GTK_WIDGET(window)->allocation);
+ GtkAllocation allocation;
+ gint position;
- gitg_settings_set_window_width(settings, allocation->width);
- gitg_settings_set_window_height(settings, allocation->height);
+ gtk_widget_get_allocation (GTK_WIDGET(window), &allocation);
+
+ gitg_settings_set_window_width (settings, allocation.width);
+ gitg_settings_set_window_height (settings, allocation.height);
if (gtk_widget_get_mapped (window->priv->vpaned_main))
{
+ position = gtk_paned_get_position (GTK_PANED (window->priv->vpaned_main));
gitg_settings_set_vpaned_main_position (settings,
- gtk_paned_get_position(GTK_PANED(window->priv->vpaned_main)));
+ position);
}
if (gtk_widget_get_mapped (window->priv->vpaned_commit))
{
+ position = gtk_paned_get_position (GTK_PANED (window->priv->vpaned_commit));
gitg_settings_set_vpaned_commit_position (settings,
- gtk_paned_get_position(GTK_PANED(window->priv->vpaned_commit)));
+ position);
}
if (gtk_widget_get_mapped (window->priv->hpaned_commit1))
{
+ position = gtk_paned_get_position (GTK_PANED (window->priv->hpaned_commit1));
gitg_settings_set_hpaned_commit1_position (settings,
- gtk_paned_get_position(GTK_PANED(window->priv->hpaned_commit1)));
+ position);
}
if (gtk_widget_get_mapped (window->priv->hpaned_commit2))
{
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (GTK_WIDGET (window->priv->hpaned_commit2),
+ &alloc);
+
+ position = gtk_paned_get_position (GTK_PANED (window->priv->hpaned_commit2));
+
gitg_settings_set_hpaned_commit2_position (settings,
- GTK_WIDGET (window->priv->hpaned_commit2)->allocation.width -
- gtk_paned_get_position(GTK_PANED(window->priv->hpaned_commit2)));
+ alloc.width -
+ position);
}
- gitg_settings_set_revision_tree_view_position(settings, gtk_paned_get_position(GTK_PANED(window->priv->revision_tree_view)));
+ position = gtk_paned_get_position (GTK_PANED (window->priv->revision_tree_view));
+ gitg_settings_set_revision_tree_view_position (settings,
+ position);
- gitg_settings_save(settings);
+ gitg_settings_save (settings);
}
static gboolean
@@ -923,7 +938,7 @@ on_repository_loaded (GitgRepository *repository, GitgWindow *window)
gtk_statusbar_push(window->priv->statusbar, 0, msg);
g_free(msg);
- gdk_window_set_cursor(GTK_WIDGET(window->priv->tree_view)->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window->priv->tree_view)), NULL);
Hash hash = {0,};
@@ -1319,7 +1334,7 @@ static void
on_repository_load (GitgRepository *repository, GitgWindow *window)
{
GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (GTK_WIDGET (window->priv->tree_view)->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window->priv->tree_view)), cursor);
gdk_cursor_unref (cursor);
gtk_statusbar_push (window->priv->statusbar, 0, _("Begin loading repository"));
@@ -1843,10 +1858,18 @@ is_boundary_from_event(GitgWindow *window, GdkEventAny *event, gint x, gint y, g
static gboolean
on_tree_view_motion(GtkTreeView *treeview, GdkEventMotion *event, GitgWindow *window)
{
- if (is_boundary_from_event(window, (GdkEventAny *)event, event->x, event->y, NULL))
- gdk_window_set_cursor(GTK_WIDGET(treeview)->window, window->priv->hand);
+ GdkWindow *win;
+
+ win = gtk_widget_get_window (GTK_WIDGET (treeview));
+
+ if (is_boundary_from_event (window, (GdkEventAny *)event, event->x, event->y, NULL))
+ {
+ gdk_window_set_cursor (win, window->priv->hand);
+ }
else
- gdk_window_set_cursor(GTK_WIDGET(treeview)->window, NULL);
+ {
+ gdk_window_set_cursor (win, NULL);
+ }
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]