[frogr] General cleanup of code based on the output from -pedantic builds.
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] General cleanup of code based on the output from -pedantic builds.
- Date: Fri, 13 May 2011 22:11:55 +0000 (UTC)
commit 76997088b052a9168187a1d976d2a02b641d9001
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Sat May 14 00:10:09 2011 +0200
General cleanup of code based on the output from -pedantic builds.
Ensure that declarations arenot mixed with code, fixed unnecesary
commas at the end of enumerations, removed extra ';' not needed at
some places, and fixed some other minor issues.
examples/example.c | 38 +++--
src/flicksoup/fsp-data.c | 8 +-
src/flicksoup/fsp-data.h | 6 +-
src/flicksoup/fsp-error.c | 360 ++++++++++++++++++------------------
src/flicksoup/fsp-error.h | 2 +-
src/flicksoup/fsp-parser.c | 118 ++++++------
src/flicksoup/fsp-session.c | 244 +++++++++++++-------------
src/frogr-account.c | 95 +++++++----
src/frogr-add-tags-dialog.c | 2 +-
src/frogr-add-to-group-dialog.c | 16 +-
src/frogr-add-to-set-dialog.c | 16 +-
src/frogr-config.c | 167 ++++++++++++-----
src/frogr-controller.c | 143 +++++++++------
src/frogr-create-new-set-dialog.c | 2 +-
src/frogr-details-dialog.c | 6 +-
src/frogr-group.c | 65 ++++----
src/frogr-main-view-model.c | 161 +++++++++--------
src/frogr-main-view.c | 41 +++--
src/frogr-photoset.c | 73 ++++----
src/frogr-picture-loader.c | 19 ++-
src/frogr-picture-uploader.c | 7 +-
src/frogr-picture.c | 221 +++++++++++------------
src/frogr-settings-dialog.c | 4 +-
src/frogr-util.c | 7 +-
src/main.c | 4 +-
25 files changed, 999 insertions(+), 826 deletions(-)
---
diff --git a/examples/example.c b/examples/example.c
index 01e1907..04545a4 100644
--- a/examples/example.c
+++ b/examples/example.c
@@ -142,12 +142,13 @@ get_groups_cb (GObject *object,
}
else
{
- g_print ("[get_groups_cb]::Success! Number of groups found: %d\n",
- g_slist_length (groups_list));
-
gint i = 0;
GSList *item = NULL;
FspDataGroup *group = NULL;
+
+ g_print ("[get_groups_cb]::Success! Number of groups found: %d\n",
+ g_slist_length (groups_list));
+
for (item = groups_list; item; item = g_slist_next (item))
{
group = FSP_DATA_GROUP (item->data);
@@ -179,7 +180,8 @@ get_groups_cb (GObject *object,
FSP_SAFETY_LEVEL_NONE,
FSP_CONTENT_TYPE_PHOTO,
FSP_SEARCH_SCOPE_NONE,
- NULL, upload_cb, get_groups_cb);
+ NULL, upload_cb,
+ (gpointer) get_groups_cb);
g_slist_free (groups_list);
}
@@ -251,7 +253,8 @@ photoset_created_cb (GObject *object,
FSP_SAFETY_LEVEL_NONE,
FSP_CONTENT_TYPE_PHOTO,
FSP_SEARCH_SCOPE_NONE,
- NULL, upload_cb, photoset_created_cb);
+ NULL, upload_cb,
+ (gpointer) photoset_created_cb);
}
}
@@ -272,12 +275,13 @@ get_photosets_cb (GObject *object,
}
else
{
- g_print ("[get_photosets_cb]::Success! Number of photosets found: %d\n",
- g_slist_length (photosets_list));
-
gint i = 0;
GSList *item = NULL;
FspDataPhotoSet *photoset = NULL;
+
+ g_print ("[get_photosets_cb]::Success! Number of photosets found: %d\n",
+ g_slist_length (photosets_list));
+
for (item = photosets_list; item; item = g_slist_next (item))
{
photoset = FSP_DATA_PHOTO_SET (item->data);
@@ -372,11 +376,12 @@ get_tags_list_cb (GObject *object, GAsyncResult *res, gpointer unused)
}
else
{
+ GSList *item = NULL;
+ gchar *tag = NULL;
+
g_print ("[get_tags_list_cb]::Success! Number of tags found: %d\n",
g_slist_length (tags_list));
- GSList *item = NULL;
- gchar *tag = NULL;
for (item = tags_list; item; item = g_slist_next (item))
{
tag = (gchar *) item->data;
@@ -406,7 +411,8 @@ get_tags_list_cb (GObject *object, GAsyncResult *res, gpointer unused)
FSP_SAFETY_LEVEL_NONE,
FSP_CONTENT_TYPE_PHOTO,
FSP_SEARCH_SCOPE_NONE,
- NULL, upload_cb, get_tags_list_cb);
+ NULL, upload_cb,
+ (gpointer) get_tags_list_cb);
}
}
@@ -559,11 +565,15 @@ get_auth_url_cb (GObject *object,
gboolean
do_work (gpointer unused)
{
- FspSession *session = fsp_session_new (API_KEY, SHARED_SECRET, NULL);
+ FspSession *session = NULL;
+ const gchar *api_key = NULL;
+ const gchar *secret = NULL;
+
+ session = fsp_session_new (API_KEY, SHARED_SECRET, NULL);
g_print ("Created FspSession:\n");
- const gchar *api_key = fsp_session_get_api_key (session);
- const gchar *secret = fsp_session_get_secret (session);
+ api_key = fsp_session_get_api_key (session);
+ secret = fsp_session_get_secret (session);
g_print ("\tAPI key: %s\n\tSecret: %s\n\n", api_key, secret);
diff --git a/src/flicksoup/fsp-data.c b/src/flicksoup/fsp-data.c
index d0bd199..2b9a4d5 100644
--- a/src/flicksoup/fsp-data.c
+++ b/src/flicksoup/fsp-data.c
@@ -36,9 +36,9 @@ fsp_data_get_type (void)
FspData*
fsp_data_new (FspDataType type)
{
- g_return_val_if_fail ((type > FSP_UNKNOWN) && (type < FSP_DATA_LAST), NULL);
+ FspData *new_data = NULL;
- FspData *new_data;
+ g_return_val_if_fail ((type > FSP_UNKNOWN) && (type < FSP_DATA_LAST), NULL);
new_data = g_slice_new0 (FspData);
@@ -111,10 +111,10 @@ fsp_data_new (FspDataType type)
FspData*
fsp_data_copy (const FspData *data)
{
- g_return_val_if_fail (data != NULL, NULL);
-
FspData *new_data = NULL;
+ g_return_val_if_fail (data != NULL, NULL);
+
new_data = fsp_data_new (FSP_UNKNOWN);
*new_data = *data;
diff --git a/src/flicksoup/fsp-data.h b/src/flicksoup/fsp-data.h
index 08a6552..79dfca0 100644
--- a/src/flicksoup/fsp-data.h
+++ b/src/flicksoup/fsp-data.h
@@ -73,7 +73,7 @@ typedef enum {
typedef enum {
FSP_VISIBILITY_NONE = -1,
FSP_VISIBILITY_NO = 0,
- FSP_VISIBILITY_YES = 1,
+ FSP_VISIBILITY_YES = 1
} FspVisibility;
typedef enum {
@@ -82,7 +82,7 @@ typedef enum {
FSP_PERMISSION_FRIENDS_FAMILY = 1,
FSP_PERMISSION_CONTACTS = 2,
FSP_PERMISSION_EVERYBODY = 3,
- FSP_PERMISSION_LAST = 3,
+ FSP_PERMISSION_LAST = 3
} FspPermission;
typedef enum {
@@ -94,7 +94,7 @@ typedef enum {
FSP_LICENSE_AT = 4,
FSP_LICENSE_AT_SA = 5,
FSP_LICENSE_ND = 6,
- FSP_LICENSE_LAST = 7,
+ FSP_LICENSE_LAST = 7
} FspLicense;
typedef enum {
diff --git a/src/flicksoup/fsp-error.c b/src/flicksoup/fsp-error.c
index 796cad5..551d0ca 100644
--- a/src/flicksoup/fsp-error.c
+++ b/src/flicksoup/fsp-error.c
@@ -27,207 +27,207 @@
#define N_ERRORS (N_SPECIFIC_ERRORS + N_GENERAL_ERRORS)
static const FspError photo_upload_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_UNKNOWN, // 1
- FSP_ERROR_UPLOAD_MISSING_PHOTO, // 2
- FSP_ERROR_UPLOAD_GENERAL_FAILURE, // 3
- FSP_ERROR_UPLOAD_INVALID_FILE, // 4
- FSP_ERROR_UPLOAD_INVALID_FILE, // 5
- FSP_ERROR_UPLOAD_QUOTA_EXCEEDED, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_UNKNOWN, /* 1 */
+ FSP_ERROR_UPLOAD_MISSING_PHOTO, /* 2 */
+ FSP_ERROR_UPLOAD_GENERAL_FAILURE, /* 3 */
+ FSP_ERROR_UPLOAD_INVALID_FILE, /* 4 */
+ FSP_ERROR_UPLOAD_INVALID_FILE, /* 5 */
+ FSP_ERROR_UPLOAD_QUOTA_EXCEEDED, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError photo_get_info_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_PHOTO_NOT_FOUND, // 1
- FSP_ERROR_UNKNOWN, // 2
- FSP_ERROR_UNKNOWN, // 3
- FSP_ERROR_UNKNOWN, // 4
- FSP_ERROR_UNKNOWN, // 5
- FSP_ERROR_UNKNOWN, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_PHOTO_NOT_FOUND, /* 1 */
+ FSP_ERROR_UNKNOWN, /* 2 */
+ FSP_ERROR_UNKNOWN, /* 3 */
+ FSP_ERROR_UNKNOWN, /* 4 */
+ FSP_ERROR_UNKNOWN, /* 5 */
+ FSP_ERROR_UNKNOWN, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError photoset_create_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_PHOTOSET_TITLE_MISSING, // 1
- FSP_ERROR_PHOTO_NOT_FOUND, // 2
- FSP_ERROR_PHOTOSET_CANT_CREATE, // 3
- FSP_ERROR_UNKNOWN, // 4
- FSP_ERROR_UNKNOWN, // 5
- FSP_ERROR_UNKNOWN, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_PHOTOSET_TITLE_MISSING, /* 1 */
+ FSP_ERROR_PHOTO_NOT_FOUND, /* 2 */
+ FSP_ERROR_PHOTOSET_CANT_CREATE, /* 3 */
+ FSP_ERROR_UNKNOWN, /* 4 */
+ FSP_ERROR_UNKNOWN, /* 5 */
+ FSP_ERROR_UNKNOWN, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError photoset_get_list_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_USER_NOT_FOUND, // 1
- FSP_ERROR_UNKNOWN, // 2
- FSP_ERROR_UNKNOWN, // 3
- FSP_ERROR_UNKNOWN, // 4
- FSP_ERROR_UNKNOWN, // 5
- FSP_ERROR_UNKNOWN, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_USER_NOT_FOUND, /* 1 */
+ FSP_ERROR_UNKNOWN, /* 2 */
+ FSP_ERROR_UNKNOWN, /* 3 */
+ FSP_ERROR_UNKNOWN, /* 4 */
+ FSP_ERROR_UNKNOWN, /* 5 */
+ FSP_ERROR_UNKNOWN, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError photoset_add_photo_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_PHOTOSET_NOT_FOUND, // 1
- FSP_ERROR_PHOTO_NOT_FOUND, // 2
- FSP_ERROR_PHOTOSET_PHOTO_ALREADY_IN, // 3
- FSP_ERROR_UNKNOWN, // 4
- FSP_ERROR_UNKNOWN, // 5
- FSP_ERROR_UNKNOWN, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_PHOTOSET_NOT_FOUND, /* 1 */
+ FSP_ERROR_PHOTO_NOT_FOUND, /* 2 */
+ FSP_ERROR_PHOTOSET_PHOTO_ALREADY_IN, /* 3 */
+ FSP_ERROR_UNKNOWN, /* 4 */
+ FSP_ERROR_UNKNOWN, /* 5 */
+ FSP_ERROR_UNKNOWN, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError group_add_photo_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_PHOTO_NOT_FOUND, // 1
- FSP_ERROR_GROUP_NOT_FOUND, // 2
- FSP_ERROR_GROUP_PHOTO_ALREADY_IN, // 3
- FSP_ERROR_GROUP_PHOTO_IN_MAX_NUM, // 4
- FSP_ERROR_GROUP_LIMIT_REACHED, // 5
- FSP_ERROR_GROUP_PHOTO_ADDED_TO_QUEUE, // 6
- FSP_ERROR_GROUP_PHOTO_ALREADY_IN_QUEUE, // 7
- FSP_ERROR_GROUP_CONTENT_NOT_ALLOWED, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_PHOTO_NOT_FOUND, /* 1 */
+ FSP_ERROR_GROUP_NOT_FOUND, /* 2 */
+ FSP_ERROR_GROUP_PHOTO_ALREADY_IN, /* 3 */
+ FSP_ERROR_GROUP_PHOTO_IN_MAX_NUM, /* 4 */
+ FSP_ERROR_GROUP_LIMIT_REACHED, /* 5 */
+ FSP_ERROR_GROUP_PHOTO_ADDED_TO_QUEUE, /* 6 */
+ FSP_ERROR_GROUP_PHOTO_ALREADY_IN_QUEUE, /* 7 */
+ FSP_ERROR_GROUP_CONTENT_NOT_ALLOWED, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError tag_get_list_translations [N_SPECIFIC_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 0
- FSP_ERROR_USER_NOT_FOUND, // 1
- FSP_ERROR_UNKNOWN, // 2
- FSP_ERROR_UNKNOWN, // 3
- FSP_ERROR_UNKNOWN, // 4
- FSP_ERROR_UNKNOWN, // 5
- FSP_ERROR_UNKNOWN, // 6
- FSP_ERROR_UNKNOWN, // 7
- FSP_ERROR_UNKNOWN, // 8
- FSP_ERROR_UNKNOWN, // 9
+ FSP_ERROR_UNKNOWN, /* 0 */
+ FSP_ERROR_USER_NOT_FOUND, /* 1 */
+ FSP_ERROR_UNKNOWN, /* 2 */
+ FSP_ERROR_UNKNOWN, /* 3 */
+ FSP_ERROR_UNKNOWN, /* 4 */
+ FSP_ERROR_UNKNOWN, /* 5 */
+ FSP_ERROR_UNKNOWN, /* 6 */
+ FSP_ERROR_UNKNOWN, /* 7 */
+ FSP_ERROR_UNKNOWN, /* 8 */
+ FSP_ERROR_UNKNOWN, /* 9 */
};
static const FspError general_translations [N_GENERAL_ERRORS] = {
- FSP_ERROR_UNKNOWN, // 10
- FSP_ERROR_UNKNOWN, // 11
- FSP_ERROR_UNKNOWN, // 12
- FSP_ERROR_UNKNOWN, // 13
- FSP_ERROR_UNKNOWN, // 14
- FSP_ERROR_UNKNOWN, // 15
- FSP_ERROR_UNKNOWN, // 16
- FSP_ERROR_UNKNOWN, // 17
- FSP_ERROR_UNKNOWN, // 18
- FSP_ERROR_UNKNOWN, // 19
- FSP_ERROR_UNKNOWN, // 20
- FSP_ERROR_UNKNOWN, // 21
- FSP_ERROR_UNKNOWN, // 22
- FSP_ERROR_UNKNOWN, // 23
- FSP_ERROR_UNKNOWN, // 24
- FSP_ERROR_UNKNOWN, // 25
- FSP_ERROR_UNKNOWN, // 26
- FSP_ERROR_UNKNOWN, // 27
- FSP_ERROR_UNKNOWN, // 28
- FSP_ERROR_UNKNOWN, // 29
- FSP_ERROR_UNKNOWN, // 30
- FSP_ERROR_UNKNOWN, // 31
- FSP_ERROR_UNKNOWN, // 32
- FSP_ERROR_UNKNOWN, // 33
- FSP_ERROR_UNKNOWN, // 34
- FSP_ERROR_UNKNOWN, // 35
- FSP_ERROR_UNKNOWN, // 36
- FSP_ERROR_UNKNOWN, // 37
- FSP_ERROR_UNKNOWN, // 38
- FSP_ERROR_UNKNOWN, // 39
- FSP_ERROR_UNKNOWN, // 40
- FSP_ERROR_UNKNOWN, // 41
- FSP_ERROR_UNKNOWN, // 42
- FSP_ERROR_UNKNOWN, // 43
- FSP_ERROR_UNKNOWN, // 44
- FSP_ERROR_UNKNOWN, // 45
- FSP_ERROR_UNKNOWN, // 46
- FSP_ERROR_UNKNOWN, // 47
- FSP_ERROR_UNKNOWN, // 48
- FSP_ERROR_UNKNOWN, // 49
- FSP_ERROR_UNKNOWN, // 50
- FSP_ERROR_UNKNOWN, // 51
- FSP_ERROR_UNKNOWN, // 52
- FSP_ERROR_UNKNOWN, // 53
- FSP_ERROR_UNKNOWN, // 54
- FSP_ERROR_UNKNOWN, // 55
- FSP_ERROR_UNKNOWN, // 56
- FSP_ERROR_UNKNOWN, // 57
- FSP_ERROR_UNKNOWN, // 58
- FSP_ERROR_UNKNOWN, // 59
- FSP_ERROR_UNKNOWN, // 60
- FSP_ERROR_UNKNOWN, // 61
- FSP_ERROR_UNKNOWN, // 62
- FSP_ERROR_UNKNOWN, // 63
- FSP_ERROR_UNKNOWN, // 64
- FSP_ERROR_UNKNOWN, // 65
- FSP_ERROR_UNKNOWN, // 66
- FSP_ERROR_UNKNOWN, // 67
- FSP_ERROR_UNKNOWN, // 68
- FSP_ERROR_UNKNOWN, // 69
- FSP_ERROR_UNKNOWN, // 70
- FSP_ERROR_UNKNOWN, // 71
- FSP_ERROR_UNKNOWN, // 72
- FSP_ERROR_UNKNOWN, // 73
- FSP_ERROR_UNKNOWN, // 74
- FSP_ERROR_UNKNOWN, // 75
- FSP_ERROR_UNKNOWN, // 76
- FSP_ERROR_UNKNOWN, // 77
- FSP_ERROR_UNKNOWN, // 78
- FSP_ERROR_UNKNOWN, // 79
- FSP_ERROR_UNKNOWN, // 80
- FSP_ERROR_UNKNOWN, // 81
- FSP_ERROR_UNKNOWN, // 82
- FSP_ERROR_UNKNOWN, // 83
- FSP_ERROR_UNKNOWN, // 84
- FSP_ERROR_UNKNOWN, // 85
- FSP_ERROR_UNKNOWN, // 86
- FSP_ERROR_UNKNOWN, // 87
- FSP_ERROR_UNKNOWN, // 88
- FSP_ERROR_UNKNOWN, // 89
- FSP_ERROR_UNKNOWN, // 90
- FSP_ERROR_UNKNOWN, // 91
- FSP_ERROR_UNKNOWN, // 92
- FSP_ERROR_UNKNOWN, // 93
- FSP_ERROR_UNKNOWN, // 94
- FSP_ERROR_UNKNOWN, // 95
- FSP_ERROR_OTHER, // 96
- FSP_ERROR_OTHER, // 97
- FSP_ERROR_NOT_AUTHENTICATED, // 98
- FSP_ERROR_NOT_ENOUGH_PERMISSIONS, // 99
- FSP_ERROR_INVALID_API_KEY, // 100
- FSP_ERROR_UNKNOWN, // 101
- FSP_ERROR_UNKNOWN, // 102
- FSP_ERROR_UNKNOWN, // 103
- FSP_ERROR_UNKNOWN, // 104
- FSP_ERROR_SERVICE_UNAVAILABLE, // 105
- FSP_ERROR_UNKNOWN, // 106
- FSP_ERROR_UNKNOWN, // 107
- FSP_ERROR_AUTHENTICATION_FAILED, // 108
- FSP_ERROR_UNKNOWN, // 109
- FSP_ERROR_UNKNOWN, // 110
- FSP_ERROR_OTHER, // 111
- FSP_ERROR_OTHER, // 112
- FSP_ERROR_UNKNOWN, // 113
- FSP_ERROR_OTHER, // 114
- FSP_ERROR_OTHER, // 115
- FSP_ERROR_OTHER, // 116
- FSP_ERROR_UNKNOWN, // 117
- FSP_ERROR_UNKNOWN, // 118
- FSP_ERROR_UNKNOWN, // 119
+ FSP_ERROR_UNKNOWN, /* 10 */
+ FSP_ERROR_UNKNOWN, /* 11 */
+ FSP_ERROR_UNKNOWN, /* 12 */
+ FSP_ERROR_UNKNOWN, /* 13 */
+ FSP_ERROR_UNKNOWN, /* 14 */
+ FSP_ERROR_UNKNOWN, /* 15 */
+ FSP_ERROR_UNKNOWN, /* 16 */
+ FSP_ERROR_UNKNOWN, /* 17 */
+ FSP_ERROR_UNKNOWN, /* 18 */
+ FSP_ERROR_UNKNOWN, /* 19 */
+ FSP_ERROR_UNKNOWN, /* 20 */
+ FSP_ERROR_UNKNOWN, /* 21 */
+ FSP_ERROR_UNKNOWN, /* 22 */
+ FSP_ERROR_UNKNOWN, /* 23 */
+ FSP_ERROR_UNKNOWN, /* 24 */
+ FSP_ERROR_UNKNOWN, /* 25 */
+ FSP_ERROR_UNKNOWN, /* 26 */
+ FSP_ERROR_UNKNOWN, /* 27 */
+ FSP_ERROR_UNKNOWN, /* 28 */
+ FSP_ERROR_UNKNOWN, /* 29 */
+ FSP_ERROR_UNKNOWN, /* 30 */
+ FSP_ERROR_UNKNOWN, /* 31 */
+ FSP_ERROR_UNKNOWN, /* 32 */
+ FSP_ERROR_UNKNOWN, /* 33 */
+ FSP_ERROR_UNKNOWN, /* 34 */
+ FSP_ERROR_UNKNOWN, /* 35 */
+ FSP_ERROR_UNKNOWN, /* 36 */
+ FSP_ERROR_UNKNOWN, /* 37 */
+ FSP_ERROR_UNKNOWN, /* 38 */
+ FSP_ERROR_UNKNOWN, /* 39 */
+ FSP_ERROR_UNKNOWN, /* 40 */
+ FSP_ERROR_UNKNOWN, /* 41 */
+ FSP_ERROR_UNKNOWN, /* 42 */
+ FSP_ERROR_UNKNOWN, /* 43 */
+ FSP_ERROR_UNKNOWN, /* 44 */
+ FSP_ERROR_UNKNOWN, /* 45 */
+ FSP_ERROR_UNKNOWN, /* 46 */
+ FSP_ERROR_UNKNOWN, /* 47 */
+ FSP_ERROR_UNKNOWN, /* 48 */
+ FSP_ERROR_UNKNOWN, /* 49 */
+ FSP_ERROR_UNKNOWN, /* 50 */
+ FSP_ERROR_UNKNOWN, /* 51 */
+ FSP_ERROR_UNKNOWN, /* 52 */
+ FSP_ERROR_UNKNOWN, /* 53 */
+ FSP_ERROR_UNKNOWN, /* 54 */
+ FSP_ERROR_UNKNOWN, /* 55 */
+ FSP_ERROR_UNKNOWN, /* 56 */
+ FSP_ERROR_UNKNOWN, /* 57 */
+ FSP_ERROR_UNKNOWN, /* 58 */
+ FSP_ERROR_UNKNOWN, /* 59 */
+ FSP_ERROR_UNKNOWN, /* 60 */
+ FSP_ERROR_UNKNOWN, /* 61 */
+ FSP_ERROR_UNKNOWN, /* 62 */
+ FSP_ERROR_UNKNOWN, /* 63 */
+ FSP_ERROR_UNKNOWN, /* 64 */
+ FSP_ERROR_UNKNOWN, /* 65 */
+ FSP_ERROR_UNKNOWN, /* 66 */
+ FSP_ERROR_UNKNOWN, /* 67 */
+ FSP_ERROR_UNKNOWN, /* 68 */
+ FSP_ERROR_UNKNOWN, /* 69 */
+ FSP_ERROR_UNKNOWN, /* 70 */
+ FSP_ERROR_UNKNOWN, /* 71 */
+ FSP_ERROR_UNKNOWN, /* 72 */
+ FSP_ERROR_UNKNOWN, /* 73 */
+ FSP_ERROR_UNKNOWN, /* 74 */
+ FSP_ERROR_UNKNOWN, /* 75 */
+ FSP_ERROR_UNKNOWN, /* 76 */
+ FSP_ERROR_UNKNOWN, /* 77 */
+ FSP_ERROR_UNKNOWN, /* 78 */
+ FSP_ERROR_UNKNOWN, /* 79 */
+ FSP_ERROR_UNKNOWN, /* 80 */
+ FSP_ERROR_UNKNOWN, /* 81 */
+ FSP_ERROR_UNKNOWN, /* 82 */
+ FSP_ERROR_UNKNOWN, /* 83 */
+ FSP_ERROR_UNKNOWN, /* 84 */
+ FSP_ERROR_UNKNOWN, /* 85 */
+ FSP_ERROR_UNKNOWN, /* 86 */
+ FSP_ERROR_UNKNOWN, /* 87 */
+ FSP_ERROR_UNKNOWN, /* 88 */
+ FSP_ERROR_UNKNOWN, /* 89 */
+ FSP_ERROR_UNKNOWN, /* 90 */
+ FSP_ERROR_UNKNOWN, /* 91 */
+ FSP_ERROR_UNKNOWN, /* 92 */
+ FSP_ERROR_UNKNOWN, /* 93 */
+ FSP_ERROR_UNKNOWN, /* 94 */
+ FSP_ERROR_UNKNOWN, /* 95 */
+ FSP_ERROR_OTHER, /* 96 */
+ FSP_ERROR_OTHER, /* 97 */
+ FSP_ERROR_NOT_AUTHENTICATED, /* 98 */
+ FSP_ERROR_NOT_ENOUGH_PERMISSIONS, /* 99 */
+ FSP_ERROR_INVALID_API_KEY, /* 100 */
+ FSP_ERROR_UNKNOWN, /* 101 */
+ FSP_ERROR_UNKNOWN, /* 102 */
+ FSP_ERROR_UNKNOWN, /* 103 */
+ FSP_ERROR_UNKNOWN, /* 104 */
+ FSP_ERROR_SERVICE_UNAVAILABLE, /* 105 */
+ FSP_ERROR_UNKNOWN, /* 106 */
+ FSP_ERROR_UNKNOWN, /* 107 */
+ FSP_ERROR_AUTHENTICATION_FAILED, /* 108 */
+ FSP_ERROR_UNKNOWN, /* 109 */
+ FSP_ERROR_UNKNOWN, /* 110 */
+ FSP_ERROR_OTHER, /* 111 */
+ FSP_ERROR_OTHER, /* 112 */
+ FSP_ERROR_UNKNOWN, /* 113 */
+ FSP_ERROR_OTHER, /* 114 */
+ FSP_ERROR_OTHER, /* 115 */
+ FSP_ERROR_OTHER, /* 116 */
+ FSP_ERROR_UNKNOWN, /* 117 */
+ FSP_ERROR_UNKNOWN, /* 118 */
+ FSP_ERROR_UNKNOWN, /* 119 */
};
FspError
diff --git a/src/flicksoup/fsp-error.h b/src/flicksoup/fsp-error.h
index a42ac0d..b6e506b 100644
--- a/src/flicksoup/fsp-error.h
+++ b/src/flicksoup/fsp-error.h
@@ -93,7 +93,7 @@ typedef enum {
FSP_ERROR_METHOD_PHOTOSET_ADD_PHOTO,
FSP_ERROR_METHOD_GROUP_GET_LIST,
FSP_ERROR_METHOD_GROUP_ADD_PHOTO,
- FSP_ERROR_METHOD_TAG_GET_LIST,
+ FSP_ERROR_METHOD_TAG_GET_LIST
} FspErrorMethod;
FspError
diff --git a/src/flicksoup/fsp-parser.c b/src/flicksoup/fsp-parser.c
index 6669e5e..e66ce79 100644
--- a/src/flicksoup/fsp-parser.c
+++ b/src/flicksoup/fsp-parser.c
@@ -27,7 +27,7 @@
#include <libxml/parser.h>
#include <libxml/xpath.h>
-G_DEFINE_TYPE (FspParser, fsp_parser, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FspParser, fsp_parser, G_TYPE_OBJECT)
/* Types of responses */
@@ -116,7 +116,7 @@ fsp_parser_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
- GObject *object;
+ GObject *object = NULL;
if (!_instance)
{
@@ -150,12 +150,14 @@ fsp_parser_init (FspParser *self)
static RestResponseType
_get_response_type (xmlDoc *doc)
{
- g_return_val_if_fail (doc != NULL, REST_RESPONSE_UNKNOWN);
-
RestResponseType retval = REST_RESPONSE_UNKNOWN;
- xmlNode *root = xmlDocGetRootElement (doc);
+ xmlNode *root = NULL;
+ gchar *name = NULL;
+
+ g_return_val_if_fail (doc != NULL, REST_RESPONSE_UNKNOWN);
- gchar *name = (gchar *) root->name;
+ root = xmlDocGetRootElement (doc);
+ name = (gchar *) root->name;
if (!g_strcmp0 (name, "rsp"))
{
xmlChar *value = xmlGetProp (root, (const xmlChar *) "stat");
@@ -216,14 +218,14 @@ static GError *
_parse_error_from_node (xmlNode *error_node,
FspErrorMethod error_method)
{
- g_return_val_if_fail (error_node != NULL, NULL);
-
- FspError error;
- xmlChar *code_str;
- xmlChar *msg;
- gchar *error_msg;
+ FspError error = FSP_ERROR_UNKNOWN;
+ xmlChar *code_str = NULL;
+ xmlChar *msg = NULL;
+ gchar *error_msg = NULL;
gint code;
- GError *err;
+ GError *err = NULL;
+
+ g_return_val_if_fail (error_node != NULL, NULL);
/* Get data from XML */
code_str = xmlGetProp (error_node, (const xmlChar *) "code");
@@ -290,14 +292,14 @@ _process_xml_response (FspParser *self,
GError **error),
GError **error)
{
- g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
- g_return_val_if_fail (buffer != NULL, NULL);
-
/* Get xml data from response */
xmlDoc *doc = NULL;
gpointer retval = NULL;
GError *err = NULL;
+ g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
+ g_return_val_if_fail (buffer != NULL, NULL);
+
/* Get xml data from response */
doc = xmlParseMemory (buffer, buf_size);
if (doc != NULL)
@@ -332,13 +334,13 @@ static gpointer
_get_frob_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
gchar *frob = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/frob", xpathCtx);
@@ -375,13 +377,13 @@ static gpointer
_get_auth_token_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
FspDataAuthToken *auth_token = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/auth", xpathCtx);
@@ -463,13 +465,13 @@ static gpointer
_get_upload_status_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
FspDataUploadStatus *upload_status = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/user", xpathCtx);
@@ -560,13 +562,13 @@ static gpointer
_photo_get_upload_result_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
gchar *photoid = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/photoid", xpathCtx);
@@ -603,13 +605,13 @@ static gpointer
_get_photo_info_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
FspDataPhotoInfo *pinfo = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/photo", xpathCtx);
@@ -641,8 +643,6 @@ static gpointer
_get_photosets_list_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
int numNodes = 0;
@@ -650,6 +650,8 @@ _get_photosets_list_parser (xmlDoc *doc,
FspDataPhotoSet *photoset = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/photosets/photoset", xpathCtx);
numNodes = xpathObj->nodesetval->nodeNr;
@@ -697,13 +699,13 @@ static gpointer
_photoset_created_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
gchar *photosetId = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/photoset", xpathCtx);
@@ -737,8 +739,6 @@ static gpointer
_get_groups_list_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
int numNodes = 0;
@@ -746,6 +746,8 @@ _get_groups_list_parser (xmlDoc *doc,
FspDataGroup *group = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/groups/group", xpathCtx);
numNodes = xpathObj->nodesetval->nodeNr;
@@ -793,8 +795,6 @@ static gpointer
_get_tags_list_parser (xmlDoc *doc,
GError **error)
{
- g_return_val_if_fail (doc != NULL, NULL);
-
xmlXPathContext *xpathCtx = NULL;
xmlXPathObject * xpathObj = NULL;
int numNodes = 0;
@@ -803,6 +803,8 @@ _get_tags_list_parser (xmlDoc *doc,
gchar *tag = NULL;
GError *err = NULL;
+ g_return_val_if_fail (doc != NULL, NULL);
+
xpathCtx = xmlXPathNewContext (doc);
xpathObj = xmlXPathEvalExpression ((xmlChar *)"/rsp/who/tags/tag", xpathCtx);
numNodes = xpathObj->nodesetval->nodeNr;
@@ -847,12 +849,12 @@ _get_tags_list_parser (xmlDoc *doc,
static FspDataPhotoInfo *
_get_photo_info_from_node (xmlNode *node)
{
- g_return_val_if_fail (node != NULL, NULL);
-
FspDataPhotoInfo *pinfo = NULL;
xmlAttr *attr = NULL;
xmlChar *content = NULL;
+ g_return_val_if_fail (node != NULL, NULL);
+
/* Create and fill the FspDataPhotoInfo */
pinfo = FSP_DATA_PHOTO_INFO (fsp_data_new (FSP_PHOTO_INFO));
for (attr = node->properties; attr != NULL; attr = attr->next)
@@ -1005,14 +1007,14 @@ _get_photo_info_from_node (xmlNode *node)
static FspDataPhotoSet *
_get_photoset_from_node (xmlNode *node)
{
- g_return_val_if_fail (node != NULL, NULL);
-
FspDataPhotoSet *photoSet = NULL;
xmlChar *content = NULL;
xmlChar *id = NULL;
xmlChar *primaryPhotoId = NULL;
xmlChar *numPhotos = NULL;
+ g_return_val_if_fail (node != NULL, NULL);
+
if (g_strcmp0 ((gchar *) node->name, "photoset"))
return NULL;
@@ -1060,14 +1062,14 @@ _get_photoset_from_node (xmlNode *node)
static FspDataGroup *
_get_group_from_node (xmlNode *node)
{
- g_return_val_if_fail (node != NULL, NULL);
-
FspDataGroup *group = NULL;
xmlChar *id = NULL;
xmlChar *name = NULL;
xmlChar *privacy = NULL;
xmlChar *numPhotos = NULL;
+ g_return_val_if_fail (node != NULL, NULL);
+
if (g_strcmp0 ((gchar *) node->name, "group"))
return NULL;
@@ -1110,11 +1112,11 @@ fsp_parser_get_frob (FspParser *self,
gulong buf_size,
GError **error)
{
+ gchar *frob = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- gchar *frob = NULL;
-
/* Process the response */
frob = (gchar *) _process_xml_response (self, buffer, buf_size,
_get_frob_parser, error);
@@ -1129,11 +1131,11 @@ fsp_parser_get_auth_token (FspParser *self,
gulong buf_size,
GError **error)
{
+ FspDataAuthToken *auth_token = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- FspDataAuthToken *auth_token = NULL;
-
/* Process the response */
auth_token =
FSP_DATA_AUTH_TOKEN (_process_xml_response (self, buffer, buf_size,
@@ -1149,11 +1151,11 @@ fsp_parser_get_upload_status (FspParser *self,
gulong buf_size,
GError **error)
{
+ FspDataUploadStatus *upload_status = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- FspDataUploadStatus *upload_status = NULL;
-
/* Process the response */
upload_status =
FSP_DATA_UPLOAD_STATUS (_process_xml_response (self, buffer, buf_size,
@@ -1170,11 +1172,11 @@ fsp_parser_get_upload_result (FspParser *self,
gulong buf_size,
GError **error)
{
+ gchar *photo_id = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- gchar *photo_id = NULL;
-
/* Process the response */
photo_id = (gchar *) (_process_xml_response (self, buffer, buf_size,
_photo_get_upload_result_parser,
@@ -1189,11 +1191,11 @@ fsp_parser_get_photo_info (FspParser *self,
gulong buf_size,
GError **error)
{
+ FspDataPhotoInfo *photo_info = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- FspDataPhotoInfo *photo_info = NULL;
-
/* Process the response */
photo_info =
FSP_DATA_PHOTO_INFO (_process_xml_response (self, buffer, buf_size,
@@ -1210,11 +1212,11 @@ fsp_parser_get_photosets_list (FspParser *self,
gulong buf_size,
GError **error)
{
+ GSList *photoSets_list = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- GSList *photoSets_list = NULL;
-
/* Process the response */
photoSets_list = (GSList*) _process_xml_response (self, buffer, buf_size,
_get_photosets_list_parser,
@@ -1246,11 +1248,11 @@ fsp_parser_photoset_created (FspParser *self,
gulong buf_size,
GError **error)
{
+ gchar *photoset_id = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- gchar *photoset_id = NULL;
-
/* Process the response */
photoset_id = (gchar *) (_process_xml_response (self, buffer, buf_size,
_photoset_created_parser,
@@ -1265,11 +1267,11 @@ fsp_parser_get_groups_list (FspParser *self,
gulong buf_size,
GError **error)
{
+ GSList *groups_list = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- GSList *groups_list = NULL;
-
/* Process the response */
groups_list = (GSList*) _process_xml_response (self, buffer, buf_size,
_get_groups_list_parser,
@@ -1301,11 +1303,11 @@ fsp_parser_get_tags_list (FspParser *self,
gulong buf_size,
GError **error)
{
+ GSList *tags_list = NULL;
+
g_return_val_if_fail (FSP_IS_PARSER (self), NULL);
g_return_val_if_fail (buffer != NULL, NULL);
- GSList *tags_list = NULL;
-
/* Process the response */
tags_list = (GSList *) _process_xml_response (self, buffer, buf_size,
_get_tags_list_parser, error);
diff --git a/src/flicksoup/fsp-session.c b/src/flicksoup/fsp-session.c
index ccca1fe..66e4c68 100644
--- a/src/flicksoup/fsp-session.c
+++ b/src/flicksoup/fsp-session.c
@@ -39,7 +39,7 @@
#define FLICKR_API_UPLOAD_URL "http://api.flickr.com/services/upload"
#if DEBUG_ENABLED
-#define DEBUG(...) g_debug (__VA_ARGS__);
+#define DEBUG(...) g_debug (__VA_ARGS__)
#else
#define DEBUG(...)
#endif
@@ -49,7 +49,7 @@
FSP_TYPE_SESSION, \
FspSessionPrivate))
-G_DEFINE_TYPE (FspSession, fsp_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FspSession, fsp_session, G_TYPE_OBJECT)
/* Private struct */
@@ -566,10 +566,6 @@ _load_file_contents_cb (GObject *object,
GAsyncResult *res,
gpointer data)
{
- g_return_if_fail (G_IS_FILE (object));
- g_return_if_fail (G_IS_ASYNC_RESULT (res));
- g_return_if_fail (data != NULL);
-
UploadPhotoData *up_clos = NULL;
AsyncRequestData *ard_clos = NULL;
GHashTable *extra_params = NULL;
@@ -578,6 +574,10 @@ _load_file_contents_cb (GObject *object,
gchar *contents;
gsize length;
+ g_return_if_fail (G_IS_FILE (object));
+ g_return_if_fail (G_IS_ASYNC_RESULT (res));
+ g_return_if_fail (data != NULL);
+
/* Get data from UploadPhotoData closure, and free it */
up_clos = (UploadPhotoData *) data;
ard_clos = up_clos->ar_data;
@@ -665,10 +665,11 @@ static GHashTable *
_get_params_table_from_valist (const gchar *first_param,
va_list args)
{
- g_return_val_if_fail (first_param != NULL, NULL);
-
GHashTable *table = NULL;
- gchar *p, *v;
+ gchar *p = NULL;
+ gchar *v = NULL;
+
+ g_return_val_if_fail (first_param != NULL, NULL);
table = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free,
@@ -717,12 +718,12 @@ static gchar *
_get_signed_query_with_params (const gchar *api_sig,
GHashTable *params_table)
{
- g_return_val_if_fail (params_table != NULL, NULL);
- g_return_val_if_fail (api_sig != NULL, NULL);
-
GList *keys = NULL;
gchar *retval = NULL;
+ g_return_val_if_fail (params_table != NULL, NULL);
+ g_return_val_if_fail (api_sig != NULL, NULL);
+
/* Get ownership of the table */
g_hash_table_ref (params_table);
@@ -796,10 +797,10 @@ static gboolean
_check_errors_on_soup_response (SoupMessage *msg,
GError **error)
{
- g_assert (SOUP_IS_MESSAGE (msg));
-
GError *err = NULL;
+ g_assert (SOUP_IS_MESSAGE (msg));
+
/* Check non-succesful SoupMessage's only */
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
{
@@ -831,11 +832,11 @@ _check_async_errors_on_finish (GObject *object,
gpointer source_tag,
GError **error)
{
+ gboolean errors_found = TRUE;
+
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- gboolean errors_found = TRUE;
-
if (g_simple_async_result_is_valid (res, object, source_tag))
{
GSimpleAsyncResult *simple = NULL;
@@ -855,12 +856,12 @@ gchar *
_get_api_signature_from_hash_table (const gchar *shared_secret,
GHashTable *params_table)
{
- g_return_val_if_fail (shared_secret != NULL, NULL);
- g_return_val_if_fail (params_table != NULL, NULL);
-
GList *keys = NULL;
gchar *api_sig = NULL;
+ g_return_val_if_fail (shared_secret != NULL, NULL);
+ g_return_val_if_fail (params_table != NULL, NULL);
+
/* Get ownership of the table */
g_hash_table_ref (params_table);
@@ -911,14 +912,14 @@ _get_signed_query (const gchar *shared_secret,
const gchar *first_param,
... )
{
- g_return_val_if_fail (shared_secret != NULL, NULL);
- g_return_val_if_fail (first_param != NULL, NULL);
-
va_list args;
GHashTable *table = NULL;
gchar *api_sig = NULL;
gchar *retval = NULL;
+ g_return_val_if_fail (shared_secret != NULL, NULL);
+ g_return_val_if_fail (first_param != NULL, NULL);
+
va_start (args, first_param);
/* Get the hash table for the params and the API signature from it */
@@ -947,14 +948,14 @@ _perform_async_request (SoupSession *soup_session,
gpointer source_tag,
gpointer data)
{
+ AsyncRequestData *clos = NULL;
+ SoupMessage *msg = NULL;
+
g_return_if_fail (SOUP_IS_SESSION (soup_session));
g_return_if_fail (url != NULL);
g_return_if_fail (request_cb != NULL);
g_return_if_fail (callback != NULL);
- AsyncRequestData *clos = NULL;
- SoupMessage *msg = NULL;
-
/* Build and queue the message */
msg = soup_message_new (SOUP_METHOD_GET, url);
@@ -1014,10 +1015,6 @@ _handle_soup_response (SoupMessage *msg,
FspParserFunc parserFunc,
gpointer data)
{
- g_assert (SOUP_IS_MESSAGE (msg));
- g_assert (parserFunc != NULL);
- g_assert (data != NULL);
-
FspParser *parser = NULL;
AsyncRequestData *clos = NULL;
gpointer result = NULL;
@@ -1025,6 +1022,10 @@ _handle_soup_response (SoupMessage *msg,
gchar *response_str = NULL;
gulong response_len = 0;
+ g_assert (SOUP_IS_MESSAGE (msg));
+ g_assert (parserFunc != NULL);
+ g_assert (data != NULL);
+
parser = fsp_parser_get_instance ();
clos = (AsyncRequestData *) data;
@@ -1052,8 +1053,6 @@ _build_async_result_and_complete (AsyncRequestData *clos,
gpointer result,
GError *error)
{
- g_assert (clos != NULL);
-
GSimpleAsyncResult *res = NULL;
GObject *object = NULL;
GCancellableData *cancellable_data = NULL;
@@ -1063,6 +1062,8 @@ _build_async_result_and_complete (AsyncRequestData *clos,
gpointer source_tag;
gpointer data;
+ g_assert (clos != NULL);
+
/* Get data from closure, and free it */
object = clos->object;
cancellable = clos->cancellable;
@@ -1100,11 +1101,11 @@ _finish_async_request (GObject *object,
gpointer source_tag,
GError **error)
{
+ gpointer retval = NULL;
+
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- gpointer retval = NULL;
-
/* Check for errors */
if (!_check_async_errors_on_finish (object, res, source_tag, error))
{
@@ -1129,11 +1130,11 @@ _photo_upload_soup_session_cb (SoupSession *session,
SoupMessage *msg,
gpointer data)
{
+ AsyncRequestData *ard_clos = NULL;
+
g_assert (SOUP_IS_MESSAGE (msg));
g_assert (data != NULL);
- AsyncRequestData *ard_clos = NULL;
-
ard_clos = (AsyncRequestData *) data;
g_signal_handlers_disconnect_by_func (msg, _wrote_body_data_cb, ard_clos->object);
@@ -1253,12 +1254,11 @@ fsp_session_new (const gchar *api_key,
g_return_val_if_fail (api_key != NULL, NULL);
g_return_val_if_fail (secret != NULL, NULL);
- GObject *object = g_object_new(FSP_TYPE_SESSION,
- "api-key", api_key,
- "secret", secret,
- "token", token,
- NULL);
- return FSP_SESSION (object);
+ return FSP_SESSION (g_object_new(FSP_TYPE_SESSION,
+ "api-key", api_key,
+ "secret", secret,
+ "token", token,
+ NULL));
}
gboolean
@@ -1266,9 +1266,10 @@ fsp_session_set_http_proxy (FspSession *self,
const char *host, const char *port,
const char *username, const char *password)
{
+ SoupURI *proxy_uri = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
- SoupURI *proxy_uri = NULL;
if (host != NULL)
{
const gchar *actual_user = NULL;
@@ -1365,13 +1366,14 @@ fsp_session_get_auth_url_async (FspSession *self,
GAsyncReadyCallback cb,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.auth.getFrob",
"api_key", priv->api_key,
@@ -1392,15 +1394,14 @@ fsp_session_get_auth_url_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
- g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
- g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
-
gchar *frob = NULL;
gchar *auth_url = NULL;
+ g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
+
frob = (gchar*) _finish_async_request (G_OBJECT (self), res,
fsp_session_get_auth_url_async, error);
-
/* Build the auth URL from the frob */
if (frob != NULL)
{
@@ -1433,11 +1434,12 @@ fsp_session_complete_auth_async (FspSession *self,
GAsyncReadyCallback cb,
gpointer data)
{
+ FspSessionPrivate *priv = NULL;
+
g_return_if_fail (FSP_IS_SESSION (self));
g_return_if_fail (cb != NULL);
- FspSessionPrivate *priv = self->priv;
-
+ priv = self->priv;
if (priv->frob != NULL)
{
gchar *signed_query = NULL;
@@ -1475,11 +1477,11 @@ fsp_session_complete_auth_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ FspDataAuthToken *auth_token = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- FspDataAuthToken *auth_token = NULL;
-
auth_token =
FSP_DATA_AUTH_TOKEN (_finish_async_request (G_OBJECT (self), res,
fsp_session_complete_auth_async,
@@ -1498,11 +1500,12 @@ fsp_session_check_auth_info_async (FspSession *self,
GAsyncReadyCallback cb,
gpointer data)
{
+ FspSessionPrivate *priv = NULL;
+
g_return_if_fail (FSP_IS_SESSION (self));
g_return_if_fail (cb != NULL);
- FspSessionPrivate *priv = self->priv;
-
+ priv = self->priv;
if (priv->token != NULL)
{
gchar *signed_query = NULL;
@@ -1540,11 +1543,11 @@ fsp_session_check_auth_info_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ FspDataAuthToken *auth_token = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- FspDataAuthToken *auth_token = NULL;
-
auth_token =
FSP_DATA_AUTH_TOKEN (_finish_async_request (G_OBJECT (self), res,
fsp_session_check_auth_info_async,
@@ -1558,11 +1561,12 @@ fsp_session_get_upload_status_async (FspSession *self,
GAsyncReadyCallback cb,
gpointer data)
{
+ FspSessionPrivate *priv = NULL;
+
g_return_if_fail (FSP_IS_SESSION (self));
g_return_if_fail (cb != NULL);
- FspSessionPrivate *priv = self->priv;
-
+ priv = self->priv;
if (priv->token != NULL)
{
gchar *signed_query = NULL;
@@ -1600,11 +1604,11 @@ fsp_session_get_upload_status_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ FspDataUploadStatus *upload_status = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- FspDataUploadStatus *upload_status = NULL;
-
upload_status =
FSP_DATA_UPLOAD_STATUS (_finish_async_request (G_OBJECT (self), res,
fsp_session_get_upload_status_async,
@@ -1628,9 +1632,6 @@ fsp_session_upload_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
- g_return_if_fail (fileuri != NULL);
-
FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
GHashTable *extra_params = NULL;
@@ -1639,6 +1640,9 @@ fsp_session_upload_async (FspSession *self,
GFile *file = NULL;
gchar *api_sig = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+ g_return_if_fail (fileuri != NULL);
+
/* Get flickr proxy and extra params (those actually used) */
priv = self->priv;
soup_session = _get_soup_session (self);
@@ -1684,10 +1688,9 @@ fsp_session_upload_finish (FspSession *self,
g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- gchar *photo_id = (gchar*) _finish_async_request (G_OBJECT (self), res,
- fsp_session_upload_async,
- error);
- return photo_id;
+ return (gchar*) _finish_async_request (G_OBJECT (self), res,
+ fsp_session_upload_async,
+ error);
}
void
@@ -1697,15 +1700,16 @@ fsp_session_get_info_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
- g_return_if_fail (photo_id != NULL);
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+ g_return_if_fail (photo_id != NULL);
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.photos.getInfo",
"api_key", priv->api_key,
@@ -1730,11 +1734,11 @@ fsp_session_get_info_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ FspDataPhotoInfo *photo_info = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- FspDataPhotoInfo *photo_info = NULL;
-
photo_info =
FSP_DATA_PHOTO_INFO (_finish_async_request (G_OBJECT (self), res,
fsp_session_get_info_async,
@@ -1748,14 +1752,15 @@ fsp_session_get_photosets_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.photosets.getList",
"api_key", priv->api_key,
@@ -1782,12 +1787,9 @@ fsp_session_get_photosets_finish (FspSession *self,
g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- GSList *photosets_list = NULL;
-
- photosets_list = (GSList*) _finish_async_request (G_OBJECT (self), res,
- fsp_session_get_photosets_async,
- error);
- return photosets_list;
+ return (GSList*) _finish_async_request (G_OBJECT (self), res,
+ fsp_session_get_photosets_async,
+ error);
}
void
@@ -1798,16 +1800,17 @@ fsp_session_add_to_photoset_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
- g_return_if_fail (photo_id != NULL);
- g_return_if_fail (photoset_id != NULL);
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+ g_return_if_fail (photo_id != NULL);
+ g_return_if_fail (photoset_id != NULL);
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.photosets.addPhoto",
"api_key", priv->api_key,
@@ -1833,11 +1836,11 @@ fsp_session_add_to_photoset_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ gpointer result = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- gpointer result = NULL;
-
result = _finish_async_request (G_OBJECT (self), res,
fsp_session_add_to_photoset_async, error);
@@ -1853,16 +1856,17 @@ fsp_session_create_photoset_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
- g_return_if_fail (title != NULL);
- g_return_if_fail (primary_photo_id != NULL);
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+ g_return_if_fail (title != NULL);
+ g_return_if_fail (primary_photo_id != NULL);
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.photosets.create",
"api_key", priv->api_key,
@@ -1889,11 +1893,11 @@ fsp_session_create_photoset_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ gchar *photoset_id = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- gchar *photoset_id = NULL;
-
photoset_id =
(gchar*) _finish_async_request (G_OBJECT (self), res,
fsp_session_create_photoset_async,
@@ -1907,14 +1911,15 @@ fsp_session_get_groups_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.groups.pools.getGroups",
"api_key", priv->api_key,
@@ -1941,12 +1946,9 @@ fsp_session_get_groups_finish (FspSession *self,
g_return_val_if_fail (FSP_IS_SESSION (self), NULL);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL);
- GSList *groups_list = NULL;
-
- groups_list = (GSList*) _finish_async_request (G_OBJECT (self), res,
- fsp_session_get_groups_async,
- error);
- return groups_list;
+ return (GSList*) _finish_async_request (G_OBJECT (self), res,
+ fsp_session_get_groups_async,
+ error);
}
void
@@ -1957,16 +1959,17 @@ fsp_session_add_to_group_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
- g_return_if_fail (photo_id != NULL);
- g_return_if_fail (group_id != NULL);
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+ g_return_if_fail (photo_id != NULL);
+ g_return_if_fail (group_id != NULL);
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.groups.pools.add",
"api_key", priv->api_key,
@@ -1992,11 +1995,11 @@ fsp_session_add_to_group_finish (FspSession *self,
GAsyncResult *res,
GError **error)
{
+ gpointer result = NULL;
+
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- gpointer result = NULL;
-
result = _finish_async_request (G_OBJECT (self), res,
fsp_session_add_to_group_async, error);
@@ -2009,14 +2012,15 @@ fsp_session_get_tags_list_async (FspSession *self,
GAsyncReadyCallback callback,
gpointer data)
{
- g_return_if_fail (FSP_IS_SESSION (self));
-
- FspSessionPrivate *priv = self->priv;
+ FspSessionPrivate *priv = NULL;
SoupSession *soup_session = NULL;
gchar *url = NULL;
gchar *signed_query = NULL;
+ g_return_if_fail (FSP_IS_SESSION (self));
+
/* Build the signed url */
+ priv = self->priv;
signed_query = _get_signed_query (priv->secret,
"method", "flickr.tags.getListUser",
"api_key", priv->api_key,
@@ -2043,10 +2047,6 @@ fsp_session_get_tags_list_finish (FspSession *self,
g_return_val_if_fail (FSP_IS_SESSION (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
- GSList *tags_list = NULL;
-
- tags_list = (GSList*) _finish_async_request (G_OBJECT (self), res,
- fsp_session_get_tags_list_async, error);
-
- return tags_list;
+ return (GSList*) _finish_async_request (G_OBJECT (self), res,
+ fsp_session_get_tags_list_async, error);
}
diff --git a/src/frogr-account.c b/src/frogr-account.c
index 912833d..18917b6 100644
--- a/src/frogr-account.c
+++ b/src/frogr-account.c
@@ -29,7 +29,7 @@
FROGR_TYPE_ACCOUNT, \
FrogrAccountPrivate))
-G_DEFINE_TYPE (FrogrAccount, frogr_account, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrAccount, frogr_account, G_TYPE_OBJECT)
/* Private structure */
@@ -61,7 +61,7 @@ enum {
PROP_IS_ACTIVE,
PROP_REMAINING_BANDWIDTH,
PROP_MAX_BANDWIDTH,
- PROP_IS_PRO,
+ PROP_IS_PRO
};
@@ -279,8 +279,7 @@ frogr_account_init (FrogrAccount *self)
FrogrAccount *
frogr_account_new (void)
{
- GObject *new = g_object_new (FROGR_TYPE_ACCOUNT, NULL);
- return FROGR_ACCOUNT (new);
+ return FROGR_ACCOUNT (g_object_new (FROGR_TYPE_ACCOUNT, NULL));
}
FrogrAccount *
@@ -288,18 +287,19 @@ frogr_account_new_with_token (const gchar *token)
{
g_return_val_if_fail (token, NULL);
- GObject *new = g_object_new (FROGR_TYPE_ACCOUNT,
- "token", token,
- NULL);
- return FROGR_ACCOUNT (new);
+ return FROGR_ACCOUNT (g_object_new (FROGR_TYPE_ACCOUNT,
+ "token", token,
+ NULL));
}
const gchar *
frogr_account_get_token (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), NULL);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->token;
}
@@ -307,10 +307,11 @@ void
frogr_account_set_token (FrogrAccount *self,
const gchar *token)
{
- g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ FrogrAccountPrivate *priv = NULL;
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
g_free (priv->token);
priv->token = g_strdup (token);
}
@@ -318,19 +319,22 @@ frogr_account_set_token (FrogrAccount *self,
const gchar*
frogr_account_get_permissions (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), NULL);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->permissions;
}
void
frogr_account_set_permissions (FrogrAccount *self, const gchar *permissions)
{
- g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ FrogrAccountPrivate *priv = NULL;
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
g_free (priv->permissions);
priv->permissions = g_strdup (permissions);
}
@@ -338,19 +342,22 @@ frogr_account_set_permissions (FrogrAccount *self, const gchar *permissions)
const gchar*
frogr_account_get_id (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), NULL);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->id;
}
void
frogr_account_set_id (FrogrAccount *self, const gchar *id)
{
- g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ FrogrAccountPrivate *priv = NULL;
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
g_free (priv->id);
priv->id = g_strdup (id);
}
@@ -358,19 +365,22 @@ frogr_account_set_id (FrogrAccount *self, const gchar *id)
const gchar*
frogr_account_get_username (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), NULL);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->username;
}
void
frogr_account_set_username (FrogrAccount *self, const gchar *username)
{
- g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ FrogrAccountPrivate *priv = NULL;
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
g_free (priv->username);
priv->username = g_strdup (username);
}
@@ -378,19 +388,22 @@ frogr_account_set_username (FrogrAccount *self, const gchar *username)
const gchar*
frogr_account_get_fullname (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), NULL);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->fullname;
}
void
frogr_account_set_fullname (FrogrAccount *self, const gchar *fullname)
{
- g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ FrogrAccountPrivate *priv = NULL;
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ g_return_if_fail (FROGR_IS_ACCOUNT (self));
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
g_free (priv->fullname);
priv->fullname = g_strdup (fullname);
}
@@ -398,81 +411,99 @@ frogr_account_set_fullname (FrogrAccount *self, const gchar *fullname)
gboolean
frogr_account_is_active (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), FALSE);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->is_active;
}
void
frogr_account_set_is_active (FrogrAccount *self, gboolean is_active)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_ACCOUNT (self));
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
priv->is_active = is_active;
}
gulong
frogr_account_get_remaining_bandwidth (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), G_MAXULONG);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->remaining_bandwidth;
}
void
frogr_account_set_remaining_bandwidth (FrogrAccount *self, gulong remaining_bandwidth)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_ACCOUNT (self));
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
priv->remaining_bandwidth = remaining_bandwidth;
}
gulong
frogr_account_get_max_bandwidth (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), G_MAXULONG);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->max_bandwidth;
}
void
frogr_account_set_max_bandwidth (FrogrAccount *self, gulong max_bandwidth)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_ACCOUNT (self));
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
priv->max_bandwidth = max_bandwidth;
}
gboolean
frogr_account_is_pro (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), FALSE);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
return priv->is_pro;
}
void
frogr_account_set_is_pro (FrogrAccount *self, gboolean is_pro)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_ACCOUNT (self));
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
priv->is_pro = is_pro;
}
gboolean
frogr_account_is_valid (FrogrAccount *self)
{
+ FrogrAccountPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_ACCOUNT (self), FALSE);
- FrogrAccountPrivate *priv = FROGR_ACCOUNT_GET_PRIVATE (self);
+ priv = FROGR_ACCOUNT_GET_PRIVATE (self);
if (priv->token == NULL || priv->token[0] == '\0')
return FALSE;
diff --git a/src/frogr-add-tags-dialog.c b/src/frogr-add-tags-dialog.c
index d5e9ccf..2d8beab 100644
--- a/src/frogr-add-tags-dialog.c
+++ b/src/frogr-add-tags-dialog.c
@@ -34,7 +34,7 @@
FROGR_TYPE_ADD_TAGS_DIALOG, \
FrogrAddTagsDialogPrivate))
-G_DEFINE_TYPE (FrogrAddTagsDialog, frogr_add_tags_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrAddTagsDialog, frogr_add_tags_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrAddTagsDialogPrivate {
GtkWidget *entry;
diff --git a/src/frogr-add-to-group-dialog.c b/src/frogr-add-to-group-dialog.c
index cfb9d35..967a85c 100644
--- a/src/frogr-add-to-group-dialog.c
+++ b/src/frogr-add-to-group-dialog.c
@@ -36,7 +36,7 @@
FROGR_TYPE_ADD_TO_GROUP_DIALOG, \
FrogrAddToGroupDialogPrivate))
-G_DEFINE_TYPE (FrogrAddToGroupDialog, frogr_add_to_group_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrAddToGroupDialog, frogr_add_to_group_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrAddToGroupDialogPrivate {
GtkWidget *treeview;
@@ -190,13 +190,13 @@ _toggle_column_sort_order (GtkTreeSortable *sortable,
GtkTreeViewColumn *col,
gint col_id)
{
+ GtkSortType current;
+ GtkSortType new;
+
g_return_if_fail (GTK_IS_TREE_SORTABLE (sortable));
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (col));
g_return_if_fail (col_id >= 0 && col_id < N_COLS);
- GtkSortType current;
- GtkSortType new;
-
current = gtk_tree_view_column_get_sort_order (col);
if (current == GTK_SORT_ASCENDING)
new = GTK_SORT_DESCENDING;
@@ -213,12 +213,12 @@ _tree_iter_compare_n_elements_func (GtkTreeModel *model,
GtkTreeIter *b,
gpointer data)
{
- g_return_val_if_fail (GTK_IS_TREE_MODEL (model), 0);
-
gchar *a_str = NULL;
gchar *b_str = NULL;
- gint a_value;
- gint b_value;
+ gint a_value = 0;
+ gint b_value = 0;
+
+ g_return_val_if_fail (GTK_IS_TREE_MODEL (model), 0);
gtk_tree_model_get (GTK_TREE_MODEL (model), a, N_ELEMENTS_COL, &a_str, -1);
gtk_tree_model_get (GTK_TREE_MODEL (model), b, N_ELEMENTS_COL, &b_str, -1);
diff --git a/src/frogr-add-to-set-dialog.c b/src/frogr-add-to-set-dialog.c
index d9a1b5c..37f36cd 100644
--- a/src/frogr-add-to-set-dialog.c
+++ b/src/frogr-add-to-set-dialog.c
@@ -36,7 +36,7 @@
FROGR_TYPE_ADD_TO_SET_DIALOG, \
FrogrAddToSetDialogPrivate))
-G_DEFINE_TYPE (FrogrAddToSetDialog, frogr_add_to_set_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrAddToSetDialog, frogr_add_to_set_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrAddToSetDialogPrivate {
GtkWidget *treeview;
@@ -190,13 +190,13 @@ _toggle_column_sort_order (GtkTreeSortable *sortable,
GtkTreeViewColumn *col,
gint col_id)
{
+ GtkSortType current;
+ GtkSortType new;
+
g_return_if_fail (GTK_IS_TREE_SORTABLE (sortable));
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (col));
g_return_if_fail (col_id >= 0 && col_id < N_COLS);
- GtkSortType current;
- GtkSortType new;
-
current = gtk_tree_view_column_get_sort_order (col);
if (current == GTK_SORT_ASCENDING)
new = GTK_SORT_DESCENDING;
@@ -213,12 +213,12 @@ _tree_iter_compare_n_elements_func (GtkTreeModel *model,
GtkTreeIter *b,
gpointer data)
{
- g_return_val_if_fail (GTK_IS_TREE_MODEL (model), 0);
-
gchar *a_str = NULL;
gchar *b_str = NULL;
- gint a_value;
- gint b_value;
+ gint a_value = 0;
+ gint b_value = 0;
+
+ g_return_val_if_fail (GTK_IS_TREE_MODEL (model), 0);
gtk_tree_model_get (GTK_TREE_MODEL (model), a, N_ELEMENTS_COL, &a_str, -1);
gtk_tree_model_get (GTK_TREE_MODEL (model), b, N_ELEMENTS_COL, &b_str, -1);
diff --git a/src/frogr-config.c b/src/frogr-config.c
index 6e28e66..4cb0d7d 100644
--- a/src/frogr-config.c
+++ b/src/frogr-config.c
@@ -41,7 +41,7 @@
FrogrConfigPrivate))
-G_DEFINE_TYPE (FrogrConfig, frogr_config, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrConfig, frogr_config, G_TYPE_OBJECT)
typedef struct _FrogrConfigPrivate FrogrConfigPrivate;
@@ -121,13 +121,13 @@ static xmlNodePtr _xml_add_string_child (xmlNodePtr parent,
static FrogrAccount *
_find_account_by_id (FrogrConfig *self, const gchar *id)
{
- g_return_val_if_fail (FROGR_IS_CONFIG (self), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
FrogrConfigPrivate *priv = NULL;
FrogrAccount *current = NULL;
GSList *item = NULL;
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), NULL);
+ g_return_val_if_fail (id != NULL, NULL);
+
priv = FROGR_CONFIG_GET_PRIVATE (self);
for (item = priv->accounts; item; item = g_slist_next (item))
{
@@ -767,13 +767,12 @@ _xml_add_string_child (xmlNodePtr parent,
gboolean
frogr_config_save_all (FrogrConfig *self)
{
- g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
-
gboolean retval = FALSE;
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
+
retval =_save_accounts (self);
retval = retval && _save_settings (self);
-
return retval;
}
@@ -925,13 +924,13 @@ gboolean
frogr_config_add_account (FrogrConfig *self,
FrogrAccount *faccount)
{
- g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- g_return_val_if_fail (FROGR_IS_ACCOUNT (faccount), FALSE);
-
FrogrConfigPrivate *priv = NULL;
FrogrAccount *found_account = NULL;
const gchar *account_id = NULL;
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
+ g_return_val_if_fail (FROGR_IS_ACCOUNT (faccount), FALSE);
+
priv = FROGR_CONFIG_GET_PRIVATE (self);
/* Only add the account if not already in */
@@ -958,22 +957,24 @@ frogr_config_add_account (FrogrConfig *self,
GSList *
frogr_config_get_accounts (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), NULL);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->accounts;
}
gboolean
frogr_config_set_active_account (FrogrConfig *self, const gchar *id)
{
- g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
-
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ FrogrConfigPrivate *priv = NULL;
FrogrAccount *current = NULL;
GSList *item = NULL;
gboolean result = FALSE;
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
+
priv = FROGR_CONFIG_GET_PRIVATE (self);
for (item = priv->accounts; item; item = g_slist_next (item))
{
@@ -995,21 +996,23 @@ frogr_config_set_active_account (FrogrConfig *self, const gchar *id)
FrogrAccount *
frogr_config_get_active_account (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), NULL);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->active_account;
}
gboolean
frogr_config_remove_account (FrogrConfig *self, const gchar *id)
{
- g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- g_return_val_if_fail (id != NULL, FALSE);
-
FrogrConfigPrivate *priv = NULL;
FrogrAccount *found_account = NULL;
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
+ g_return_val_if_fail (id != NULL, FALSE);
+
priv = FROGR_CONFIG_GET_PRIVATE (self);
found_account = _find_account_by_id (self, id);
@@ -1027,54 +1030,66 @@ frogr_config_remove_account (FrogrConfig *self, const gchar *id)
void
frogr_config_set_default_public (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->public = value;
}
gboolean
frogr_config_get_default_public (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->public;
}
void
frogr_config_set_default_family (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->family = value;
}
gboolean
frogr_config_get_default_family (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->family;
}
void
frogr_config_set_default_friend (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->friend = value;
}
gboolean
frogr_config_get_default_friend (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->friend;
}
@@ -1082,9 +1097,11 @@ void
frogr_config_set_default_safety_level (FrogrConfig *self,
FspSafetyLevel safety_level)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
/* Check out of bounds values */
if (safety_level <= FSP_SAFETY_LEVEL_NONE || safety_level >= FSP_SAFETY_LEVEL_LAST)
@@ -1096,9 +1113,11 @@ frogr_config_set_default_safety_level (FrogrConfig *self,
FspSafetyLevel
frogr_config_get_default_safety_level (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->safety_level;
}
@@ -1106,9 +1125,11 @@ void
frogr_config_set_default_content_type (FrogrConfig *self,
FspContentType content_type)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
/* Check out of bounds values */
if (content_type <= FSP_CONTENT_TYPE_NONE || content_type >= FSP_CONTENT_TYPE_LAST)
@@ -1120,81 +1141,99 @@ frogr_config_set_default_content_type (FrogrConfig *self,
FspContentType
frogr_config_get_default_content_type (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->content_type;
}
void
frogr_config_set_default_show_in_search (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->show_in_search = value;
}
gboolean
frogr_config_get_default_show_in_search (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->show_in_search;
}
void
frogr_config_set_tags_autocompletion (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->tags_autocompletion = value;
}
gboolean
frogr_config_get_tags_autocompletion (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->tags_autocompletion;
}
void
frogr_config_set_keep_file_extensions (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->keep_file_extensions = value;
}
gboolean
frogr_config_get_keep_file_extensions (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->keep_file_extensions;
}
void
frogr_config_set_mainview_enable_tooltips (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->mainview_enable_tooltips = value;
}
gboolean
frogr_config_get_mainview_enable_tooltips (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->mainview_enable_tooltips;
}
@@ -1202,63 +1241,77 @@ void
frogr_config_set_mainview_sorting_criteria (FrogrConfig *self,
SortingCriteria criteria)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->mainview_sorting_criteria = criteria;
}
SortingCriteria
frogr_config_get_mainview_sorting_criteria (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), SORT_AS_LOADED);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->mainview_sorting_criteria;
}
void
frogr_config_set_mainview_sorting_reversed (FrogrConfig *self, gboolean reversed)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->mainview_sorting_reversed = reversed;
}
gboolean
frogr_config_get_mainview_sorting_reversed (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), SORT_AS_LOADED);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->mainview_sorting_reversed;
}
void
frogr_config_set_use_proxy (FrogrConfig *self, gboolean value)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
priv->use_proxy = value;
}
gboolean
frogr_config_get_use_proxy (FrogrConfig *self)
{
+ FrogrConfigPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate *priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->use_proxy;
}
void
frogr_config_set_proxy_host (FrogrConfig *self, const gchar *host)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
g_free (priv->proxy_host);
priv->proxy_host = g_strdup (host);
}
@@ -1266,18 +1319,22 @@ frogr_config_set_proxy_host (FrogrConfig *self, const gchar *host)
const gchar *
frogr_config_get_proxy_host (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->proxy_host;
}
void
frogr_config_set_proxy_port (FrogrConfig *self, const gchar *port)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
g_free (priv->proxy_port);
priv->proxy_port = g_strdup (port);
}
@@ -1285,18 +1342,22 @@ frogr_config_set_proxy_port (FrogrConfig *self, const gchar *port)
const gchar *
frogr_config_get_proxy_port (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->proxy_port;
}
void
frogr_config_set_proxy_username (FrogrConfig *self, const gchar *username)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
g_free (priv->proxy_username);
priv->proxy_username = g_strdup (username);
}
@@ -1304,18 +1365,22 @@ frogr_config_set_proxy_username (FrogrConfig *self, const gchar *username)
const gchar *
frogr_config_get_proxy_username (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->proxy_username;
}
void
frogr_config_set_proxy_password (FrogrConfig *self, const gchar *password)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_if_fail (FROGR_IS_CONFIG (self));
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
g_free (priv->proxy_password);
priv->proxy_password = g_strdup (password);
}
@@ -1323,8 +1388,10 @@ frogr_config_set_proxy_password (FrogrConfig *self, const gchar *password)
const gchar *
frogr_config_get_proxy_password (FrogrConfig *self)
{
+ FrogrConfigPrivate * priv = NULL;
+
g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
- FrogrConfigPrivate * priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
return priv->proxy_password;
}
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 916b148..33fdcfc 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -53,7 +53,7 @@
FROGR_TYPE_CONTROLLER, \
FrogrControllerPrivate))
-G_DEFINE_TYPE (FrogrController, frogr_controller, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrController, frogr_controller, G_TYPE_OBJECT)
/* Private data */
@@ -120,7 +120,7 @@ typedef enum {
FETCHING_ACCOUNT_EXTRA_INFO,
FETCHING_SETS,
FETCHING_GROUPS,
- FETCHING_TAGS,
+ FETCHING_TAGS
} FetchingActivity;
/* Prototypes */
@@ -473,9 +473,6 @@ _upload_picture (FrogrController *self, FrogrPicture *picture,
FrogrPictureUploadedCallback picture_uploaded_cb,
GObject *object)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
- g_return_if_fail(FROGR_IS_PICTURE (picture));
-
FrogrControllerPrivate *priv = NULL;
upload_picture_st *up_st = NULL;
FspVisibility public_visibility = FSP_VISIBILITY_NONE;
@@ -485,6 +482,9 @@ _upload_picture (FrogrController *self, FrogrPicture *picture,
FspContentType content_type = FSP_CONTENT_TYPE_NONE;
FspSearchScope search_scope = FSP_SEARCH_SCOPE_NONE;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+ g_return_if_fail(FROGR_IS_PICTURE (picture));
+
up_st = g_slice_new0 (upload_picture_st);
up_st->controller = self;
up_st->picture = picture;
@@ -965,12 +965,12 @@ _notify_adding_to_group (FrogrController *self,
static void
_on_picture_loaded (FrogrController *self, FrogrPicture *picture)
{
- g_return_if_fail (FROGR_IS_CONTROLLER (self));
- g_return_if_fail (FROGR_IS_PICTURE (picture));
-
FrogrControllerPrivate *priv = NULL;
FrogrMainViewModel *mainview_model = NULL;
+ g_return_if_fail (FROGR_IS_CONTROLLER (self));
+ g_return_if_fail (FROGR_IS_PICTURE (picture));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
mainview_model = frogr_main_view_get_model (priv->mainview);
@@ -1029,10 +1029,10 @@ _on_pictures_uploaded (FrogrController *self,
static void
_fetch_everything (FrogrController *self, gboolean force_fetch)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1057,10 +1057,10 @@ _fetch_everything (FrogrController *self, gboolean force_fetch)
static void
_fetch_sets (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1139,10 +1139,10 @@ _fetch_sets_cb (GObject *object, GAsyncResult *res, gpointer data)
static void
_fetch_groups (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1219,10 +1219,10 @@ _fetch_groups_cb (GObject *object, GAsyncResult *res, gpointer data)
static void _fetch_account_info (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1291,10 +1291,10 @@ _fetch_account_info_cb (GObject *object, GAsyncResult *res, gpointer data)
static void _fetch_account_extra_info (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1368,10 +1368,10 @@ _fetch_account_extra_info_cb (GObject *object, GAsyncResult *res, gpointer data)
static void
_fetch_tags (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
if (!frogr_controller_is_authorized (self))
return;
@@ -1825,19 +1825,22 @@ frogr_controller_get_instance (void)
FrogrMainView *
frogr_controller_get_main_view (FrogrController *self)
{
- g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
+ FrogrControllerPrivate *priv = NULL;
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
return priv->mainview;
}
gboolean
frogr_controller_run_app (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
if (priv->app_running)
{
@@ -1870,9 +1873,11 @@ frogr_controller_run_app (FrogrController *self)
gboolean
frogr_controller_quit_app (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
if (priv->app_running)
{
@@ -1896,13 +1901,13 @@ void
frogr_controller_set_active_account (FrogrController *self,
FrogrAccount *account)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
FrogrAccount *new_account = NULL;
gboolean accounts_changed = FALSE;
const gchar *token = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Do nothing if we're setting the same account active again*/
@@ -1955,27 +1960,33 @@ frogr_controller_set_active_account (FrogrController *self,
FrogrAccount *
frogr_controller_get_active_account (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FROGR_STATE_UNKNOWN);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
return priv->account;
}
GSList *
frogr_controller_get_all_accounts (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FROGR_STATE_UNKNOWN);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
return frogr_config_get_accounts (priv->config);
}
FrogrControllerState
frogr_controller_get_state (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FROGR_STATE_UNKNOWN);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
return priv->state;
}
@@ -1984,10 +1995,10 @@ frogr_controller_set_proxy (FrogrController *self,
const char *host, const char *port,
const char *username, const char *password)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* The host is mandatory to set up a proxy */
@@ -2022,10 +2033,11 @@ frogr_controller_set_proxy (FrogrController *self,
void
frogr_controller_fetch_tags_if_needed (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
+ FrogrControllerPrivate *priv = NULL;
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
if (!priv->fetching_tags && !priv->tags_fetched)
_fetch_tags (self);
}
@@ -2033,10 +2045,13 @@ frogr_controller_fetch_tags_if_needed (FrogrController *self)
void
frogr_controller_show_about_dialog (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+ GtkWindow *window = NULL;
+
g_return_if_fail(FROGR_IS_CONTROLLER (self));
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
- GtkWindow *window = frogr_main_view_get_window (priv->mainview);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ window = frogr_main_view_get_window (priv->mainview);
/* Run the about dialog */
frogr_about_dialog_show (window);
@@ -2045,10 +2060,13 @@ frogr_controller_show_about_dialog (FrogrController *self)
void
frogr_controller_show_auth_dialog (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+ GtkWindow *window = NULL;
+
g_return_if_fail(FROGR_IS_CONTROLLER (self));
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
- GtkWindow *window = frogr_main_view_get_window (priv->mainview);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ window = frogr_main_view_get_window (priv->mainview);
/* Run the auth dialog */
frogr_auth_dialog_show (window, REQUEST_AUTHORIZATION);
@@ -2057,10 +2075,13 @@ frogr_controller_show_auth_dialog (FrogrController *self)
void
frogr_controller_show_settings_dialog (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+ GtkWindow *window = NULL;
+
g_return_if_fail(FROGR_IS_CONTROLLER (self));
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
- GtkWindow *window = frogr_main_view_get_window (priv->mainview);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ window = frogr_main_view_get_window (priv->mainview);
/* Run the auth dialog */
frogr_settings_dialog_show (window);
@@ -2070,10 +2091,10 @@ void
frogr_controller_show_details_dialog (FrogrController *self,
GSList *pictures)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Fetch the tags list first if needed */
@@ -2092,10 +2113,10 @@ void
frogr_controller_show_add_tags_dialog (FrogrController *self,
GSList *pictures)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Fetch the tags list first if needed */
@@ -2114,10 +2135,10 @@ void
frogr_controller_show_create_new_set_dialog (FrogrController *self,
GSList *pictures)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Fetch the sets first if needed */
@@ -2136,10 +2157,10 @@ void
frogr_controller_show_add_to_set_dialog (FrogrController *self,
GSList *pictures)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Fetch the sets first if needed */
@@ -2158,10 +2179,10 @@ void
frogr_controller_show_add_to_group_dialog (FrogrController *self,
GSList *pictures)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Fetch the groups first if needed */
@@ -2179,10 +2200,10 @@ frogr_controller_show_add_to_group_dialog (FrogrController *self,
void
frogr_controller_open_auth_url (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
_enable_cancellable (self, FALSE);
fsp_session_get_auth_url_async (priv->session, NULL, _get_auth_url_cb, self);
}
@@ -2190,10 +2211,10 @@ frogr_controller_open_auth_url (FrogrController *self)
void
frogr_controller_complete_auth (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
_enable_cancellable (self, FALSE);
fsp_session_complete_auth_async (priv->session, NULL, _complete_auth_cb, self);
}
@@ -2201,18 +2222,22 @@ frogr_controller_complete_auth (FrogrController *self)
gboolean
frogr_controller_is_authorized (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
return (priv->account != NULL);
}
void
frogr_controller_revoke_authorization (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_CONTROLLER (self));
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Ensure there's the token/account is no longer active anywhere */
fsp_session_set_token (priv->session, NULL);
@@ -2237,9 +2262,11 @@ frogr_controller_load_pictures (FrogrController *self,
void
frogr_controller_upload_pictures (FrogrController *self)
{
+ FrogrControllerPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_CONTROLLER (self));
- FrogrControllerPrivate *priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
/* Upload pictures */
if (!frogr_controller_is_authorized (self))
@@ -2279,10 +2306,10 @@ frogr_controller_upload_pictures (FrogrController *self)
void
frogr_controller_cancel_ongoing_request (FrogrController *self)
{
- g_return_if_fail(FROGR_IS_CONTROLLER (self));
-
FrogrControllerPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
priv = FROGR_CONTROLLER_GET_PRIVATE (self);
if (!G_IS_CANCELLABLE (priv->cancellable)
|| g_cancellable_is_cancelled (priv->cancellable))
diff --git a/src/frogr-create-new-set-dialog.c b/src/frogr-create-new-set-dialog.c
index e985b71..c645ed7 100644
--- a/src/frogr-create-new-set-dialog.c
+++ b/src/frogr-create-new-set-dialog.c
@@ -40,7 +40,7 @@
FROGR_TYPE_CREATE_NEW_SET_DIALOG, \
FrogrCreateNewSetDialogPrivate))
-G_DEFINE_TYPE (FrogrCreateNewSetDialog, frogr_create_new_set_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrCreateNewSetDialog, frogr_create_new_set_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrCreateNewSetDialogPrivate {
GtkWidget *title_entry;
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index 3d0b863..a9581c4 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -44,7 +44,7 @@
FROGR_TYPE_DETAILS_DIALOG, \
FrogrDetailsDialogPrivate))
-G_DEFINE_TYPE (FrogrDetailsDialog, frogr_details_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrDetailsDialog, frogr_details_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrDetailsDialogPrivate {
GtkWidget *title_entry;
@@ -925,13 +925,13 @@ _save_data (FrogrDetailsDialog *self)
static void
_on_radio_button_clicked (GtkButton *tbutton, gpointer data)
{
- g_return_if_fail (GTK_IS_RADIO_BUTTON (tbutton));
-
FrogrDetailsDialog *self = NULL;
GtkWidget *button = NULL;
GSList *buttons = NULL;
GSList *item = NULL;
+ g_return_if_fail (GTK_IS_RADIO_BUTTON (tbutton));
+
buttons = gtk_radio_button_get_group (GTK_RADIO_BUTTON (tbutton));
for (item = buttons; item; item = g_slist_next (item))
diff --git a/src/frogr-group.c b/src/frogr-group.c
index 257c5dd..148ca71 100644
--- a/src/frogr-group.c
+++ b/src/frogr-group.c
@@ -27,7 +27,7 @@
FROGR_TYPE_GROUP, \
FrogrGroupPrivate))
-G_DEFINE_TYPE (FrogrGroup, frogr_group, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrGroup, frogr_group, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrGroupPrivate FrogrGroupPrivate;
@@ -45,7 +45,7 @@ enum {
PROP_ID,
PROP_NAME,
PROP_PRIVACY,
- PROP_N_PHOTOS,
+ PROP_N_PHOTOS
};
/* Prototypes */
@@ -197,13 +197,12 @@ frogr_group_new (const gchar *id,
g_return_val_if_fail (id, NULL);
g_return_val_if_fail (name, NULL);
- GObject *new = g_object_new(FROGR_TYPE_GROUP,
- "id", id,
- "name", name,
- "privacy", privacy,
- "n_photos", n_photos,
- NULL);
- return FROGR_GROUP (new);
+ return FROGR_GROUP (g_object_new(FROGR_TYPE_GROUP,
+ "id", id,
+ "name", name,
+ "privacy", privacy,
+ "n_photos", n_photos,
+ NULL));
}
@@ -212,11 +211,11 @@ frogr_group_new (const gchar *id,
const gchar *
frogr_group_get_id (FrogrGroup *self)
{
- g_return_val_if_fail(FROGR_IS_GROUP(self), NULL);
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_GROUP(self), NULL);
+ priv = FROGR_GROUP_GET_PRIVATE (self);
return (const gchar *)priv->id;
}
@@ -224,11 +223,11 @@ void
frogr_group_set_id (FrogrGroup *self,
const gchar *id)
{
- g_return_if_fail(FROGR_IS_GROUP(self));
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_GROUP(self));
+ priv = FROGR_GROUP_GET_PRIVATE (self);
g_free (priv->id);
priv->id = g_strdup (id);
}
@@ -236,11 +235,11 @@ frogr_group_set_id (FrogrGroup *self,
const gchar *
frogr_group_get_name (FrogrGroup *self)
{
- g_return_val_if_fail(FROGR_IS_GROUP(self), NULL);
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_GROUP(self), NULL);
+ priv = FROGR_GROUP_GET_PRIVATE (self);
return (const gchar *)priv->name;
}
@@ -248,12 +247,12 @@ void
frogr_group_set_name (FrogrGroup *self,
const gchar *name)
{
+ FrogrGroupPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_GROUP(self));
g_return_if_fail(name != NULL);
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
-
+ priv = FROGR_GROUP_GET_PRIVATE (self);
g_free (priv->name);
priv->name = g_strdup (name);
}
@@ -262,33 +261,33 @@ frogr_group_set_name (FrogrGroup *self,
FspGroupPrivacy
frogr_group_get_privacy (FrogrGroup *self)
{
- g_return_val_if_fail(FROGR_IS_GROUP(self), FALSE);
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_GROUP(self), FALSE);
+ priv =FROGR_GROUP_GET_PRIVATE (self);
return priv->privacy;
}
void
frogr_group_set_privacy (FrogrGroup *self, FspGroupPrivacy privacy)
{
- g_return_if_fail(FROGR_IS_GROUP(self));
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_GROUP(self));
+ priv = FROGR_GROUP_GET_PRIVATE (self);
priv->privacy = privacy;
}
gint
frogr_group_get_n_photos (FrogrGroup *self)
{
- g_return_val_if_fail(FROGR_IS_GROUP(self), FALSE);
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_GROUP(self), FALSE);
+ priv = FROGR_GROUP_GET_PRIVATE (self);
return priv->n_photos;
}
@@ -296,11 +295,11 @@ void
frogr_group_set_n_photos (FrogrGroup *self,
gint n)
{
- g_return_if_fail(FROGR_IS_GROUP(self));
+ FrogrGroupPrivate *priv = NULL;
- FrogrGroupPrivate *priv =
- FROGR_GROUP_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_GROUP(self));
+ priv = FROGR_GROUP_GET_PRIVATE (self);
priv->n_photos = n;
}
diff --git a/src/frogr-main-view-model.c b/src/frogr-main-view-model.c
index fb51b78..17a8ca8 100644
--- a/src/frogr-main-view-model.c
+++ b/src/frogr-main-view-model.c
@@ -31,7 +31,7 @@
FROGR_TYPE_MAIN_VIEW_MODEL, \
FrogrMainViewModelPrivate))
-G_DEFINE_TYPE (FrogrMainViewModel, frogr_main_view_model, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrMainViewModel, frogr_main_view_model, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrMainViewModelPrivate FrogrMainViewModelPrivate;
@@ -70,15 +70,15 @@ static gint
_compare_pictures_by_property (FrogrPicture *p1, FrogrPicture *p2,
const gchar *property_name)
{
- g_return_val_if_fail (FROGR_IS_PICTURE (p1), 0);
- g_return_val_if_fail (FROGR_IS_PICTURE (p2), 0);
-
GParamSpec *pspec1 = NULL;
GParamSpec *pspec2 = NULL;
GValue value1 = { 0 };
GValue value2 = { 0 };
gint result = 0;
+ g_return_val_if_fail (FROGR_IS_PICTURE (p1), 0);
+ g_return_val_if_fail (FROGR_IS_PICTURE (p2), 0);
+
pspec1 = g_object_class_find_property (G_OBJECT_GET_CLASS (p1), property_name);
pspec2 = g_object_class_find_property (G_OBJECT_GET_CLASS (p2), property_name);
@@ -238,17 +238,17 @@ void
frogr_main_view_model_add_picture (FrogrMainViewModel *self,
FrogrPicture *picture)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
g_return_if_fail(FROGR_IS_PICTURE (picture));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
-
- g_object_ref (picture);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->pictures_list = g_slist_append (priv->pictures_list, picture);
priv->pictures_list_as_loaded = g_slist_append (priv->pictures_list_as_loaded, picture);
priv->n_pictures++;
+ g_object_ref (picture);
g_signal_emit (self, signals[PICTURE_ADDED], 0, picture);
}
@@ -256,10 +256,11 @@ void
frogr_main_view_model_remove_picture (FrogrMainViewModel *self,
FrogrPicture *picture)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->pictures_list = g_slist_remove (priv->pictures_list, picture);
priv->pictures_list_as_loaded = g_slist_remove (priv->pictures_list_as_loaded, picture);
@@ -272,22 +273,22 @@ frogr_main_view_model_remove_picture (FrogrMainViewModel *self,
guint
frogr_main_view_model_n_pictures (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->n_pictures;
}
GSList *
frogr_main_view_model_get_pictures (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->pictures_list;
}
@@ -296,8 +297,6 @@ frogr_main_view_model_reorder_pictures (FrogrMainViewModel *self,
const gchar *property_name,
gboolean reversed)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
-
FrogrMainViewModelPrivate *priv = NULL;
GSList *list_as_loaded = NULL;
GSList *current_list = NULL;
@@ -306,6 +305,8 @@ frogr_main_view_model_reorder_pictures (FrogrMainViewModel *self,
gint current_pos = 0;
gint new_pos = 0;
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
/* Temporarily save the current list, and alloc an array to
@@ -352,28 +353,28 @@ void
frogr_main_view_model_add_set (FrogrMainViewModel *self,
FrogrPhotoSet *set)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
g_return_if_fail(FROGR_IS_SET (set));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
-
/* When adding one by one we prepend always to keep the order */
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->sets_list = g_slist_prepend (priv->sets_list, set);
- g_object_ref (set);
-
priv->n_sets++;
+
+ g_object_ref (set);
}
void
frogr_main_view_model_remove_set (FrogrMainViewModel *self,
FrogrPhotoSet *set)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->sets_list = g_slist_remove (priv->sets_list, set);
priv->n_sets--;
g_object_unref (set);
@@ -382,10 +383,11 @@ frogr_main_view_model_remove_set (FrogrMainViewModel *self,
void
frogr_main_view_model_remove_all_sets (FrogrMainViewModel *self)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
g_slist_foreach (priv->sets_list, (GFunc)g_object_unref, NULL);
g_slist_free (priv->sets_list);
@@ -397,22 +399,22 @@ frogr_main_view_model_remove_all_sets (FrogrMainViewModel *self)
guint
frogr_main_view_model_n_sets (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->n_sets;
}
GSList *
frogr_main_view_model_get_sets (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->sets_list;
}
@@ -420,62 +422,68 @@ void
frogr_main_view_model_set_sets (FrogrMainViewModel *self,
GSList *sets_list)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
-
FrogrMainViewModelPrivate *priv = NULL;
FrogrPicture *picture = NULL;
GSList *item = NULL;
- frogr_main_view_model_remove_all_sets (self);
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
- priv->sets_list = sets_list;
- priv->n_sets = g_slist_length (sets_list);
- /* Remove all the sets attached to every picture */
+ /* Remove all sets attached to every picture */
for (item = priv->pictures_list; item; item = g_slist_next (item))
{
picture = FROGR_PICTURE (item->data);
frogr_picture_remove_sets (picture);
}
+
+ /* Remove all the sets */
+ frogr_main_view_model_remove_all_sets (self);
+
+ /* Set photosets */
+ priv->sets_list = sets_list;
+ priv->n_sets = g_slist_length (sets_list);
}
void
frogr_main_view_model_add_group (FrogrMainViewModel *self,
FrogrGroup *group)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
g_return_if_fail(FROGR_IS_GROUP (group));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
-
- g_object_ref (group);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->groups_list = g_slist_append (priv->groups_list, group);
priv->n_groups++;
+
+ g_object_ref (group);
}
void
frogr_main_view_model_remove_group (FrogrMainViewModel *self,
FrogrGroup *group)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->groups_list = g_slist_remove (priv->groups_list, group);
priv->n_groups--;
+
g_object_unref (group);
}
void
frogr_main_view_model_remove_all_groups (FrogrMainViewModel *self)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
g_slist_foreach (priv->groups_list, (GFunc)g_object_unref, NULL);
g_slist_free (priv->groups_list);
@@ -487,22 +495,22 @@ frogr_main_view_model_remove_all_groups (FrogrMainViewModel *self)
guint
frogr_main_view_model_n_groups (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->n_groups;
}
GSList *
frogr_main_view_model_get_groups (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->groups_list;
}
@@ -510,17 +518,13 @@ void
frogr_main_view_model_set_groups (FrogrMainViewModel *self,
GSList *groups_list)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
-
FrogrMainViewModelPrivate *priv = NULL;
FrogrPicture *picture = NULL;
GSList *item = NULL;
- frogr_main_view_model_remove_all_groups (self);
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
- priv->groups_list = groups_list;
- priv->n_groups = g_slist_length (groups_list);
/* Remove all the groups attached to every picture */
for (item = priv->pictures_list; item; item = g_slist_next (item))
@@ -528,26 +532,34 @@ frogr_main_view_model_set_groups (FrogrMainViewModel *self,
picture = FROGR_PICTURE (item->data);
frogr_picture_remove_groups (picture);
}
+
+ /* Remove all groups */
+ frogr_main_view_model_remove_all_groups (self);
+
+ /* Set groups now */
+ priv->groups_list = groups_list;
+ priv->n_groups = g_slist_length (groups_list);
+
}
GSList *
frogr_main_view_model_get_tags_list (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->tags_list;
}
void
frogr_main_view_model_set_tags_list (FrogrMainViewModel *self, GSList *tags_list)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
-
FrogrMainViewModelPrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+
frogr_main_view_model_remove_all_tags (self);
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
@@ -558,10 +570,11 @@ frogr_main_view_model_set_tags_list (FrogrMainViewModel *self, GSList *tags_list
void
frogr_main_view_model_remove_all_tags (FrogrMainViewModel *self)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
g_slist_foreach (priv->tags_list, (GFunc)g_free, NULL);
g_slist_free (priv->tags_list);
@@ -573,20 +586,22 @@ frogr_main_view_model_remove_all_tags (FrogrMainViewModel *self)
guint
frogr_main_view_model_n_tags (FrogrMainViewModel *self)
{
- g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ FrogrMainViewModelPrivate *priv = NULL;
- FrogrMainViewModelPrivate *priv =
- FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->n_tags;
}
const gchar *
frogr_main_view_model_get_state_description (FrogrMainViewModel *self)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_val_if_fail (FROGR_IS_MAIN_VIEW_MODEL (self), NULL);
- FrogrMainViewModelPrivate *priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
return priv->state_description;
}
@@ -594,9 +609,11 @@ void
frogr_main_view_model_set_state_description (FrogrMainViewModel *self,
const gchar *description)
{
+ FrogrMainViewModelPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_MAIN_VIEW_MODEL (self));
- FrogrMainViewModelPrivate *priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
if (priv->state_description)
g_free (priv->state_description);
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index a52fa17..dee4e51 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -538,11 +538,11 @@ _add_menu_item_generic (FrogrMainView *self, GtkMenuShell *menu,
const gchar *mnemonic, GtkWidget **out_ref,
gboolean isToggleable, GSList **group)
{
+ GtkWidget *menu_item = NULL;
+
g_return_if_fail (FROGR_IS_MAIN_VIEW (self));
g_return_if_fail (GTK_IS_MENU_SHELL (menu));
- GtkWidget *menu_item = NULL;
-
if (isToggleable)
{
if (group)
@@ -1981,9 +1981,11 @@ frogr_main_view_new (void)
GtkWindow *
frogr_main_view_get_window (FrogrMainView *self)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_MAIN_VIEW (self), NULL);
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
return priv->window;
}
@@ -1991,11 +1993,12 @@ void
frogr_main_view_set_status_text (FrogrMainView *self,
const gchar *text)
{
- g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
+ FrogrMainViewPrivate *priv = NULL;
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
/* Pop old message if present */
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
gtk_statusbar_pop (GTK_STATUSBAR (priv->status_bar),
priv->sb_context_id);
@@ -2011,9 +2014,11 @@ frogr_main_view_set_status_text (FrogrMainView *self,
void
frogr_main_view_show_progress (FrogrMainView *self, const gchar *text)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
/* Reset values */
gtk_label_set_text (GTK_LABEL (priv->progress_label), text ? text : "");
@@ -2027,18 +2032,22 @@ frogr_main_view_show_progress (FrogrMainView *self, const gchar *text)
void
frogr_main_view_set_progress_description (FrogrMainView *self, const gchar *text)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
gtk_label_set_text (GTK_LABEL (priv->progress_label), text);
}
void
frogr_main_view_set_progress_status_text (FrogrMainView *self, const gchar *text)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
/* Set superimposed text, if specified */
if (text != NULL)
@@ -2048,9 +2057,11 @@ frogr_main_view_set_progress_status_text (FrogrMainView *self, const gchar *text
void
frogr_main_view_set_progress_status_fraction (FrogrMainView *self, double fraction)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
/* Check limits */
if (fraction < 0.0)
@@ -2064,9 +2075,11 @@ frogr_main_view_set_progress_status_fraction (FrogrMainView *self, double fracti
void
frogr_main_view_pulse_progress (FrogrMainView *self)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
/* Show the widget and pulse */
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
@@ -2078,17 +2091,21 @@ frogr_main_view_pulse_progress (FrogrMainView *self)
void
frogr_main_view_hide_progress (FrogrMainView *self)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
gtk_widget_hide (GTK_WIDGET (priv->progress_dialog));
}
FrogrMainViewModel *
frogr_main_view_get_model (FrogrMainView *self)
{
+ FrogrMainViewPrivate *priv = NULL;
+
g_return_val_if_fail(FROGR_IS_MAIN_VIEW (self), NULL);
- FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
return priv->model;
}
diff --git a/src/frogr-photoset.c b/src/frogr-photoset.c
index 84fa654..05da8b8 100644
--- a/src/frogr-photoset.c
+++ b/src/frogr-photoset.c
@@ -27,7 +27,7 @@
FROGR_TYPE_SET, \
FrogrPhotoSetPrivate))
-G_DEFINE_TYPE (FrogrPhotoSet, frogr_photoset, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrPhotoSet, frogr_photoset, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrPhotoSetPrivate FrogrPhotoSetPrivate;
@@ -47,7 +47,7 @@ enum {
PROP_DESCRIPTION,
PROP_ID,
PROP_PRIMARY_PHOTO_ID,
- PROP_N_PHOTOS,
+ PROP_N_PHOTOS
};
/* Prototypes */
@@ -210,11 +210,10 @@ frogr_photoset_new (const gchar *title,
g_return_val_if_fail (title, NULL);
g_return_val_if_fail (description, NULL);
- GObject *new = g_object_new(FROGR_TYPE_SET,
- "title", title,
- "description", description,
- NULL);
- return FROGR_PHOTOSET (new);
+ return FROGR_PHOTOSET (g_object_new(FROGR_TYPE_SET,
+ "title", title,
+ "description", description,
+ NULL));
}
@@ -223,11 +222,11 @@ frogr_photoset_new (const gchar *title,
const gchar *
frogr_photoset_get_title (FrogrPhotoSet *self)
{
- g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
return (const gchar *)priv->title;
}
@@ -235,12 +234,12 @@ void
frogr_photoset_set_title (FrogrPhotoSet *self,
const gchar *title)
{
+ FrogrPhotoSetPrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_SET(self));
g_return_if_fail(title != NULL);
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
-
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
g_free (priv->title);
priv->title = g_strdup (title);
}
@@ -248,11 +247,11 @@ frogr_photoset_set_title (FrogrPhotoSet *self,
const gchar *
frogr_photoset_get_description (FrogrPhotoSet *self)
{
- g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
return (const gchar *)priv->description;
}
@@ -260,11 +259,11 @@ void
frogr_photoset_set_description (FrogrPhotoSet *self,
const gchar *description)
{
- g_return_if_fail(FROGR_IS_SET(self));
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_SET(self));
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
g_free (priv->description);
priv->description = g_strdup (description);
}
@@ -272,11 +271,11 @@ frogr_photoset_set_description (FrogrPhotoSet *self,
const gchar *
frogr_photoset_get_id (FrogrPhotoSet *self)
{
- g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
return (const gchar *)priv->id;
}
@@ -284,11 +283,11 @@ void
frogr_photoset_set_id (FrogrPhotoSet *self,
const gchar *id)
{
- g_return_if_fail(FROGR_IS_SET(self));
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_SET(self));
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
g_free (priv->id);
priv->id = g_strdup (id);
}
@@ -296,11 +295,11 @@ frogr_photoset_set_id (FrogrPhotoSet *self,
const gchar *
frogr_photoset_get_primary_photo_id (FrogrPhotoSet *self)
{
- g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_SET(self), NULL);
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
return (const gchar *)priv->primary_photo_id;
}
@@ -308,11 +307,11 @@ void
frogr_photoset_set_primary_photo_id (FrogrPhotoSet *self,
const gchar *primary_photo_id)
{
- g_return_if_fail(FROGR_IS_SET(self));
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_SET(self));
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
g_free (priv->primary_photo_id);
priv->primary_photo_id = g_strdup (primary_photo_id);
}
@@ -320,11 +319,11 @@ frogr_photoset_set_primary_photo_id (FrogrPhotoSet *self,
gint
frogr_photoset_get_n_photos (FrogrPhotoSet *self)
{
- g_return_val_if_fail(FROGR_IS_SET(self), FALSE);
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_SET(self), FALSE);
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
return priv->n_photos;
}
@@ -332,11 +331,11 @@ void
frogr_photoset_set_n_photos (FrogrPhotoSet *self,
gint n)
{
- g_return_if_fail(FROGR_IS_SET(self));
+ FrogrPhotoSetPrivate *priv = NULL;
- FrogrPhotoSetPrivate *priv =
- FROGR_PHOTOSET_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_SET(self));
+ priv = FROGR_PHOTOSET_GET_PRIVATE (self);
priv->n_photos = n;
}
diff --git a/src/frogr-picture-loader.c b/src/frogr-picture-loader.c
index 26fdb9d..2d44ed2 100644
--- a/src/frogr-picture-loader.c
+++ b/src/frogr-picture-loader.c
@@ -46,7 +46,7 @@
FROGR_TYPE_PICTURE_LOADER, \
FrogrPictureLoaderPrivate))
-G_DEFINE_TYPE (FrogrPictureLoader, frogr_picture_loader, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrPictureLoader, frogr_picture_loader, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrPictureLoaderPrivate FrogrPictureLoaderPrivate;
@@ -254,16 +254,18 @@ _load_next_picture_cb (GObject *object,
GAsyncResult *res,
gpointer data)
{
- FrogrPictureLoader *self = FROGR_PICTURE_LOADER (data);;
- FrogrPictureLoaderPrivate *priv =
- FROGR_PICTURE_LOADER_GET_PRIVATE (self);
-
+ FrogrPictureLoader *self = NULL;
+ FrogrPictureLoaderPrivate *priv = NULL;
FrogrPicture *fpicture = NULL;
- GFile *file = G_FILE (object);
+ GFile *file = NULL;
GError *error = NULL;
gchar *contents = NULL;
gsize length = 0;
+ self = FROGR_PICTURE_LOADER (data);;
+ priv = FROGR_PICTURE_LOADER_GET_PRIVATE (self);
+
+ file = G_FILE (object);
if (g_file_load_contents_finish (file, res, &contents, &length, NULL, &error))
{
GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new ();
@@ -517,10 +519,11 @@ frogr_picture_loader_new (GSList *file_uris,
void
frogr_picture_loader_load (FrogrPictureLoader *self)
{
+ FrogrPictureLoaderPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_PICTURE_LOADER (self));
- FrogrPictureLoaderPrivate *priv =
- FROGR_PICTURE_LOADER_GET_PRIVATE (self);
+ priv = FROGR_PICTURE_LOADER_GET_PRIVATE (self);
/* Check first whether there's something to load */
if (priv->file_uris == NULL)
diff --git a/src/frogr-picture-uploader.c b/src/frogr-picture-uploader.c
index 536cf95..2dce4de 100644
--- a/src/frogr-picture-uploader.c
+++ b/src/frogr-picture-uploader.c
@@ -36,7 +36,7 @@
FROGR_TYPE_PICTURE_UPLOADER, \
FrogrPictureUploaderPrivate))
-G_DEFINE_TYPE (FrogrPictureUploader, frogr_picture_uploader, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrPictureUploader, frogr_picture_uploader, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrPictureUploaderPrivate FrogrPictureUploaderPrivate;
@@ -246,10 +246,11 @@ frogr_picture_uploader_new (GSList *pictures,
void
frogr_picture_uploader_upload (FrogrPictureUploader *self)
{
+ FrogrPictureUploaderPrivate *priv = NULL;
+
g_return_if_fail (FROGR_IS_PICTURE_UPLOADER (self));
- FrogrPictureUploaderPrivate *priv =
- FROGR_PICTURE_UPLOADER_GET_PRIVATE (self);
+ priv = FROGR_PICTURE_UPLOADER_GET_PRIVATE (self);
/* Check first whether there's something to upload */
if (priv->pictures == NULL)
diff --git a/src/frogr-picture.c b/src/frogr-picture.c
index 80863d0..c74bca7 100644
--- a/src/frogr-picture.c
+++ b/src/frogr-picture.c
@@ -29,7 +29,7 @@
FROGR_TYPE_PICTURE, \
FrogrPicturePrivate))
-G_DEFINE_TYPE (FrogrPicture, frogr_picture, G_TYPE_OBJECT);
+G_DEFINE_TYPE (FrogrPicture, frogr_picture, G_TYPE_OBJECT)
/* Private struct */
typedef struct _FrogrPicturePrivate FrogrPicturePrivate;
@@ -521,17 +521,16 @@ frogr_picture_new (const gchar *fileuri,
g_return_val_if_fail (fileuri, NULL);
g_return_val_if_fail (title, NULL);
- GObject *new = g_object_new(FROGR_TYPE_PICTURE,
- "fileuri", fileuri,
- "title", title,
- "is-public", public,
- "is-family", family,
- "is-friend", friend,
- "safety-level", FSP_SAFETY_LEVEL_SAFE,
- "content-type", FSP_CONTENT_TYPE_PHOTO,
- "show_in_search", TRUE,
- NULL);
- return FROGR_PICTURE (new);
+ return FROGR_PICTURE (g_object_new(FROGR_TYPE_PICTURE,
+ "fileuri", fileuri,
+ "title", title,
+ "is-public", public,
+ "is-family", family,
+ "is-friend", friend,
+ "safety-level", FSP_SAFETY_LEVEL_SAFE,
+ "content-type", FSP_CONTENT_TYPE_PHOTO,
+ "show_in_search", TRUE,
+ NULL));
}
@@ -540,11 +539,11 @@ frogr_picture_new (const gchar *fileuri,
const gchar *
frogr_picture_get_id (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return (const gchar *)priv->id;
}
@@ -552,11 +551,11 @@ void
frogr_picture_set_id (FrogrPicture *self,
const gchar *id)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
g_free (priv->id);
priv->id = g_strdup (id);
}
@@ -564,11 +563,11 @@ frogr_picture_set_id (FrogrPicture *self,
const gchar *
frogr_picture_get_fileuri (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return (const gchar *)priv->fileuri;
}
@@ -576,11 +575,11 @@ void
frogr_picture_set_fileuri (FrogrPicture *self,
const gchar *fileuri)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
g_free (priv->fileuri);
priv->fileuri = g_strdup (fileuri);
}
@@ -588,11 +587,11 @@ frogr_picture_set_fileuri (FrogrPicture *self,
const gchar *
frogr_picture_get_title (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return (const gchar *)priv->title;
}
@@ -600,12 +599,12 @@ void
frogr_picture_set_title (FrogrPicture *self,
const gchar *title)
{
+ FrogrPicturePrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_PICTURE(self));
g_return_if_fail(title != NULL);
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
-
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
g_free (priv->title);
priv->title = g_strdup (title);
}
@@ -613,11 +612,11 @@ frogr_picture_set_title (FrogrPicture *self,
const gchar *
frogr_picture_get_description (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return (const gchar *)priv->description;
}
@@ -625,11 +624,11 @@ void
frogr_picture_set_description (FrogrPicture *self,
const gchar *description)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
g_free (priv->description);
priv->description = g_strdup (description);
}
@@ -637,32 +636,33 @@ frogr_picture_set_description (FrogrPicture *self,
const GSList *
frogr_picture_get_tags_list (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->tags_list;
}
const gchar *
frogr_picture_get_tags (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->tags_string;
}
void
frogr_picture_set_tags (FrogrPicture *self, const gchar *tags_string)
{
+ FrogrPicturePrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_PICTURE(self));
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
/* First remove all the previous tags list */
g_slist_foreach (priv->tags_list, (GFunc) g_free, NULL);
@@ -678,7 +678,6 @@ frogr_picture_add_tags (FrogrPicture *self, const gchar *tags_string)
{
g_return_if_fail(FROGR_IS_PICTURE(self));
- /* Add to internal tags_list */
_add_tags_to_tags_list (self, tags_string);
}
@@ -693,11 +692,11 @@ frogr_picture_remove_tags (FrogrPicture *self)
gboolean
frogr_picture_is_public (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->is_public;
}
@@ -705,22 +704,22 @@ void
frogr_picture_set_public (FrogrPicture *self,
gboolean public)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->is_public = public;
}
gboolean
frogr_picture_is_friend (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->is_friend;
}
@@ -728,22 +727,22 @@ void
frogr_picture_set_friend (FrogrPicture *self,
gboolean friend)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->is_friend = friend;
}
gboolean
frogr_picture_is_family (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->is_family;
}
@@ -751,22 +750,22 @@ void
frogr_picture_set_family (FrogrPicture *self,
gboolean family)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->is_family = family;
}
FspSafetyLevel
frogr_picture_get_safety_level (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->safety_level;
}
@@ -774,22 +773,22 @@ void
frogr_picture_set_safety_level (FrogrPicture *self,
FspSafetyLevel safety_level)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->safety_level = safety_level;
}
FspContentType
frogr_picture_get_content_type (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->content_type;
}
@@ -797,22 +796,22 @@ void
frogr_picture_set_content_type (FrogrPicture *self,
FspContentType content_type)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->content_type = content_type;
}
gboolean
frogr_picture_show_in_search (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->show_in_search;
}
@@ -820,22 +819,22 @@ void
frogr_picture_set_show_in_search (FrogrPicture *self,
gboolean show_in_search)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->show_in_search = show_in_search;
}
GdkPixbuf *
frogr_picture_get_pixbuf (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->pixbuf;
}
@@ -843,11 +842,11 @@ void
frogr_picture_set_pixbuf (FrogrPicture *self,
GdkPixbuf *pixbuf)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
if (priv->pixbuf)
g_object_unref (priv->pixbuf);
@@ -856,20 +855,20 @@ frogr_picture_set_pixbuf (FrogrPicture *self,
gulong frogr_picture_get_filesize (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
-
FrogrPicturePrivate *priv = NULL;
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->filesize;
}
void frogr_picture_set_filesize (FrogrPicture *self, gulong filesize)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
-
FrogrPicturePrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
priv->filesize = filesize;
}
@@ -877,11 +876,11 @@ void frogr_picture_set_filesize (FrogrPicture *self, gulong filesize)
void
frogr_picture_set_datetime (FrogrPicture *self, const gchar *datetime)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
g_free (priv->datetime);
priv->datetime = g_strdup (datetime);
}
@@ -889,21 +888,21 @@ frogr_picture_set_datetime (FrogrPicture *self, const gchar *datetime)
const gchar *
frogr_picture_get_datetime (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
+ FrogrPicturePrivate *priv = NULL;
- FrogrPicturePrivate *priv =
- FROGR_PICTURE_GET_PRIVATE (self);
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), 0);
+ priv = FROGR_PICTURE_GET_PRIVATE (self);
return (const gchar *)priv->datetime;
}
GSList *
frogr_picture_get_sets (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
-
FrogrPicturePrivate *priv = NULL;
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->sets;
}
@@ -911,13 +910,13 @@ frogr_picture_get_sets (FrogrPicture *self)
void
frogr_picture_set_sets (FrogrPicture *self, GSList *sets)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
-
GSList *new_list = NULL;
GSList *item = NULL;
FrogrPhotoSet *set = NULL;
FrogrPicturePrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
/* First remove all the previous sets list */
@@ -937,11 +936,11 @@ frogr_picture_set_sets (FrogrPicture *self, GSList *sets)
void
frogr_picture_add_set (FrogrPicture *self, FrogrPhotoSet *set)
{
+ FrogrPicturePrivate *priv = NULL;
+
g_return_if_fail(FROGR_IS_PICTURE(self));
g_return_if_fail(FROGR_IS_SET(set));
- FrogrPicturePrivate *priv = NULL;
-
/* Do not add the same set twice */
if (frogr_picture_in_set (self, set))
return;
@@ -961,10 +960,10 @@ frogr_picture_remove_sets (FrogrPicture *self)
gboolean
frogr_picture_in_set (FrogrPicture *self, FrogrPhotoSet *set)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
-
FrogrPicturePrivate *priv = NULL;
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
if (g_slist_index (priv->sets, set) != -1)
return TRUE;
@@ -975,10 +974,10 @@ frogr_picture_in_set (FrogrPicture *self, FrogrPhotoSet *set)
GSList *
frogr_picture_get_groups (FrogrPicture *self)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
-
FrogrPicturePrivate *priv = NULL;
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), NULL);
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
return priv->groups;
}
@@ -986,13 +985,13 @@ frogr_picture_get_groups (FrogrPicture *self)
void
frogr_picture_set_groups (FrogrPicture *self, GSList *groups)
{
- g_return_if_fail(FROGR_IS_PICTURE(self));
-
GSList *new_list = NULL;
GSList *item = NULL;
FrogrGroup *group = NULL;
FrogrPicturePrivate *priv = NULL;
+ g_return_if_fail(FROGR_IS_PICTURE(self));
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
/* First remove all the previous groups list */
@@ -1020,10 +1019,10 @@ frogr_picture_remove_groups (FrogrPicture *self)
gboolean
frogr_picture_in_group (FrogrPicture *self, FrogrGroup *group)
{
- g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
-
FrogrPicturePrivate *priv = NULL;
+ g_return_val_if_fail(FROGR_IS_PICTURE(self), FALSE);
+
priv = FROGR_PICTURE_GET_PRIVATE (self);
if (g_slist_index (priv->groups, group) != -1)
return TRUE;
diff --git a/src/frogr-settings-dialog.c b/src/frogr-settings-dialog.c
index 6344123..434e668 100644
--- a/src/frogr-settings-dialog.c
+++ b/src/frogr-settings-dialog.c
@@ -36,7 +36,7 @@
FROGR_TYPE_SETTINGS_DIALOG, \
FrogrSettingsDialogPrivate))
-G_DEFINE_TYPE (FrogrSettingsDialog, frogr_settings_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (FrogrSettingsDialog, frogr_settings_dialog, GTK_TYPE_DIALOG)
typedef struct _FrogrSettingsDialogPrivate {
FrogrController *controller;
@@ -75,7 +75,7 @@ typedef struct _FrogrSettingsDialogPrivate {
FspSafetyLevel safety_level;
FspContentType content_type;
- gboolean use_proxy;;
+ gboolean use_proxy;
gchar *proxy_host;
gchar *proxy_port;
gchar *proxy_username;
diff --git a/src/frogr-util.c b/src/frogr-util.c
index 643f09f..b26edc4 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -48,12 +48,13 @@ static gboolean frogr_util_spawn_command (const gchar* cmd)
void
frogr_util_open_url_in_browser (const gchar *url)
{
- if (url == NULL)
- return;
-
gchar *command = NULL;
GError *error = NULL;
+ /* Early return */
+ if (url == NULL)
+ return;
+
#ifdef MAC_INTEGRATION
/* In MacOSX neither gnome-open nor gtk_show_uri() will work */
command = g_strdup_printf ("open %s", url);
diff --git a/src/main.c b/src/main.c
index 0da29c8..2b48480 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,11 +63,11 @@ _get_uris_list_from_array (char **uris_str, int n_uris)
static gboolean
_load_pictures_on_idle (gpointer data)
{
- g_return_val_if_fail (data, FALSE);
-
FrogrController *fcontroller = NULL;
GSList *fileuris = NULL;
+ g_return_val_if_fail (data, FALSE);
+
fcontroller = frogr_controller_get_instance ();
fileuris = (GSList *)data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]