[giggle/giggle-0-6] Avoid GObject warnings: Use the giggle api instead g_object_get()
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle/giggle-0-6] Avoid GObject warnings: Use the giggle api instead g_object_get()
- Date: Wed, 25 Jan 2012 18:23:54 +0000 (UTC)
commit dfb8e3053e7864d30d8e0ead96462eeeb90504fd
Author: Javier JardÃn <jjardon gnome org>
Date: Fri Jan 20 00:59:45 2012 +0100
Avoid GObject warnings: Use the giggle api instead g_object_get()
src/giggle-diff-view.c | 21 ++++++++++++---------
src/giggle-diff-view.h | 1 +
src/giggle-view-diff.c | 17 +++++++----------
3 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/giggle-diff-view.c b/src/giggle-diff-view.c
index 91d6a31..d7105f8 100644
--- a/src/giggle-diff-view.c
+++ b/src/giggle-diff-view.c
@@ -167,11 +167,7 @@ diff_view_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GiggleDiffView *view;
- GiggleDiffViewPriv *priv;
-
- view = GIGGLE_DIFF_VIEW (object);
- priv = GET_PRIV (view);
+ GiggleDiffView *view = GIGGLE_DIFF_VIEW (object);
switch (param_id) {
case PROP_CURRENT_FILE:
@@ -179,19 +175,19 @@ diff_view_get_property (GObject *object,
break;
case PROP_N_FILES:
- g_value_set_int (value, priv->files->len);
+ g_value_set_int (value, giggle_diff_view_get_n_files (view));
break;
case PROP_CURRENT_HUNK:
- g_value_set_int (value, priv->current_hunk);
+ g_value_set_int (value, giggle_diff_view_get_current_hunk (view));
break;
case PROP_N_HUNKS:
- g_value_set_int (value, priv->hunks->len);
+ g_value_set_int (value, giggle_diff_view_get_n_hunks (view));
break;
case PROP_CURRENT_STYLE:
- g_value_set_int (value, priv->current_style);
+ g_value_set_int (value, giggle_diff_view_get_current_style (view));
break;
default:
@@ -901,6 +897,13 @@ giggle_diff_view_get_current_file (GiggleDiffView *diff_view)
return NULL;
}
+int
+giggle_diff_view_get_n_files (GiggleDiffView *diff_view)
+{
+ g_return_val_if_fail (GIGGLE_IS_DIFF_VIEW (diff_view), 0);
+ return GET_PRIV (diff_view)->files->len;
+}
+
void
giggle_diff_view_set_current_style (GiggleDiffView *diff_view,
int style)
diff --git a/src/giggle-diff-view.h b/src/giggle-diff-view.h
index 6eb8381..de5fe02 100644
--- a/src/giggle-diff-view.h
+++ b/src/giggle-diff-view.h
@@ -79,6 +79,7 @@ void giggle_diff_view_scroll_to_file (GiggleDiffView *diff_view
const char * giggle_diff_view_get_current_file (GiggleDiffView *diff_view);
int giggle_diff_view_get_current_file_nb (GiggleDiffView *diff_view);
+int giggle_diff_view_get_n_files (GiggleDiffView *diff_view);
G_END_DECLS
diff --git a/src/giggle-view-diff.c b/src/giggle-view-diff.c
index 749ef0d..bd52c58 100644
--- a/src/giggle-view-diff.c
+++ b/src/giggle-view-diff.c
@@ -83,19 +83,18 @@ static void
view_diff_update_status (GiggleViewDiff *view)
{
GiggleViewDiffPriv *priv;
+ GiggleDiffView *diff_view;
GtkAction *action;
char *format, *markup;
- int current_hunk, n_hunks, current_style;
- char *current_file;
+ int current_hunk, n_hunks;
+ const gchar *current_file;
priv = GET_PRIV (view);
+ diff_view = GIGGLE_DIFF_VIEW (priv->diff_view);
- g_object_get (priv->diff_view,
- "current-file", ¤t_file,
- "current-hunk", ¤t_hunk,
- "n-hunks", &n_hunks,
- "current-style", ¤t_style,
- NULL);
+ current_file = giggle_diff_view_get_current_file (diff_view);
+ current_hunk = giggle_diff_view_get_current_hunk (diff_view);
+ n_hunks = giggle_diff_view_get_n_hunks (diff_view);
if (priv->action_group) {
gtk_action_group_set_sensitive (priv->action_group, n_hunks > 0);
@@ -121,8 +120,6 @@ view_diff_update_status (GiggleViewDiff *view)
g_free (format);
giggle_tree_view_select_row_by_string (priv->file_view, 0, current_file);
-
- g_free (current_file);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]