project: fix build warnings

https://bugzilla.gnome.org/show_bug.cgi?id=770466
This commit is contained in:
Georges Basile Stavracas Neto
2016-08-29 23:08:39 -03:00
parent 1cb71ea4a9
commit cd50bec506
12 changed files with 87 additions and 99 deletions
+1
View File
@@ -4,6 +4,7 @@ AM_CPPFLAGS = \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \ -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
-DUI_DATA_DIR=\""$(pkgdatadir)/style"\" \ -DUI_DATA_DIR=\""$(pkgdatadir)/style"\" \
$(WARN_CFLAGS) \ $(WARN_CFLAGS) \
-Wno-sign-compare \
-DEDS_DISABLE_DEPRECATED \ -DEDS_DISABLE_DEPRECATED \
-DGOA_API_IS_SUBJECT_TO_CHANGE \ -DGOA_API_IS_SUBJECT_TO_CHANGE \
$(CALENDAR_CFLAGS) $(CALENDAR_CFLAGS)
+7 -7
View File
@@ -1248,7 +1248,7 @@ cal_data_model_process_modified_or_added_objects (ECalClientView *view,
cal_data_model_thaw_all_subscribers (data_model); cal_data_model_thaw_all_subscribers (data_model);
if (to_expand_recurrences) { if (to_expand_recurrences) {
ECalClient *client = e_cal_client_view_ref_client (view); ECalClient *rclient = e_cal_client_view_ref_client (view);
view_data_lock (view_data); view_data_lock (view_data);
view_data->to_expand_recurrences = g_slist_concat ( view_data->to_expand_recurrences = g_slist_concat (
@@ -1257,7 +1257,7 @@ cal_data_model_process_modified_or_added_objects (ECalClientView *view,
view_data_unlock (view_data); view_data_unlock (view_data);
cal_data_model_submit_internal_thread_job (data_model, cal_data_model_submit_internal_thread_job (data_model,
cal_data_model_expand_recurrences_thread, client); cal_data_model_expand_recurrences_thread, rclient);
} }
} }
@@ -1881,9 +1881,9 @@ cal_data_model_set_property (GObject *object,
E_CAL_DATA_MODEL (object), E_CAL_DATA_MODEL (object),
g_value_get_pointer (value)); g_value_get_pointer (value));
return; return;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
static void static void
@@ -1906,9 +1906,9 @@ cal_data_model_get_property (GObject *object,
e_cal_data_model_get_timezone ( e_cal_data_model_get_timezone (
E_CAL_DATA_MODEL (object))); E_CAL_DATA_MODEL (object)));
return; return;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
static void static void
@@ -2646,7 +2646,7 @@ e_cal_data_model_subscribe (ECalDataModel *data_model,
LOCK_PROPS (); LOCK_PROPS ();
for (link = data_model->priv->subscribers; link; link = g_slist_next (link)) { for (link = data_model->priv->subscribers; link; link = g_slist_next (link)) {
SubscriberData *subs_data = link->data; subs_data = link->data;
if (!subs_data) if (!subs_data)
continue; continue;
+12 -11
View File
@@ -447,7 +447,7 @@ gcal_application_show_about (GSimpleAction *simple,
{ {
GcalApplication *self; GcalApplication *self;
char *copyright; char *copyright;
GDateTime *date; GDateTime *dt;
int created_year = 2012; int created_year = 2012;
const gchar *authors[] = { const gchar *authors[] = {
"Erick Pérez Castellanos <erickpc@gnome.org>", "Erick Pérez Castellanos <erickpc@gnome.org>",
@@ -464,9 +464,9 @@ gcal_application_show_about (GSimpleAction *simple,
}; };
self = GCAL_APPLICATION (user_data); self = GCAL_APPLICATION (user_data);
date = g_date_time_new_now_local (); dt = g_date_time_new_now_local ();
if (g_date_time_get_year (date) == created_year) if (g_date_time_get_year (dt) == created_year)
{ {
copyright = g_strdup_printf (_("Copyright \xC2\xA9 %d " copyright = g_strdup_printf (_("Copyright \xC2\xA9 %d "
"The Calendar authors"), "The Calendar authors"),
@@ -476,7 +476,7 @@ gcal_application_show_about (GSimpleAction *simple,
{ {
copyright = g_strdup_printf (_("Copyright \xC2\xA9 %d\xE2\x80\x93%d " copyright = g_strdup_printf (_("Copyright \xC2\xA9 %d\xE2\x80\x93%d "
"The Calendar authors"), "The Calendar authors"),
created_year, g_date_time_get_year (date)); created_year, g_date_time_get_year (dt));
} }
gtk_show_about_dialog (GTK_WINDOW (self->window), gtk_show_about_dialog (GTK_WINDOW (self->window),
@@ -489,8 +489,9 @@ gcal_application_show_about (GSimpleAction *simple,
"logo-icon-name", "org.gnome.Calendar", "logo-icon-name", "org.gnome.Calendar",
"translator-credits", _("translator-credits"), "translator-credits", _("translator-credits"),
NULL); NULL);
g_free (copyright);
g_date_time_unref (date); g_clear_pointer (&copyright, g_free);
g_clear_pointer (&dt, g_date_time_unref);
} }
static void static void
@@ -530,16 +531,16 @@ gcal_application_get_settings (GcalApplication *app)
void void
gcal_application_set_uuid (GcalApplication *application, gcal_application_set_uuid (GcalApplication *application,
const gchar *uuid) const gchar *app_uuid)
{ {
g_free (application->uuid); g_free (application->uuid);
application->uuid = g_strdup (uuid); application->uuid = g_strdup (app_uuid);
} }
void void
gcal_application_set_initial_date (GcalApplication *application, gcal_application_set_initial_date (GcalApplication *application,
GDateTime *date) GDateTime *initial_date)
{ {
g_free (application->initial_date); g_clear_pointer (&application->initial_date, g_date_time_unref);
application->initial_date = datetime_to_icaltime (date); application->initial_date = datetime_to_icaltime (initial_date);
} }
+2 -2
View File
@@ -34,10 +34,10 @@ GcalApplication* gcal_application_new (void);
GcalManager* gcal_application_get_manager (GcalApplication *app); GcalManager* gcal_application_get_manager (GcalApplication *app);
GSettings* gcal_application_get_settings (GcalApplication *app); GSettings* gcal_application_get_settings (GcalApplication *app);
void gcal_application_set_uuid (GcalApplication *application, void gcal_application_set_uuid (GcalApplication *application,
const gchar *uuid); const gchar *app_uuid);
void gcal_application_set_initial_date (GcalApplication *application, void gcal_application_set_initial_date (GcalApplication *application,
GDateTime *date); GDateTime *initial_date);
G_END_DECLS G_END_DECLS
+28 -55
View File
@@ -662,31 +662,35 @@ gcal_edit_dialog_all_day_changed (GtkWidget *widget,
/* /*
* Alarm related functions * Alarm related functions
*/ */
#define OFFSET(x) (G_STRUCT_OFFSET (GcalEditDialog, x))
#define WIDGET_FROM_OFFSET(x) (G_STRUCT_MEMBER (GtkWidget*, self, x))
struct
{
gint minutes;
gint button_offset;
} minutes_button[] = {
{ 5, OFFSET (five_minutes_button) },
{ 10, OFFSET (ten_minutes_button) },
{ 30, OFFSET (thirty_minutes_button) },
{ 60, OFFSET (one_hour_button) },
{ 1440, OFFSET (one_day_button) },
{ 2880, OFFSET (two_days_button) },
{ 4320, OFFSET (three_days_button) },
{ 10080, OFFSET (one_week_button) }
};
static GtkWidget* static GtkWidget*
get_row_fow_alarm_trigger_minutes (GcalEditDialog *self, get_row_fow_alarm_trigger_minutes (GcalEditDialog *self,
gint minutes) gint minutes)
{ {
gint i; guint i;
struct
{
gint minutes;
GtkWidget *button;
} minutes_button[] = {
{ 5, self->five_minutes_button },
{ 10, self->ten_minutes_button },
{ 30, self->thirty_minutes_button },
{ 60, self->one_hour_button },
{ 1440, self->one_day_button },
{ 2880, self->two_days_button },
{ 4320, self->three_days_button },
{ 10080, self->one_week_button }
};
for (i = 0; i < G_N_ELEMENTS (minutes_button); i++) for (i = 0; i < G_N_ELEMENTS (minutes_button); i++)
{ {
if (minutes_button[i].minutes == minutes) if (minutes_button[i].minutes == minutes)
return minutes_button[i].button; return WIDGET_FROM_OFFSET (minutes_button[i].button_offset);
} }
return NULL; return NULL;
@@ -862,22 +866,7 @@ static void
setup_alarms (GcalEditDialog *self) setup_alarms (GcalEditDialog *self)
{ {
GList *alarms, *l; GList *alarms, *l;
gint i; guint i;
struct
{
gint minutes;
GtkWidget *button;
} minutes_button[] = {
{ 5, self->five_minutes_button },
{ 10, self->ten_minutes_button },
{ 30, self->thirty_minutes_button },
{ 60, self->one_hour_button },
{ 1440, self->one_day_button },
{ 2880, self->two_days_button },
{ 4320, self->three_days_button },
{ 10080, self->one_week_button }
};
gtk_widget_set_visible (self->alarms_listbox, gcal_event_has_alarms (self->event)); gtk_widget_set_visible (self->alarms_listbox, gcal_event_has_alarms (self->event));
@@ -893,7 +882,7 @@ setup_alarms (GcalEditDialog *self)
* and only make them insensitive when needed. * and only make them insensitive when needed.
*/ */
for (i = 0; i < G_N_ELEMENTS (minutes_button); i++) for (i = 0; i < G_N_ELEMENTS (minutes_button); i++)
gtk_widget_set_sensitive (minutes_button[i].button, TRUE); gtk_widget_set_sensitive (WIDGET_FROM_OFFSET (minutes_button[i].button_offset), TRUE);
for (l = alarms; l != NULL; l = l->next) for (l = alarms; l != NULL; l = l->next)
{ {
@@ -911,7 +900,7 @@ setup_alarms (GcalEditDialog *self)
for (i = 0; i < G_N_ELEMENTS (minutes_button); i++) for (i = 0; i < G_N_ELEMENTS (minutes_button); i++)
{ {
if (minutes_button[i].minutes == minutes) if (minutes_button[i].minutes == minutes)
gtk_widget_set_sensitive (minutes_button[i].button, FALSE); gtk_widget_set_sensitive (WIDGET_FROM_OFFSET (minutes_button[i].button_offset), FALSE);
} }
/* Add the row */ /* Add the row */
@@ -925,32 +914,16 @@ static void
add_alarm_button_clicked (GtkWidget *button, add_alarm_button_clicked (GtkWidget *button,
GcalEditDialog *self) GcalEditDialog *self)
{ {
gint i, minutes; guint i, minutes;
struct
{
GtkWidget *button;
gint minutes;
} button_minutes[] = {
{ self->five_minutes_button, 5 },
{ self->ten_minutes_button, 10 },
{ self->thirty_minutes_button, 30 },
{ self->one_hour_button, 60 },
{ self->one_day_button, 1440 },
{ self->two_days_button, 2880 },
{ self->three_days_button, 4320 },
{ self->one_week_button, 10080 },
{ NULL, 0 }
};
/* Search for the button minute */ /* Search for the button minute */
minutes = 0; minutes = 0;
for (i = 0; i < G_N_ELEMENTS (button_minutes); i++) for (i = 0; i < G_N_ELEMENTS (minutes_button); i++)
{ {
if (button_minutes[i].button == button) if (WIDGET_FROM_OFFSET (minutes_button[i].button_offset) == button)
{ {
minutes = button_minutes[i].minutes; minutes = minutes_button[i].minutes;
break; break;
} }
} }
-2
View File
@@ -957,8 +957,6 @@ gcal_event_add_alarm (GcalEvent *self,
/* Only 1 alarm per relative time */ /* Only 1 alarm per relative time */
if (g_hash_table_contains (self->alarms, GINT_TO_POINTER (type))) if (g_hash_table_contains (self->alarms, GINT_TO_POINTER (type)))
{ {
const gchar *alarm_uid;
alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type)); alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type));
e_cal_component_remove_alarm (self->component, alarm_uid); e_cal_component_remove_alarm (self->component, alarm_uid);
+8 -4
View File
@@ -925,9 +925,10 @@ gcal_manager_set_property (GObject *object,
if (g_set_object (&self->settings, g_value_get_object (value))) if (g_set_object (&self->settings, g_value_get_object (value)))
g_object_notify (object, "settings"); g_object_notify (object, "settings");
return; return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
} }
static void static void
@@ -943,6 +944,9 @@ gcal_manager_get_property (GObject *object,
case PROP_SETTINGS: case PROP_SETTINGS:
g_value_set_object (value, self->settings); g_value_set_object (value, self->settings);
return; return;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1250,7 +1254,7 @@ gcal_manager_enable_source (GcalManager *manager,
{ {
GcalManagerUnit *unit; GcalManagerUnit *unit;
gchar **new_disabled_sources; gchar **new_disabled_sources;
gint i; guint i;
unit = g_hash_table_lookup (manager->clients, source); unit = g_hash_table_lookup (manager->clients, source);
@@ -1293,7 +1297,7 @@ gcal_manager_disable_source (GcalManager *manager,
{ {
GcalManagerUnit *unit; GcalManagerUnit *unit;
gchar **new_disabled_sources; gchar **new_disabled_sources;
gint i; guint i;
const gchar *source_uid; const gchar *source_uid;
unit = g_hash_table_lookup (manager->clients, source); unit = g_hash_table_lookup (manager->clients, source);
+1 -1
View File
@@ -2099,7 +2099,7 @@ gcal_month_view_motion_notify_event (GtkWidget *widget,
if (new_end_cell >= priv->days_delay && new_end_cell < days) if (new_end_cell >= priv->days_delay && new_end_cell < days)
{ {
guint previous_end_cell; gint previous_end_cell;
previous_end_cell = new_end_cell; previous_end_cell = new_end_cell;
+14 -9
View File
@@ -511,8 +511,8 @@ description_label_link_activated (GtkWidget *widget,
gchar *uri, gchar *uri,
gpointer user_data) gpointer user_data)
{ {
gchar *command[] = {"gnome-control-center", "online-accounts", NULL}; const gchar* const command[] = { "gnome-control-center", "online-accounts", NULL };
g_spawn_async (NULL, command, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); g_spawn_async (NULL, (gchar**) command, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
return TRUE; return TRUE;
} }
@@ -653,11 +653,14 @@ name_entry_text_changed (GObject *object,
} }
static void static void
spawn_goa_with_args (gchar *action, spawn_goa_with_args (const gchar *action,
gchar *arg) const gchar *arg)
{ {
gchar *command[] = {"gnome-control-center", "online-accounts", action, arg, NULL}; const gchar* const command[] = { "gnome-control-center", "online-accounts", action, arg, NULL };
g_spawn_async (NULL, command, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL, NULL, NULL, NULL, NULL); g_spawn_async (NULL, (gchar**) command,
NULL,
G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL,
NULL, NULL, NULL, NULL);
} }
/** /**
@@ -1094,8 +1097,7 @@ static void
online_accounts_settings_button_clicked (GtkWidget *button, online_accounts_settings_button_clicked (GtkWidget *button,
gpointer user_data) gpointer user_data)
{ {
gchar *command[] = {"gnome-control-center", "online-accounts", NULL}; spawn_goa_with_args (NULL, NULL);
g_spawn_async (NULL, command, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
} }
static void static void
@@ -1979,7 +1981,7 @@ add_goa_account (GcalSourceDialog *dialog,
GtkWidget *enabled_label; GtkWidget *enabled_label;
GtkWidget *row; GtkWidget *row;
GtkWidget *icon; GtkWidget *icon;
gchar *icon_name = "goa"; const gchar *icon_name;
type = get_account_type (account); type = get_account_type (account);
@@ -2011,6 +2013,8 @@ add_goa_account (GcalSourceDialog *dialog,
break; break;
case GCAL_ACCOUNT_TYPE_NOT_SUPPORTED: case GCAL_ACCOUNT_TYPE_NOT_SUPPORTED:
default:
icon_name = "goa";
g_assert_not_reached (); g_assert_not_reached ();
} }
@@ -2098,6 +2102,7 @@ goa_account_removed_cb (GoaClient *client,
gtk_widget_show (self->owncloud_stub_row); gtk_widget_show (self->owncloud_stub_row);
break; break;
case GCAL_ACCOUNT_TYPE_NOT_SUPPORTED:
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
-1
View File
@@ -262,7 +262,6 @@ gcal_subscriber_view_remove (GtkContainer *container,
while (g_hash_table_iter_next (&iter, &key, &value)) while (g_hash_table_iter_next (&iter, &key, &value))
{ {
GList *aux;
gboolean should_break; gboolean should_break;
should_break = FALSE; should_break = FALSE;
+3 -3
View File
@@ -1148,11 +1148,11 @@ gcal_week_view_add (GtkContainer *container,
for (l = priv->days[day]; l != NULL; l = l->next) for (l = priv->days[day]; l != NULL; l = l->next)
{ {
GtkWidget *event; GtkWidget *event_widget;
event = GTK_WIDGET (((GcalWeekViewChild*) l->data)->widget); event_widget = GTK_WIDGET (((GcalWeekViewChild*) l->data)->widget);
if (gcal_event_widget_equal (GCAL_EVENT_WIDGET (widget), if (gcal_event_widget_equal (GCAL_EVENT_WIDGET (widget),
GCAL_EVENT_WIDGET (event))) GCAL_EVENT_WIDGET (event_widget)))
{ {
//TODO: remove once the main-dev phase its over //TODO: remove once the main-dev phase its over
g_warning ("Trying to add an event with the same uuid to the view"); g_warning ("Trying to add an event with the same uuid to the view");
+11 -4
View File
@@ -450,6 +450,8 @@ update_today_button_sensitive (GcalWindow *window)
sensitive = window->active_date->year != window->current_date->year; sensitive = window->active_date->year != window->current_date->year;
break; break;
case GCAL_WINDOW_VIEW_LIST:
case GCAL_WINDOW_VIEW_SEARCH:
default: default:
sensitive = TRUE; sensitive = TRUE;
break; break;
@@ -498,6 +500,7 @@ date_updated (GtkButton *button,
break; break;
case GCAL_WINDOW_VIEW_LIST: case GCAL_WINDOW_VIEW_LIST:
case GCAL_WINDOW_VIEW_SEARCH: case GCAL_WINDOW_VIEW_SEARCH:
default:
break; break;
} }
@@ -1141,6 +1144,7 @@ edit_dialog_closed (GtkDialog *dialog,
break; break;
case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_CANCEL:
default:
break; break;
} }
@@ -1513,9 +1517,10 @@ gcal_window_set_property (GObject *object,
g_object_notify (object, "manager"); g_object_notify (object, "manager");
} }
return; return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
} }
static void static void
@@ -1540,9 +1545,10 @@ gcal_window_get_property (GObject *object,
case PROP_NEW_EVENT_MODE: case PROP_NEW_EVENT_MODE:
g_value_set_boolean (value, self->new_event_mode); g_value_set_boolean (value, self->new_event_mode);
return; return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
} }
static gboolean static gboolean
@@ -1656,6 +1662,7 @@ gcal_window_new_event (GcalWindow *window)
break; break;
case GCAL_WINDOW_VIEW_LIST: case GCAL_WINDOW_VIEW_LIST:
case GCAL_WINDOW_VIEW_SEARCH: case GCAL_WINDOW_VIEW_SEARCH:
default:
break; break;
} }