Commit 4436c462 authored by Michael Catanzaro's avatar Michael Catanzaro

Purge g_return from src/

parent 489df78b
......@@ -6,13 +6,10 @@ Some TODO items, in no particular order:
- Use G_SOURCE_CONTINUE/G_SOURCE_REMOVE.
- Name all timeout and idle sources
- Replace constructor functions with constructed functions
- Use g_clear_object in dispose/finalize
- Get rid of object references in dispose, not finalize
- embed/ does not make much sense anymore as a name. Rename to
something else, perhaps core/? webview/?
- Use g_clear_object/g_clear_pointer in dispose/finalize
- Replace dispose with finalize wherever possible
- Use GtkBuilder instead of declaring the UIs with C
- We practically don't test any part of Epiphany, change that (how do
you test UI code? There's like 3 or 4 frameworks for this, pick one?
What does Chrome do?)
- g_str_equal -> g_strcmp0 or strcmp except in hash maps
- g_return -> g_assert more or less everywhere
......@@ -140,7 +140,7 @@ ephy_add_bookmark_popover_init (EphyAddBookmarkPopover *self)
GtkWidget *
ephy_add_bookmark_popover_new (EphyHeaderBar *header_bar)
{
g_return_val_if_fail (EPHY_IS_HEADER_BAR (header_bar), NULL);
g_assert (EPHY_IS_HEADER_BAR (header_bar));
return g_object_new (EPHY_TYPE_ADD_BOOKMARK_POPOVER,
"header-bar", header_bar,
......
......@@ -537,8 +537,8 @@ ephy_bookmark_properties_grid_new (EphyBookmark *bookmark,
EphyBookmarkPropertiesGridType type,
GtkWidget *parent)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (bookmark), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
g_assert (EPHY_IS_BOOKMARK (bookmark));
g_assert (GTK_IS_WIDGET (parent));
return g_object_new (EPHY_TYPE_BOOKMARK_PROPERTIES_GRID,
"bookmark", bookmark,
......@@ -550,7 +550,7 @@ ephy_bookmark_properties_grid_new (EphyBookmark *bookmark,
GtkWidget *
ephy_bookmark_properties_grid_get_add_tag_button (EphyBookmarkPropertiesGrid *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self), NULL);
g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
return self->add_tag_button;
}
......@@ -234,7 +234,7 @@ ephy_bookmark_row_new (EphyBookmark *bookmark)
EphyBookmark *
ephy_bookmark_row_get_bookmark (EphyBookmarkRow *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK_ROW (self), NULL);
g_assert (EPHY_IS_BOOKMARK_ROW (self));
return self->bookmark;
}
......@@ -242,7 +242,7 @@ ephy_bookmark_row_get_bookmark (EphyBookmarkRow *self)
const char *
ephy_bookmark_row_get_bookmark_url (EphyBookmarkRow *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK_ROW (self), NULL);
g_assert (EPHY_IS_BOOKMARK_ROW (self));
return ephy_bookmark_get_url (self->bookmark);
}
......@@ -305,7 +305,7 @@ void
ephy_bookmark_set_time_added (EphyBookmark *self,
gint64 time_added)
{
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_assert (EPHY_IS_BOOKMARK (self));
g_assert (time_added >= 0);
self->time_added = time_added;
......@@ -314,7 +314,7 @@ ephy_bookmark_set_time_added (EphyBookmark *self,
gint64
ephy_bookmark_get_time_added (EphyBookmark *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), 0);
g_assert (EPHY_IS_BOOKMARK (self));
return self->time_added;
}
......@@ -323,7 +323,7 @@ ephy_bookmark_get_time_added (EphyBookmark *self)
void
ephy_bookmark_set_url (EphyBookmark *self, const char *url)
{
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_assert (EPHY_IS_BOOKMARK (self));
g_free (self->url);
self->url = g_strdup (url);
......@@ -332,7 +332,7 @@ ephy_bookmark_set_url (EphyBookmark *self, const char *url)
const char *
ephy_bookmark_get_url (EphyBookmark *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), NULL);
g_assert (EPHY_IS_BOOKMARK (self));
return self->url;
}
......@@ -340,7 +340,7 @@ ephy_bookmark_get_url (EphyBookmark *self)
void
ephy_bookmark_set_title (EphyBookmark *self, const char *title)
{
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_assert (EPHY_IS_BOOKMARK (self));
g_free (self->title);
self->title = g_strdup (title);
......@@ -350,7 +350,7 @@ ephy_bookmark_set_title (EphyBookmark *self, const char *title)
const char *
ephy_bookmark_get_title (EphyBookmark *bookmark)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (bookmark), NULL);
g_assert (EPHY_IS_BOOKMARK (bookmark));
return bookmark->title;
}
......@@ -359,8 +359,8 @@ void
ephy_bookmark_set_id (EphyBookmark *self,
const char *id)
{
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_return_if_fail (id != NULL);
g_assert (EPHY_IS_BOOKMARK (self));
g_assert (id != NULL);
g_free (self->id);
self->id = g_strdup (id);
......@@ -369,7 +369,7 @@ ephy_bookmark_set_id (EphyBookmark *self,
const char *
ephy_bookmark_get_id (EphyBookmark *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), NULL);
g_assert (EPHY_IS_BOOKMARK (self));
return self->id;
}
......@@ -381,7 +381,7 @@ ephy_bookmark_set_is_uploaded (EphyBookmark *self,
/* FIXME: This is no longer used for Firefox Sync, but bookmarks import/export
* expects it. We need to delete it and write a migrator for bookmarks. */
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_assert (EPHY_IS_BOOKMARK (self));
}
gboolean
......@@ -389,7 +389,7 @@ ephy_bookmark_is_uploaded (EphyBookmark *self)
{
/* FIXME: This is no longer used for Firefox Sync, but bookmarks import/export
* expects it. We need to delete it and write a migrator for bookmarks. */
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), FALSE);
g_assert (EPHY_IS_BOOKMARK (self));
return FALSE;
}
......@@ -401,8 +401,8 @@ ephy_bookmark_add_tag (EphyBookmark *self,
GSequenceIter *tag_iter;
GSequenceIter *prev_tag_iter;
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_return_if_fail (tag != NULL);
g_assert (EPHY_IS_BOOKMARK (self));
g_assert (tag != NULL);
tag_iter = g_sequence_search (self->tags,
(gpointer)tag,
......@@ -423,8 +423,8 @@ ephy_bookmark_remove_tag (EphyBookmark *self,
{
GSequenceIter *tag_iter;
g_return_if_fail (EPHY_IS_BOOKMARK (self));
g_return_if_fail (tag != NULL);
g_assert (EPHY_IS_BOOKMARK (self));
g_assert (tag != NULL);
tag_iter = g_sequence_lookup (self->tags,
(gpointer)tag,
......@@ -442,8 +442,8 @@ ephy_bookmark_has_tag (EphyBookmark *self, const char *tag)
{
GSequenceIter *tag_iter;
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), FALSE);
g_return_val_if_fail (tag != NULL, FALSE);
g_assert (EPHY_IS_BOOKMARK (self));
g_assert (tag != NULL);
tag_iter = g_sequence_lookup (self->tags,
(gpointer)tag,
......@@ -456,7 +456,7 @@ ephy_bookmark_has_tag (EphyBookmark *self, const char *tag)
GSequence *
ephy_bookmark_get_tags (EphyBookmark *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARK (self), NULL);
g_assert (EPHY_IS_BOOKMARK (self));
return self->tags;
}
......
......@@ -338,8 +338,8 @@ void
ephy_bookmarks_manager_add_bookmark (EphyBookmarksManager *self,
EphyBookmark *bookmark)
{
g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
g_return_if_fail (EPHY_IS_BOOKMARK (bookmark));
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (EPHY_IS_BOOKMARK (bookmark));
ephy_bookmarks_manager_add_bookmark_internal (self, bookmark, TRUE);
g_signal_emit_by_name (self, "synchronizable-modified", bookmark, FALSE);
......@@ -351,8 +351,8 @@ ephy_bookmarks_manager_add_bookmarks (EphyBookmarksManager *self,
{
GSequenceIter *iter;
g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
g_return_if_fail (bookmarks != NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (bookmarks != NULL);
for (iter = g_sequence_get_begin_iter (bookmarks);
!g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter)) {
......@@ -407,8 +407,8 @@ ephy_bookmarks_manager_remove_bookmark_internal (EphyBookmarksManager *self,
void ephy_bookmarks_manager_remove_bookmark (EphyBookmarksManager *self,
EphyBookmark *bookmark)
{
g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
g_return_if_fail (EPHY_IS_BOOKMARK (bookmark));
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (EPHY_IS_BOOKMARK (bookmark));
g_signal_emit_by_name (self, "synchronizable-deleted", bookmark);
ephy_bookmarks_manager_remove_bookmark_internal (self, bookmark);
......@@ -420,8 +420,8 @@ ephy_bookmarks_manager_get_bookmark_by_url (EphyBookmarksManager *self,
{
GSequenceIter *iter;
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), FALSE);
g_return_val_if_fail (url != NULL, FALSE);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (url != NULL);
for (iter = g_sequence_get_begin_iter (self->bookmarks);
!g_sequence_iter_is_end (iter);
......@@ -441,8 +441,8 @@ ephy_bookmarks_manager_get_bookmark_by_id (EphyBookmarksManager *self,
{
GSequenceIter *iter;
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), FALSE);
g_return_val_if_fail (id != NULL, FALSE);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (id != NULL);
for (iter = g_sequence_get_begin_iter (self->bookmarks);
!g_sequence_iter_is_end (iter);
......@@ -462,8 +462,8 @@ ephy_bookmarks_manager_create_tag (EphyBookmarksManager *self, const char *tag)
GSequenceIter *tag_iter;
GSequenceIter *prev_tag_iter;
g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
g_return_if_fail (tag != NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (tag != NULL);
tag_iter = g_sequence_search (self->tags,
(gpointer)tag,
......@@ -484,8 +484,8 @@ ephy_bookmarks_manager_delete_tag (EphyBookmarksManager *self, const char *tag)
GSequenceIter *iter = NULL;
int position;
g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
g_return_if_fail (tag != NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (tag != NULL);
if (strcmp (tag, EPHY_BOOKMARKS_FAVORITES_TAG) == 0)
return;
......@@ -511,8 +511,8 @@ ephy_bookmarks_manager_tag_exists (EphyBookmarksManager *self, const char *tag)
{
GSequenceIter *iter;
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), FALSE);
g_return_val_if_fail (tag != NULL, FALSE);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
g_assert (tag != NULL);
iter = g_sequence_lookup (self->tags,
(gpointer)tag,
......@@ -525,7 +525,7 @@ ephy_bookmarks_manager_tag_exists (EphyBookmarksManager *self, const char *tag)
GSequence *
ephy_bookmarks_manager_get_bookmarks (EphyBookmarksManager *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
return self->bookmarks;
}
......@@ -537,7 +537,7 @@ ephy_bookmarks_manager_get_bookmarks_with_tag (EphyBookmarksManager *self,
GSequence *bookmarks;
GSequenceIter *iter;
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
bookmarks = g_sequence_new (g_object_unref);
......@@ -574,7 +574,7 @@ ephy_bookmarks_manager_get_bookmarks_with_tag (EphyBookmarksManager *self,
GSequence *
ephy_bookmarks_manager_get_tags (EphyBookmarksManager *self)
{
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self), NULL);
g_assert (EPHY_IS_BOOKMARKS_MANAGER (self));
return self->tags;
}
......@@ -599,7 +599,7 @@ ephy_bookmarks_manager_save_to_file_finish (EphyBookmarksManager *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_assert (g_task_is_valid (result, self));
return g_task_propagate_boolean (G_TASK (result), error);
}
......
......@@ -113,7 +113,7 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
dialog->update_embed_tag = TRUE;
g_return_if_fail (EPHY_IS_EMBED (dialog->embed));
g_assert (EPHY_IS_EMBED (dialog->embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (dialog->embed);
encoding = webkit_web_view_get_custom_charset (view);
......@@ -170,7 +170,7 @@ ephy_encoding_dialog_attach_embed (EphyEncodingDialog *dialog)
EphyEmbed **embedptr;
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (dialog->window));
g_return_if_fail (EPHY_IS_EMBED (embed));
g_assert (EPHY_IS_EMBED (embed));
g_signal_connect (G_OBJECT (ephy_embed_get_web_view (embed)), "load-changed",
G_CALLBACK (embed_net_stop_cb), dialog);
......@@ -195,7 +195,7 @@ activate_choice (EphyEncodingDialog *dialog)
{
WebKitWebView *view;
g_return_if_fail (EPHY_IS_EMBED (dialog->embed));
g_assert (EPHY_IS_EMBED (dialog->embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (dialog->embed);
if (gtk_switch_get_active (dialog->default_switch)) {
......@@ -381,7 +381,7 @@ ephy_encoding_dialog_constructed (GObject *object)
/* selected encoding */
dialog = EPHY_ENCODING_DIALOG (object);
g_return_if_fail (EPHY_IS_EMBED (dialog->embed));
g_assert (EPHY_IS_EMBED (dialog->embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (dialog->embed);
dialog->selected_encoding = webkit_web_view_get_custom_charset (view);
......@@ -434,7 +434,7 @@ static void
ephy_encoding_dialog_set_parent_window (EphyEncodingDialog *dialog,
EphyWindow *window)
{
g_return_if_fail (EPHY_IS_WINDOW (window));
g_assert (EPHY_IS_WINDOW (window));
g_signal_connect (G_OBJECT (window), "notify::active-child",
G_CALLBACK (ephy_encoding_dialog_sync_embed), dialog);
......
......@@ -50,7 +50,7 @@ void
ephy_encoding_row_set_selected (EphyEncodingRow *row,
gboolean selected)
{
g_return_if_fail (EPHY_IS_ENCODING_ROW (row));
g_assert (EPHY_IS_ENCODING_ROW (row));
if (selected)
gtk_widget_show (GTK_WIDGET (row->selected_image));
......@@ -68,7 +68,7 @@ static void
ephy_encoding_row_set_encoding (EphyEncodingRow *self,
EphyEncoding *encoding)
{
g_return_if_fail (EPHY_IS_ENCODING (encoding));
g_assert (EPHY_IS_ENCODING (encoding));
self->encoding = encoding;
gtk_label_set_text (self->encoding_label,
......
......@@ -283,7 +283,7 @@ new_history_menu_item (EphyWebView *view,
WebKitFaviconDatabase *database;
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
g_return_val_if_fail (address != NULL && origtext != NULL, NULL);
g_assert (address != NULL && origtext != NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
......@@ -328,7 +328,7 @@ middle_click_handle_on_history_menu_item (EphyEmbed *embed,
EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
embed,
0);
g_return_if_fail (new_embed != NULL);
g_assert (new_embed != NULL);
/* Load the new URL */
url = webkit_back_forward_list_item_get_original_uri (item);
......@@ -383,7 +383,7 @@ build_dropdown_menu (EphyWindow *window,
WebKitWebView *web_view;
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_val_if_fail (embed != NULL, NULL);
g_assert (embed != NULL);
menu = GTK_MENU_SHELL (gtk_menu_new ());
......@@ -877,7 +877,7 @@ ephy_header_bar_class_init (EphyHeaderBarClass *klass)
GtkWidget *
ephy_header_bar_new (EphyWindow *window)
{
g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
g_assert (EPHY_IS_WINDOW (window));
return GTK_WIDGET (g_object_new (EPHY_TYPE_HEADER_BAR,
"show-close-button", TRUE,
......
......@@ -475,7 +475,7 @@ on_treeview_row_activated (GtkTreeView *view,
window = EPHY_WINDOW (get_target_window (self));
url = get_url_from_path (gtk_tree_view_get_model (view),
path);
g_return_if_fail (url != NULL);
g_assert (url != NULL);
embed = ephy_shell_new_tab (ephy_shell_get_default (),
window, NULL, EPHY_NEW_TAB_JUMP);
......@@ -741,7 +741,7 @@ ephy_history_dialog_new (EphyHistoryService *history_service)
{
EphyHistoryDialog *self;
g_return_val_if_fail (history_service != NULL, NULL);
g_assert (history_service != NULL);
self = g_object_new (EPHY_TYPE_HISTORY_DIALOG,
"use-header-bar", TRUE,
......
......@@ -489,7 +489,7 @@ ephy_location_controller_finalize (GObject *object)
const char *
ephy_location_controller_get_address (EphyLocationController *controller)
{
g_return_val_if_fail (EPHY_IS_LOCATION_CONTROLLER (controller), "");
g_assert (EPHY_IS_LOCATION_CONTROLLER (controller));
return controller->address;
}
......@@ -505,7 +505,7 @@ void
ephy_location_controller_set_address (EphyLocationController *controller,
const char *address)
{
g_return_if_fail (EPHY_IS_LOCATION_CONTROLLER (controller));
g_assert (EPHY_IS_LOCATION_CONTROLLER (controller));
LOG ("set_address %s", address);
......
......@@ -187,7 +187,7 @@ find_tab_num_at_pos (EphyNotebook *notebook, gint abs_x, gint abs_y)
gint x_root, y_root;
tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, -1);
g_assert (tab != NULL);
if (!gtk_widget_get_mapped (GTK_WIDGET (tab))) {
page_num++;
......@@ -604,7 +604,7 @@ sync_load_status (EphyWebView *view, GParamSpec *pspec, GtkWidget *proxy)
spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "spinner"));
icon = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "icon"));
g_return_if_fail (spinner != NULL && icon != NULL);
g_assert (spinner != NULL && icon != NULL);
embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view);
if (ephy_web_view_is_loading (view) && !ephy_embed_has_load_pending (embed)) {
......@@ -852,7 +852,7 @@ ephy_notebook_add_tab (EphyNotebook *notebook,
{
GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);
g_return_val_if_fail (EPHY_IS_NOTEBOOK (notebook), -1);
g_assert (EPHY_IS_NOTEBOOK (notebook));
position = gtk_notebook_insert_page (GTK_NOTEBOOK (notebook),
GTK_WIDGET (embed),
......@@ -992,7 +992,7 @@ ephy_notebook_next_page (EphyNotebook *notebook)
{
gint current_page, n_pages;
g_return_if_fail (EPHY_IS_NOTEBOOK (notebook));
g_assert (EPHY_IS_NOTEBOOK (notebook));
current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
......@@ -1024,7 +1024,7 @@ ephy_notebook_prev_page (EphyNotebook *notebook)
{
gint current_page;
g_return_if_fail (EPHY_IS_NOTEBOOK (notebook));
g_assert (EPHY_IS_NOTEBOOK (notebook));
current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
......
......@@ -230,7 +230,7 @@ ephy_session_undo_close_tab (EphySession *session)
EphyNotebook *notebook;
EphyNewTabFlags flags = EPHY_NEW_TAB_JUMP;
g_return_if_fail (EPHY_IS_SESSION (session));
g_assert (EPHY_IS_SESSION (session));
tab = g_queue_pop_head (session->closed_tabs);
if (tab == NULL)
......@@ -317,7 +317,7 @@ ephy_session_tab_closed (EphySession *session,
gboolean
ephy_session_get_can_undo_tab_closed (EphySession *session)
{
g_return_val_if_fail (EPHY_IS_SESSION (session), FALSE);
g_assert (EPHY_IS_SESSION (session));
return g_queue_is_empty (session->closed_tabs) == FALSE;
}
......@@ -505,7 +505,7 @@ ephy_session_close (EphySession *session)
{
EphyPrefsRestoreSessionPolicy policy;
g_return_if_fail (EPHY_IS_SESSION (session));
g_assert (EPHY_IS_SESSION (session));
LOG ("ephy_session_close");
......@@ -985,7 +985,7 @@ ephy_session_save (EphySession *session)
{
EphyPrefsRestoreSessionPolicy policy;
g_return_if_fail (EPHY_IS_SESSION (session));
g_assert (EPHY_IS_SESSION (session));
if (session->save_source_id) {
return;
......@@ -1399,8 +1399,8 @@ ephy_session_load_from_stream (EphySession *session,
GMarkupParseContext *parser;
LoadFromStreamAsyncData *data;
g_return_if_fail (EPHY_IS_SESSION (session));
g_return_if_fail (G_IS_INPUT_STREAM (stream));
g_assert (EPHY_IS_SESSION (session));
g_assert (G_IS_INPUT_STREAM (stream));
g_application_hold (G_APPLICATION (ephy_shell_get_default ()));
......@@ -1438,7 +1438,7 @@ ephy_session_load_from_stream_finish (EphySession *session,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, session), FALSE);
g_assert (g_task_is_valid (result, session));
return g_task_propagate_boolean (G_TASK (result), error);
}
......@@ -1538,8 +1538,8 @@ ephy_session_load (EphySession *session,
GTask *task;
LoadAsyncData *data;
g_return_if_fail (EPHY_IS_SESSION (session));
g_return_if_fail (filename);
g_assert (EPHY_IS_SESSION (session));
g_assert (filename);
LOG ("ephy_sesion_load %s", filename);
......@@ -1574,7 +1574,7 @@ ephy_session_load_finish (EphySession *session,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, session), FALSE);
g_assert (g_task_is_valid (result, session));
return g_task_propagate_boolean (G_TASK (result), error);
}
......@@ -1660,7 +1660,7 @@ ephy_session_resume_finish (EphySession *session,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, session), FALSE);
g_assert (g_task_is_valid (result, session));
return g_task_propagate_boolean (G_TASK (result), error);
}
......@@ -1672,7 +1672,7 @@ ephy_session_clear (EphySession *session)
EphyShell *shell;
GList *windows, *p;
g_return_if_fail (EPHY_IS_SESSION (session));
g_assert (EPHY_IS_SESSION (session));
shell = ephy_shell_get_default ();
windows = g_list_copy (gtk_application_get_windows (GTK_APPLICATION (shell)));
......
......@@ -615,7 +615,7 @@ ephy_shell_before_emit (GApplication *application,
static GObject *
ephy_shell_get_lockdown (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->lockdown == NULL)
shell->lockdown = g_object_new (EPHY_TYPE_LOCKDOWN, NULL);
......@@ -752,9 +752,9 @@ ephy_shell_new_tab_full (EphyShell *shell,
gboolean jump_to = FALSE;
int position = -1;
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
g_return_val_if_fail (EPHY_IS_EMBED (previous_embed) || !previous_embed, NULL);
g_assert (EPHY_IS_SHELL (shell));
g_assert (EPHY_IS_WINDOW (window));
g_assert (EPHY_IS_EMBED (previous_embed) || !previous_embed);
embed_shell = EPHY_EMBED_SHELL (shell);
......@@ -831,7 +831,7 @@ ephy_shell_get_session (EphyShell *shell)
{
EphyEmbedShellMode mode;
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell));
if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION || mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
......@@ -854,7 +854,7 @@ ephy_shell_get_session (EphyShell *shell)
EphySyncService *
ephy_shell_get_sync_service (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->sync_service == NULL) {
shell->sync_service = ephy_sync_service_new (TRUE);
......@@ -883,7 +883,7 @@ ephy_shell_get_sync_service (EphyShell *shell)
EphyBookmarksManager *
ephy_shell_get_bookmarks_manager (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->bookmarks_manager == NULL)
shell->bookmarks_manager = ephy_bookmarks_manager_new ();
......@@ -902,7 +902,7 @@ ephy_shell_get_bookmarks_manager (EphyShell *shell)
EphyPasswordManager *
ephy_shell_get_password_manager (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->password_manager == NULL)
shell->password_manager = ephy_password_manager_new ();
......@@ -924,7 +924,7 @@ ephy_shell_get_history_manager (EphyShell *shell)
EphyEmbedShell *embed_shell;
EphyHistoryService *service;
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->history_manager == NULL) {
embed_shell = ephy_embed_shell_get_default ();
......@@ -938,7 +938,7 @@ ephy_shell_get_history_manager (EphyShell *shell)
EphyOpenTabsManager *
ephy_shell_get_open_tabs_manager (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_assert (EPHY_IS_SHELL (shell));
if (shell->open_tabs_manager == NULL)
shell->open_tabs_manager = ephy_open_tabs_manager_new (EPHY_TABS_CATALOG (shell));
......@@ -1036,7 +1036,7 @@ void
ephy_shell_set_startup_context (EphyShell *shell,
EphyShellStartupContext *ctx)
{
g_return_if_fail (EPHY_IS_SHELL (shell));
g_assert (EPHY_IS_SHELL (shell));
g_assert (shell->local_startup_context == NULL);
......@@ -1048,7 +1048,7 @@ ephy_shell_get_n_windows (EphyShell *shell)
{
GList *list;
g_return_val_if_fail (EPHY_IS_SHELL (shell), 0);
g_assert (EPHY_IS_SHELL (shell));
list = gtk_application_get_windows (GTK_APPLICATION (shell));
return g_list_length (list);
......@@ -1061,7 +1061,7 @@ ephy_shell_close_all_windows (EphyShell *shell)
gboolean retval = TRUE;
EphySession *session = ephy_shell_get_session (shell);
g_return_val_if_fail (EPHY_IS_SHELL (shell), FALSE);
g_assert (EPHY_IS_SHELL (shell));
if (session)
ephy_session_close (session);
......@@ -1228,7 +1228,7 @@ ephy_shell_open_uris (EphyShell *shell,
OpenURIsData *data;
guint id;
g_return_if_fail (EPHY_IS_SHELL (shell));
g_assert (EPHY_IS_SHELL (shell));
data = open_uris_data_new (shell, uris, startup_flags, user_time);
id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
......
......@@ -174,8 +174,8 @@ EphySuggestionModel *
ephy_suggestion_model_new (EphyHistoryService *history_service,
EphyBookmarksManager *bookmarks_manager)
{
g_return_val_if_fail (EPHY_IS_HISTORY_SERVICE (history_service), NULL);
g_return_val_if_fail (EPHY_IS_BOOKMARKS_MANAGER (bookmarks_manager), NULL);
g_assert (EPHY_IS_HISTORY_SERVICE (history_service));
g_assert (EPHY_IS_BOOKMARKS_MANAGER (bookmarks_manager));
return g_object_new (EPHY_TYPE_SUGGESTION_MODEL,
"history-service", history_service,
......@@ -363,9 +363,9 @@ ephy_suggestion_model_query_async (EphySuggestionModel *self,
char **strings;
GList *qlist = NULL;
g_return_if_fail (EPHY_IS_SUGGESTION_MODEL (self));
g_return_if_fail (query != NULL);
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
g_assert (EPHY_IS_SUGGESTION_MODEL (self));
g_assert (query != NULL);
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, ephy_suggestion_model_query_async);
......@@ -395,8 +395,8 @@ ephy_suggestion_model_query_finish (EphySuggestionModel *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (EPHY_IS_SUGGESTION_MODEL (self), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE);
g_assert (EPHY_IS_SUGGESTION_MODEL (self));
g_assert (G_IS_TASK (result));
return g_task_propagate_boolean (G_TASK (result), error);
}
......@@ -407,8 +407,8 @@ ephy_suggestion_model_get_suggestion_with_uri (EphySuggestionModel *self,
{
GSequenceIter *iter;
g_return_val_if_fail (EPHY_IS_SUGGESTION_MODEL (self), NULL);
g_return_val_if_fail (uri != NULL && *uri !=