[Xfce4-commits] [apps/mousepad] 02/05: Use G_DISABLE_CHECKS and G_DISABLE_ASSERT
noreply at xfce.org
noreply at xfce.org
Tue Jul 15 02:23:13 CEST 2014
This is an automated email from the git hooks/post-receive script.
mbrush pushed a commit to branch master
in repository apps/mousepad.
commit da54cc95d5ae6a8a744dc202cf9d30d20b987b97
Author: Matthew Brush <mbrush at codebrainz.ca>
Date: Mon Jul 14 16:06:52 2014 -0700
Use G_DISABLE_CHECKS and G_DISABLE_ASSERT
Instead of using special macro functions everywhere, we can just use
the g_*() functions and make sure to #define G_DISABLE_CHECKS and
G_DISABLE_ASSERT and acheive the same effect (although maybe we don't
want to force these when NDEBUG is defined to let the user define
themselves for more customization).
Make sure mousepad-private.h is included before any G* files that
could include glib.h so it properly picks up the defines.
---
mousepad/mousepad-application.c | 25 ++-
mousepad/mousepad-dbus.c | 18 +-
mousepad/mousepad-dialogs.c | 6 +-
mousepad/mousepad-document.c | 38 ++--
mousepad/mousepad-encoding-dialog.c | 14 +-
mousepad/mousepad-encoding.c | 4 +-
mousepad/mousepad-file.c | 76 +++----
mousepad/mousepad-prefs-dialog.c | 2 +-
mousepad/mousepad-print.c | 22 +-
mousepad/mousepad-private.h | 18 +-
mousepad/mousepad-replace-dialog.c | 6 +-
mousepad/mousepad-search-bar.c | 22 +-
mousepad/mousepad-statusbar.c | 10 +-
mousepad/mousepad-util.c | 40 ++--
mousepad/mousepad-view.c | 78 +++----
mousepad/mousepad-window.c | 400 +++++++++++++++++------------------
16 files changed, 385 insertions(+), 394 deletions(-)
diff --git a/mousepad/mousepad-application.c b/mousepad/mousepad-application.c
index ac3bc99..f0f389c 100644
--- a/mousepad/mousepad-application.c
+++ b/mousepad/mousepad-application.c
@@ -25,7 +25,6 @@
#include <mousepad/mousepad-prefs-dialog.h>
#include <mousepad/mousepad-replace-dialog.h>
#include <mousepad/mousepad-window.h>
-#include <mousepad/mousepad-private.h>
@@ -164,7 +163,7 @@ mousepad_application_get (void)
gboolean
mousepad_application_has_windows (MousepadApplication *application)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_APPLICATION (application), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_APPLICATION (application), FALSE);
return (application->windows != NULL);
}
@@ -175,9 +174,9 @@ static void
mousepad_application_window_destroyed (GtkWidget *window,
MousepadApplication *application)
{
- mousepad_return_if_fail (GTK_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
- mousepad_return_if_fail (g_slist_find (application->windows, window) != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
+ g_return_if_fail (g_slist_find (application->windows, window) != NULL);
/* remove the window from the list */
application->windows = g_slist_remove (application->windows, window);
@@ -193,9 +192,9 @@ void
mousepad_application_take_window (MousepadApplication *application,
GtkWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
- mousepad_return_if_fail (g_slist_find (application->windows, window) == NULL);
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
+ g_return_if_fail (g_slist_find (application->windows, window) == NULL);
/* connect to the "destroy" signal */
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (mousepad_application_window_destroyed), application);
@@ -236,9 +235,9 @@ mousepad_application_new_window_with_document (MousepadWindow *existing,
GtkWidget *window;
GdkScreen *screen;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (existing));
- mousepad_return_if_fail (document == NULL || MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (existing));
+ g_return_if_fail (document == NULL || MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
/* create a new window (signals added and already hooked up) */
window = mousepad_application_create_window (application);
@@ -285,8 +284,8 @@ mousepad_application_new_window_with_files (MousepadApplication *application,
gboolean succeed = FALSE;
MousepadDocument *document;
- mousepad_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
- mousepad_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
+ g_return_if_fail (MOUSEPAD_IS_APPLICATION (application));
+ g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
/* create a new window (signals added and already hooked up) */
window = mousepad_application_create_window (application);
diff --git a/mousepad/mousepad-dbus.c b/mousepad/mousepad-dbus.c
index ad45fca..d1ab443 100644
--- a/mousepad/mousepad-dbus.c
+++ b/mousepad/mousepad-dbus.c
@@ -25,14 +25,14 @@
#include <unistd.h>
#endif
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-dbus.h>
#include <mousepad/mousepad-application.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus.h>
+
#define MOUSEPAD_DBUS_PATH "/org/xfce/Mousepad"
@@ -157,8 +157,8 @@ mousepad_dbus_service_launch_files (MousepadDBusService *dbus_service,
{
MousepadApplication *application;
- mousepad_return_val_if_fail (g_path_is_absolute (working_directory), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (working_directory), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* open a mousepad window */
application = mousepad_application_get ();
@@ -268,7 +268,7 @@ mousepad_dbus_client_terminate (GError **error)
{
DBusMessage *message;
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* generate the message */
message = dbus_message_new_method_call (MOUSEPAD_DBUS_INTERFACE, MOUSEPAD_DBUS_PATH,
@@ -311,8 +311,8 @@ mousepad_dbus_client_launch_files (gchar **filenames,
guint length = 0;
gboolean succeed;
- mousepad_return_val_if_fail (g_path_is_absolute (working_directory), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (working_directory), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* get the length of the filesname string */
if (filenames)
diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index 115218f..5ca8f3f 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -149,14 +149,14 @@ mousepad_dialogs_go_to_line_changed (GtkSpinButton *line_spin,
GtkTextBuffer *buffer;
GtkTextIter iter;
- mousepad_return_if_fail (GTK_IS_SPIN_BUTTON (line_spin));
- mousepad_return_if_fail (GTK_IS_SPIN_BUTTON (col_spin));
+ g_return_if_fail (GTK_IS_SPIN_BUTTON (line_spin));
+ g_return_if_fail (GTK_IS_SPIN_BUTTON (col_spin));
/* get the text buffer */
buffer = mousepad_object_get_data (G_OBJECT (col_spin), "buffer");
/* debug check */
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
/* get iter at line */
gtk_text_buffer_get_iter_at_line (buffer, &iter, gtk_spin_button_get_value_as_int (line_spin) - 1);
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index b8abac4..1eb87cf 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -250,8 +250,8 @@ mousepad_document_notify_cursor_position (GtkTextBuffer *buffer,
gint line, column, selection;
gint tab_size;
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* get the current iter position */
gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
@@ -282,8 +282,8 @@ mousepad_document_notify_has_selection (GtkTextBuffer *buffer,
gint selection;
gboolean is_column_selection;
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* get length of the selection */
selection = mousepad_view_get_selection_length (document->textview, &is_column_selection);
@@ -309,8 +309,8 @@ mousepad_document_notify_overwrite (GtkTextView *textview,
{
gboolean overwrite;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_TEXT_VIEW (textview));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_TEXT_VIEW (textview));
/* whether overwrite is enabled */
overwrite = gtk_text_view_get_overwrite (textview);
@@ -328,8 +328,8 @@ mousepad_document_notify_language (GtkSourceBuffer *buffer,
{
GtkSourceLanguage *language;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
/* the new language */
language = gtk_source_buffer_get_language (buffer);
@@ -350,7 +350,7 @@ mousepad_document_drag_data_received (GtkWidget *widget,
guint drag_time,
MousepadDocument *document)
{
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* emit the drag-data-received signal from the document when a tab or uri has been dropped */
if (info == TARGET_TEXT_URI_LIST || info == TARGET_GTK_NOTEBOOK_TAB)
@@ -365,8 +365,8 @@ mousepad_document_filename_changed (MousepadDocument *document,
{
gchar *utf8_filename, *utf8_basename;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (filename != NULL);
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (filename != NULL);
/* convert the title into a utf-8 valid version for display */
utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
@@ -408,9 +408,9 @@ mousepad_document_label_color (MousepadDocument *document)
GdkColor red = {0, 0xffff, 0x0000, 0x0000};
GdkColor *color;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (document->file));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
+ g_return_if_fail (MOUSEPAD_IS_FILE (document->file));
if (document->priv->label)
{
@@ -434,7 +434,7 @@ void
mousepad_document_set_overwrite (MousepadDocument *document,
gboolean overwrite)
{
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
gtk_text_view_set_overwrite (GTK_TEXT_VIEW (document->textview), overwrite);
}
@@ -444,7 +444,7 @@ mousepad_document_set_overwrite (MousepadDocument *document,
void
mousepad_document_focus_textview (MousepadDocument *document)
{
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* focus the textview */
gtk_widget_grab_focus (GTK_WIDGET (document->textview));
@@ -455,7 +455,7 @@ mousepad_document_focus_textview (MousepadDocument *document)
void
mousepad_document_send_signals (MousepadDocument *document)
{
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* re-send the cursor changed signal */
mousepad_document_notify_cursor_position (document->buffer, NULL, document);
@@ -540,7 +540,7 @@ mousepad_document_get_basename (MousepadDocument *document)
{
static gint untitled_counter = 0;
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), NULL);
/* check if there is a filename set */
if (document->priv->utf8_basename == NULL)
@@ -557,7 +557,7 @@ mousepad_document_get_basename (MousepadDocument *document)
const gchar *
mousepad_document_get_filename (MousepadDocument *document)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), NULL);
return document->priv->utf8_filename;
}
diff --git a/mousepad/mousepad-encoding-dialog.c b/mousepad/mousepad-encoding-dialog.c
index f91500a..d2d331a 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -22,15 +22,15 @@
#include <string.h>
#endif
-#include <glib.h>
-#include <glib/gstdio.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-document.h>
#include <mousepad/mousepad-encoding.h>
#include <mousepad/mousepad-encoding-dialog.h>
#include <mousepad/mousepad-util.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
static void mousepad_encoding_dialog_finalize (GObject *object);
@@ -474,8 +474,8 @@ mousepad_encoding_dialog_new (GtkWindow *parent,
{
MousepadEncodingDialog *dialog;
- mousepad_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
/* create the dialog */
dialog = g_object_new (MOUSEPAD_TYPE_ENCODING_DIALOG, NULL);
@@ -500,7 +500,7 @@ mousepad_encoding_dialog_new (GtkWindow *parent,
MousepadEncoding
mousepad_encoding_dialog_get_encoding (MousepadEncodingDialog *dialog)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_ENCODING_DIALOG (dialog), MOUSEPAD_ENCODING_NONE);
+ g_return_val_if_fail (MOUSEPAD_IS_ENCODING_DIALOG (dialog), MOUSEPAD_ENCODING_NONE);
return mousepad_file_get_encoding (dialog->document->file);
}
@@ -510,7 +510,7 @@ mousepad_encoding_dialog_get_encoding (MousepadEncodingDialog *dialog)
const gchar *
mousepad_encoding_dialog_get_encoding_custom (MousepadEncodingDialog *dialog)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_ENCODING_DIALOG (dialog), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_ENCODING_DIALOG (dialog), NULL);
return NULL;
}
diff --git a/mousepad/mousepad-encoding.c b/mousepad/mousepad-encoding.c
index ac2f19a..1968769 100644
--- a/mousepad/mousepad-encoding.c
+++ b/mousepad/mousepad-encoding.c
@@ -22,11 +22,11 @@
#include <string.h>
#endif
-#include <glib.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-encoding.h>
+#include <glib.h>
+
const MousepadEncodingInfo encoding_infos[] =
diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index b2b2904..2341c65 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -37,12 +37,12 @@
#include <errno.h>
#endif
-#include <glib.h>
-#include <glib/gstdio.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-file.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
enum
@@ -180,7 +180,7 @@ static void
mousepad_file_set_readonly (MousepadFile *file,
gboolean readonly)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
if (G_LIKELY (file->readonly != readonly))
{
@@ -203,8 +203,8 @@ mousepad_file_encoding_read_bom (const gchar *contents,
MousepadEncoding encoding = MOUSEPAD_ENCODING_NONE;
gsize bytes = 0;
- mousepad_return_val_if_fail (contents != NULL && length > 0, MOUSEPAD_ENCODING_NONE);
- mousepad_return_val_if_fail (contents != NULL && length > 0, MOUSEPAD_ENCODING_NONE);
+ g_return_val_if_fail (contents != NULL && length > 0, MOUSEPAD_ENCODING_NONE);
+ g_return_val_if_fail (contents != NULL && length > 0, MOUSEPAD_ENCODING_NONE);
switch (bom[0])
{
@@ -268,7 +268,7 @@ mousepad_file_new (GtkTextBuffer *buffer)
{
MousepadFile *file;
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
file = g_object_new (MOUSEPAD_TYPE_FILE, NULL);
@@ -284,7 +284,7 @@ void
mousepad_file_set_filename (MousepadFile *file,
const gchar *filename)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
/* free the old filename */
g_free (file->filename);
@@ -301,7 +301,7 @@ mousepad_file_set_filename (MousepadFile *file,
const gchar *
mousepad_file_get_filename (MousepadFile *file)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
return file->filename;
}
@@ -311,7 +311,7 @@ mousepad_file_get_filename (MousepadFile *file)
gchar *
mousepad_file_get_uri (MousepadFile *file)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
return g_filename_to_uri (file->filename, NULL, NULL);
}
@@ -322,7 +322,7 @@ void
mousepad_file_set_encoding (MousepadFile *file,
MousepadEncoding encoding)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
/* set new encoding */
file->encoding = encoding;
@@ -333,7 +333,7 @@ mousepad_file_set_encoding (MousepadFile *file,
MousepadEncoding
mousepad_file_get_encoding (MousepadFile *file)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), MOUSEPAD_ENCODING_NONE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), MOUSEPAD_ENCODING_NONE);
return file->encoding;
}
@@ -343,7 +343,7 @@ mousepad_file_get_encoding (MousepadFile *file)
gboolean
mousepad_file_get_read_only (MousepadFile *file)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
return file->filename ? file->readonly : FALSE;
}
@@ -354,8 +354,8 @@ void
mousepad_file_set_write_bom (MousepadFile *file,
gboolean write_bom)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
- mousepad_return_if_fail (mousepad_encoding_is_unicode (file->encoding));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (mousepad_encoding_is_unicode (file->encoding));
/* set new value */
file->write_bom = write_bom;
@@ -367,7 +367,7 @@ gboolean
mousepad_file_get_write_bom (MousepadFile *file,
gboolean *sensitive)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
/* return if we can write a bom */
if (G_LIKELY (sensitive))
@@ -382,7 +382,7 @@ void
mousepad_file_set_line_ending (MousepadFile *file,
MousepadLineEnding line_ending)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
file->line_ending = line_ending;
}
@@ -401,8 +401,8 @@ void
mousepad_file_set_language (MousepadFile *file,
GtkSourceLanguage *language)
{
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
- mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), language);
}
@@ -412,8 +412,8 @@ mousepad_file_set_language (MousepadFile *file,
GtkSourceLanguage *
mousepad_file_get_language (MousepadFile *file)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
- mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+ g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (file->buffer));
}
@@ -426,8 +426,8 @@ mousepad_file_set_language_id (MousepadFile *file,
{
GtkSourceLanguage *lang;
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
- mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
if (G_UNLIKELY (language_id == NULL))
{
@@ -498,10 +498,10 @@ mousepad_file_open (MousepadFile *file,
const gchar *end, *n, *m;
MousepadEncoding bom_encoding;
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- mousepad_return_val_if_fail (file->filename != NULL || template_filename != NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (file->filename != NULL || template_filename != NULL, FALSE);
/* get the filename */
if (G_UNLIKELY (template_filename != NULL))
@@ -718,10 +718,10 @@ mousepad_file_save (MousepadFile *file,
struct stat statb;
gchar **chunks;
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- mousepad_return_val_if_fail (file->filename != NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (file->filename != NULL, FALSE);
/* open the file */
fd = g_open (file->filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
@@ -875,10 +875,10 @@ mousepad_file_reload (MousepadFile *file,
GtkTextIter start, end;
gboolean succeed = FALSE;
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- mousepad_return_val_if_fail (file->filename != NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), FALSE);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (file->buffer), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (file->filename != NULL, FALSE);
/* simple test if the file has not been removed */
if (G_UNLIKELY (g_file_test (file->filename, G_FILE_TEST_EXISTS) == FALSE))
@@ -909,9 +909,9 @@ mousepad_file_get_externally_modified (MousepadFile *file,
struct stat statb;
GFileError error_code;
- mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), TRUE);
- mousepad_return_val_if_fail (file->filename != NULL, TRUE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_FILE (file), TRUE);
+ g_return_val_if_fail (file->filename != NULL, TRUE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* check if our modification time differs from the current one */
if (G_LIKELY (g_stat (file->filename, &statb) == 0))
diff --git a/mousepad/mousepad-prefs-dialog.c b/mousepad/mousepad-prefs-dialog.c
index a011afb..bdcbc45 100644
--- a/mousepad/mousepad-prefs-dialog.c
+++ b/mousepad/mousepad-prefs-dialog.c
@@ -18,10 +18,10 @@
#include "config.h"
#endif
+#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-prefs-dialog.h>
#include <mousepad/mousepad-prefs-dialog-ui.h>
#include <mousepad/mousepad-settings.h>
-#include <mousepad/mousepad-private.h>
diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index 13c478f..e298b4f 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -18,14 +18,14 @@
#include <config.h>
#endif
-#include <pango/pango.h>
-#include <cairo.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-document.h>
#include <mousepad/mousepad-util.h>
#include <mousepad/mousepad-print.h>
+#include <pango/pango.h>
+#include <cairo.h>
+
#define DOCUMENT_SPACING (10)
@@ -158,8 +158,8 @@ mousepad_print_settings_load (GtkPrintOperation *operation)
PangoContext *context;
PangoFontDescription *font_desc;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (print->document));
- mousepad_return_if_fail (GTK_IS_WIDGET (print->document->textview));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (print->document));
+ g_return_if_fail (GTK_IS_WIDGET (print->document->textview));
/* get the config file filename */
filename = mousepad_util_get_save_location (MOUSEPAD_RC_RELPATH, FALSE);
@@ -782,12 +782,12 @@ mousepad_print_document_interactive (MousepadPrint *print,
{
GtkPrintOperationResult result;
- mousepad_return_val_if_fail (MOUSEPAD_IS_PRINT (print), FALSE);
- mousepad_return_val_if_fail (GTK_IS_PRINT_OPERATION (print), FALSE);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
- mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (document->buffer), FALSE);
- mousepad_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
- mousepad_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_PRINT (print), FALSE);
+ g_return_val_if_fail (GTK_IS_PRINT_OPERATION (print), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
+ g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (document->buffer), FALSE);
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* set the document */
print->document = document;
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index a3e9b7a..e9f41c2 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -17,6 +17,11 @@
#ifndef __MOUSEPAD_PRIVATE_H__
#define __MOUSEPAD_PRIVATE_H__
+#ifdef NDEBUG
+#define G_DISABLE_CHECKS
+#define G_DISABLE_ASSERT
+#endif
+
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -68,19 +73,6 @@ enum
g_quark_from_static_string (key), (data), (GDestroyNotify) (destroy)))
#define mousepad_object_get_data(object,key) (g_object_get_qdata ((object), g_quark_try_string (key)))
-/* support macros for debugging */
-#ifndef NDEBUG
-#define mousepad_assert(expr) g_assert (expr)
-#define mousepad_assert_not_reached() g_assert_not_reached ()
-#define mousepad_return_if_fail(expr) g_return_if_fail (expr)
-#define mousepad_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
-#else
-#define mousepad_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
-#define mousepad_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
-#define mousepad_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
-#define mousepad_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
-#endif
-
/* avoid trivial g_value_get_*() function calls */
#ifdef NDEBUG
#define g_value_get_boolean(v) (((const GValue *) (v))->data[0].v_int)
diff --git a/mousepad/mousepad-replace-dialog.c b/mousepad/mousepad-replace-dialog.c
index bfec4c6..df4b655 100644
--- a/mousepad/mousepad-replace-dialog.c
+++ b/mousepad/mousepad-replace-dialog.c
@@ -277,8 +277,8 @@ mousepad_replace_dialog_unrealize (GtkWidget *widget)
MousepadReplaceDialog *dialog = MOUSEPAD_REPLACE_DIALOG (widget);
const gchar *text;
- mousepad_return_if_fail (GTK_IS_ENTRY (dialog->replace_entry));
- mousepad_return_if_fail (GTK_IS_ENTRY (dialog->search_entry));
+ g_return_if_fail (GTK_IS_ENTRY (dialog->replace_entry));
+ g_return_if_fail (GTK_IS_ENTRY (dialog->search_entry));
text = gtk_entry_get_text (GTK_ENTRY (dialog->search_entry));
mousepad_replace_dialog_history_insert_text (text);
@@ -500,7 +500,7 @@ mousepad_replace_dialog_history_combo_box (GtkComboBox *combo_box)
{
GSList *li;
- mousepad_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
+ g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
/* append the items from the history to the combobox */
for (li = history_list; li != NULL; li = li->next)
diff --git a/mousepad/mousepad-search-bar.c b/mousepad/mousepad-search-bar.c
index 26c2845..2f883b0 100644
--- a/mousepad/mousepad-search-bar.c
+++ b/mousepad/mousepad-search-bar.c
@@ -18,9 +18,6 @@
#include <config.h>
#endif
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-settings.h>
#include <mousepad/mousepad-marshal.h>
@@ -29,6 +26,9 @@
#include <mousepad/mousepad-util.h>
#include <mousepad/mousepad-window.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+
#define TOOL_BAR_ICON_SIZE GTK_ICON_SIZE_MENU
@@ -332,7 +332,7 @@ mousepad_search_bar_find_string (MousepadSearchBar *bar,
static void
mousepad_search_bar_hide_clicked (MousepadSearchBar *bar)
{
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* emit the signal */
g_signal_emit (G_OBJECT (bar), search_bar_signals[HIDE_BAR], 0);
@@ -383,7 +383,7 @@ mousepad_search_bar_highlight_toggled (GtkWidget *button,
{
MousepadSearchFlags flags;
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* set the new state */
bar->highlight_all = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (button));
@@ -416,7 +416,7 @@ mousepad_search_bar_match_case_toggled (GtkWidget *button,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* get the state of the toggle button */
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
@@ -436,7 +436,7 @@ mousepad_search_bar_match_case_toggled (GtkWidget *button,
static void
mousepad_search_bar_highlight_schedule (MousepadSearchBar *bar)
{
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* stop a pending timeout */
if (bar->highlight_id != 0)
@@ -498,7 +498,7 @@ mousepad_search_bar_entry (MousepadSearchBar *bar)
void
mousepad_search_bar_focus (MousepadSearchBar *bar)
{
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* focus the entry field */
gtk_widget_grab_focus (bar->entry);
@@ -520,7 +520,7 @@ mousepad_search_bar_find_next (MousepadSearchBar *bar)
{
MousepadSearchFlags flags;
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* set search flags */
flags = MOUSEPAD_SEARCH_FLAGS_ITER_SEL_END
@@ -537,7 +537,7 @@ mousepad_search_bar_find_previous (MousepadSearchBar *bar)
{
MousepadSearchFlags flags;
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* set search flags */
flags = MOUSEPAD_SEARCH_FLAGS_ITER_SEL_START
@@ -552,7 +552,7 @@ mousepad_search_bar_find_previous (MousepadSearchBar *bar)
void
mousepad_search_bar_set_text (MousepadSearchBar *bar, gchar *text)
{
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
gtk_entry_set_text (GTK_ENTRY (bar->entry), text);
}
diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 6fb6f18..cdc6ca6 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -183,7 +183,7 @@ mousepad_statusbar_overwrite_clicked (GtkWidget *widget,
GdkEventButton *event,
MousepadStatusbar *statusbar)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
/* only respond on the left button click */
if (event->type != GDK_BUTTON_PRESS || event->button != 1)
@@ -209,7 +209,7 @@ mousepad_statusbar_filetype_clicked (GtkWidget *widget,
GList *children;
gint n_children = 0;
- mousepad_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
/* only respond on the left button click */
if (event->type != GDK_BUTTON_PRESS || event->button != 1)
@@ -250,7 +250,7 @@ mousepad_statusbar_set_language (MousepadStatusbar *statusbar,
{
gchar *label;
- mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
+ g_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
if (language == NULL)
gtk_label_set_text (GTK_LABEL (statusbar->language), _("Filetype: None"));
@@ -272,7 +272,7 @@ mousepad_statusbar_set_cursor_position (MousepadStatusbar *statusbar,
{
gchar string[64];
- mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
+ g_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
/* create printable string */
if (G_UNLIKELY (selection > 0))
@@ -290,7 +290,7 @@ void
mousepad_statusbar_set_overwrite (MousepadStatusbar *statusbar,
gboolean overwrite)
{
- mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
+ g_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
gtk_widget_set_sensitive (statusbar->overwrite, overwrite);
diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index d4a3961..3ea42f9 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -149,7 +149,7 @@ mousepad_util_iter_backward_word_start (GtkTextIter *iter)
gboolean
mousepad_util_iter_forward_text_start (GtkTextIter *iter)
{
- mousepad_return_val_if_fail (!mousepad_util_iter_inside_word (iter), FALSE);
+ g_return_val_if_fail (!mousepad_util_iter_inside_word (iter), FALSE);
/* keep until we hit text or a line end */
while (g_unichar_isspace (gtk_text_iter_get_char (iter)))
@@ -166,7 +166,7 @@ mousepad_util_iter_backward_text_start (GtkTextIter *iter)
{
GtkTextIter prev = *iter;
- mousepad_return_val_if_fail (!mousepad_util_iter_inside_word (iter), FALSE);
+ g_return_val_if_fail (!mousepad_util_iter_inside_word (iter), FALSE);
while (!gtk_text_iter_starts_line (&prev) && gtk_text_iter_backward_char (&prev))
{
@@ -252,7 +252,7 @@ mousepad_util_utf8_strcapital (const gchar *str)
GString *result;
gboolean upper = TRUE;
- mousepad_return_val_if_fail (g_utf8_validate (str, -1, NULL), NULL);
+ g_return_val_if_fail (g_utf8_validate (str, -1, NULL), NULL);
/* create a new string */
result = g_string_sized_new (strlen (str));
@@ -307,7 +307,7 @@ mousepad_util_utf8_stropposite (const gchar *str)
gchar *buf;
GString *result;
- mousepad_return_val_if_fail (g_utf8_validate (str, -1, NULL), NULL);
+ g_return_val_if_fail (g_utf8_validate (str, -1, NULL), NULL);
/* create a new string */
result = g_string_sized_new (strlen (str));
@@ -393,7 +393,7 @@ mousepad_util_entry_error (GtkWidget *widget,
const GdkColor white = {0, 0xffff, 0xffff, 0xffff};
gpointer pointer;
- mousepad_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
/* get the current error state */
pointer = mousepad_object_get_data (G_OBJECT (widget), "error-state");
@@ -532,7 +532,7 @@ mousepad_util_get_save_location (const gchar *relpath,
{
gchar *filename, *dirname;
- mousepad_return_val_if_fail (g_get_user_config_dir () != NULL, NULL);
+ g_return_val_if_fail (g_get_user_config_dir () != NULL, NULL);
/* create the full filename */
filename = g_build_filename (g_get_user_config_dir (), relpath, NULL);
@@ -644,9 +644,9 @@ mousepad_util_search_iter (const GtkTextIter *start,
gboolean match_case, search_backwards, whole_word;
guint needle_offset = 0;
- mousepad_return_val_if_fail (start != NULL, FALSE);
- mousepad_return_val_if_fail (string != NULL, FALSE);
- mousepad_return_val_if_fail (limit != NULL, FALSE);
+ g_return_val_if_fail (start != NULL, FALSE);
+ g_return_val_if_fail (string != NULL, FALSE);
+ g_return_val_if_fail (limit != NULL, FALSE);
/* search properties */
match_case = (flags & MOUSEPAD_SEARCH_FLAGS_MATCH_CASE) != 0;
@@ -795,12 +795,12 @@ mousepad_util_search_get_iters (GtkTextBuffer *buffer,
else if (flags & (MOUSEPAD_SEARCH_FLAGS_ITER_AREA_END | MOUSEPAD_SEARCH_FLAGS_ITER_SEL_END))
*iter = sel_end;
else
- mousepad_assert_not_reached ();
+ g_assert_not_reached ();
}
else
{
/* this should never happen */
- mousepad_assert_not_reached ();
+ g_assert_not_reached ();
}
/* invert the start and end iter on backwards searching */
@@ -828,10 +828,10 @@ mousepad_util_highlight (GtkTextBuffer *buffer,
gboolean found, cached = FALSE;
gint counter = 0;
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), -1);
- mousepad_return_val_if_fail (GTK_IS_TEXT_TAG (tag), -1);
- mousepad_return_val_if_fail (string == NULL || g_utf8_validate (string, -1, NULL), -1);
- mousepad_return_val_if_fail ((flags & MOUSEPAD_SEARCH_FLAGS_DIR_BACKWARD) == 0, -1);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), -1);
+ g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), -1);
+ g_return_val_if_fail (string == NULL || g_utf8_validate (string, -1, NULL), -1);
+ g_return_val_if_fail ((flags & MOUSEPAD_SEARCH_FLAGS_DIR_BACKWARD) == 0, -1);
/* get the buffer bounds */
gtk_text_buffer_get_bounds (buffer, &start, &end);
@@ -914,10 +914,10 @@ mousepad_util_search (GtkTextBuffer *buffer,
GtkTextIter match_start, match_end;
GtkTextMark *mark_start, *mark_iter, *mark_end, *mark_replace;
- mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), -1);
- mousepad_return_val_if_fail (string && g_utf8_validate (string, -1, NULL), -1);
- mousepad_return_val_if_fail (replace == NULL || g_utf8_validate (replace, -1, NULL), -1);
- mousepad_return_val_if_fail ((flags & MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT) == 0, -1);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), -1);
+ g_return_val_if_fail (string && g_utf8_validate (string, -1, NULL), -1);
+ g_return_val_if_fail (replace == NULL || g_utf8_validate (replace, -1, NULL), -1);
+ g_return_val_if_fail ((flags & MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT) == 0, -1);
/* freeze buffer notifications */
g_object_freeze_notify (G_OBJECT (buffer));
@@ -1007,7 +1007,7 @@ mousepad_util_search (GtkTextBuffer *buffer,
else
{
/* no valid action was defined */
- mousepad_assert_not_reached ();
+ g_assert_not_reached ();
}
/* increase the counter */
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 5f935b8..90d6a56 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -22,13 +22,13 @@
#include <string.h>
#endif
-#include <gdk/gdkkeysyms.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-settings.h>
#include <mousepad/mousepad-util.h>
#include <mousepad/mousepad-view.h>
+#include <gdk/gdkkeysyms.h>
+
#define MOUSEPAD_VIEW_DEFAULT_FONT "Monospace"
@@ -611,14 +611,14 @@ mousepad_view_commit_handler (GtkIMContext *context,
const gchar *str,
MousepadView *view)
{
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (GTK_IS_IM_CONTEXT (context));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (GTK_IS_IM_CONTEXT (context));
/* if there is a selection, insert this string there too */
if (G_UNLIKELY (view->selection_marks != NULL))
{
/* debug check */
- mousepad_return_if_fail (gtk_text_view_get_editable (GTK_TEXT_VIEW (view)) == FALSE);
+ g_return_if_fail (gtk_text_view_get_editable (GTK_TEXT_VIEW (view)) == FALSE);
/* handle the text input for the multi selection */
mousepad_view_selection_key_press_event (view, str, 0, 0);
@@ -762,11 +762,11 @@ mousepad_view_selection_key_press_event (MousepadView *view,
GSList *li;
GtkTextBuffer *buffer;
- mousepad_return_if_fail (view->selection_marks != NULL);
- mousepad_return_if_fail (view->selection_start_x == -1);
- mousepad_return_if_fail (view->selection_end_x == -1);
- mousepad_return_if_fail ((keyval == 0 && text != NULL) || keyval != 0);
- mousepad_return_if_fail (g_slist_length (view->selection_marks) % 2 == 0);
+ g_return_if_fail (view->selection_marks != NULL);
+ g_return_if_fail (view->selection_start_x == -1);
+ g_return_if_fail (view->selection_end_x == -1);
+ g_return_if_fail ((keyval == 0 && text != NULL) || keyval != 0);
+ g_return_if_fail (g_slist_length (view->selection_marks) % 2 == 0);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -827,9 +827,9 @@ mousepad_view_selection_delete_content (MousepadView *view)
GtkTextIter start_iter, end_iter;
GSList *li;
- mousepad_return_if_fail (view->selection_marks != NULL);
- mousepad_return_if_fail (view->selection_length > 0);
- mousepad_return_if_fail (g_slist_length (view->selection_marks) % 2 == 0);
+ g_return_if_fail (view->selection_marks != NULL);
+ g_return_if_fail (view->selection_length > 0);
+ g_return_if_fail (g_slist_length (view->selection_marks) % 2 == 0);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -869,7 +869,7 @@ mousepad_view_selection_destroy (MousepadView *view)
GSList *li;
GtkTextIter start_iter, end_iter;
- mousepad_return_if_fail (view->selection_marks != NULL);
+ g_return_if_fail (view->selection_marks != NULL);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -929,8 +929,8 @@ mousepad_view_selection_draw (MousepadView *view,
GtkTextMark *start_mark, *end_mark;
GSList *li;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (view->selection_marks == NULL || g_slist_length (view->selection_marks) % 2 == 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (view->selection_marks == NULL || g_slist_length (view->selection_marks) % 2 == 0);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -1164,7 +1164,7 @@ mousepad_view_selection_string (MousepadView *view)
GtkTextIter start_iter, end_iter;
GSList *li;
- mousepad_return_val_if_fail (view->selection_marks == NULL || g_slist_length (view->selection_marks) % 2 == 0, NULL);
+ g_return_val_if_fail (view->selection_marks == NULL || g_slist_length (view->selection_marks) % 2 == 0, NULL);
/* create new string */
string = g_string_new (NULL);
@@ -1354,7 +1354,7 @@ mousepad_view_scroll_to_cursor (MousepadView *view)
{
GtkTextBuffer *buffer;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -1375,7 +1375,7 @@ mousepad_view_transpose_multi_selection (GtkTextBuffer *buffer,
GSList *strings = NULL;
GtkTextIter start_iter, end_iter;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the strings and delete the existing strings */
for (li = view->selection_marks; li != NULL; li = li->next)
@@ -1603,7 +1603,7 @@ mousepad_view_transpose (MousepadView *view)
GtkTextBuffer *buffer;
GtkTextIter sel_start, sel_end;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -1679,8 +1679,8 @@ mousepad_view_clipboard_cut (MousepadView *view)
GtkTextBuffer *buffer;
gchar *string;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
/* get the clipboard */
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view), GDK_SELECTION_CLIPBOARD);
@@ -1724,8 +1724,8 @@ mousepad_view_clipboard_copy (MousepadView *view)
GtkTextBuffer *buffer;
gchar *string;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
/* get the clipboard */
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view), GDK_SELECTION_CLIPBOARD);
@@ -1868,8 +1868,8 @@ mousepad_view_delete_selection (MousepadView *view)
{
GtkTextBuffer *buffer;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
if (view->selection_marks != NULL)
{
@@ -1900,7 +1900,7 @@ mousepad_view_select_all (MousepadView *view)
GtkTextIter start, end;
GtkTextBuffer *buffer;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* cleanup our selection */
if (view->selection_marks != NULL)
@@ -1925,8 +1925,8 @@ mousepad_view_change_selection (MousepadView *view)
GtkTextIter start_iter, end_iter;
GdkRectangle rect;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (mousepad_view_get_selection_length (view, NULL) != 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (mousepad_view_get_selection_length (view, NULL) != 0);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -1990,8 +1990,8 @@ mousepad_view_convert_selection_case (MousepadView *view,
gint offset = -1;
GSList *li = NULL;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
- mousepad_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (mousepad_view_get_selection_length (view, NULL) > 0);
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -2045,7 +2045,7 @@ mousepad_view_convert_selection_case (MousepadView *view,
break;
default:
- mousepad_assert_not_reached ();
+ g_assert_not_reached ();
break;
}
@@ -2053,7 +2053,7 @@ mousepad_view_convert_selection_case (MousepadView *view,
if (G_LIKELY (converted && strcmp (text, converted) != 0))
{
/* debug check */
- mousepad_return_if_fail (g_utf8_validate (converted, -1, NULL));
+ g_return_if_fail (g_utf8_validate (converted, -1, NULL));
/* delete old string */
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
@@ -2110,7 +2110,7 @@ mousepad_view_convert_spaces_and_tabs (MousepadView *view,
gint start_offset = -1;
gchar *string;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -2275,7 +2275,7 @@ mousepad_view_strip_trailing_spaces (MousepadView *view)
gint start, end, i;
gunichar c;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -2347,7 +2347,7 @@ mousepad_view_move_selection (MousepadView *view,
gchar *text;
gboolean insert_eol;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -2470,7 +2470,7 @@ mousepad_view_duplicate (MousepadView *view)
gboolean has_selection;
gboolean insert_eol = FALSE;
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* get the buffer */
buffer = mousepad_view_get_buffer (view);
@@ -2509,7 +2509,7 @@ void
mousepad_view_indent (MousepadView *view,
gint type)
{
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (view));
/* run a forced indent of the line(s) */
mousepad_view_indent_selection (view, type == INCREASE_INDENT, TRUE);
@@ -2526,7 +2526,7 @@ mousepad_view_get_selection_length (MousepadView *view,
gint sel_length = 0;
gboolean column_selection;
- mousepad_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
/* get the text buffer */
buffer = mousepad_view_get_buffer (view);
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index a1612b6..206324c 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -31,8 +31,6 @@
#include <stdlib.h>
#endif
-#include <glib/gstdio.h>
-
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-settings.h>
#include <mousepad/mousepad-action-group.h>
@@ -48,6 +46,8 @@
#include <mousepad/mousepad-window.h>
#include <mousepad/mousepad-window-ui.h>
+#include <glib/gstdio.h>
+
#define PADDING (2)
@@ -1203,9 +1203,9 @@ mousepad_window_connect_proxy (GtkUIManager *manager,
GtkWidget *proxy,
MousepadWindow *window)
{
- mousepad_return_if_fail (GTK_IS_ACTION (action));
- mousepad_return_if_fail (GTK_IS_MENU_ITEM (proxy) || GTK_IS_TOOL_ITEM (proxy));
- mousepad_return_if_fail (GTK_IS_UI_MANAGER (manager));
+ g_return_if_fail (GTK_IS_ACTION (action));
+ g_return_if_fail (GTK_IS_MENU_ITEM (proxy) || GTK_IS_TOOL_ITEM (proxy));
+ g_return_if_fail (GTK_IS_UI_MANAGER (manager));
if (GTK_IS_MENU_ITEM (proxy))
{
@@ -1239,9 +1239,9 @@ mousepad_window_disconnect_proxy (GtkUIManager *manager,
GtkWidget *proxy,
MousepadWindow *window)
{
- mousepad_return_if_fail (GTK_IS_ACTION (action));
- mousepad_return_if_fail (GTK_IS_MENU_ITEM (proxy) || GTK_IS_TOOL_ITEM (proxy));
- mousepad_return_if_fail (GTK_IS_UI_MANAGER (manager));
+ g_return_if_fail (GTK_IS_ACTION (action));
+ g_return_if_fail (GTK_IS_MENU_ITEM (proxy) || GTK_IS_TOOL_ITEM (proxy));
+ g_return_if_fail (GTK_IS_UI_MANAGER (manager));
if (GTK_IS_MENU_ITEM (proxy))
{
@@ -1405,8 +1405,8 @@ mousepad_window_open_file (MousepadWindow *window,
gchar *uri;
GtkRecentInfo *info;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (filename != NULL && *filename != '\0', FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (filename != NULL && *filename != '\0', FALSE);
/* check if the file is already openend */
npages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
@@ -1415,7 +1415,7 @@ mousepad_window_open_file (MousepadWindow *window,
document = MOUSEPAD_DOCUMENT (gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), i));
/* debug check */
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
if (G_LIKELY (document))
{
@@ -1559,10 +1559,10 @@ mousepad_window_open_files (MousepadWindow *window,
guint n;
gchar *filename;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (working_directory != NULL, FALSE);
- mousepad_return_val_if_fail (filenames != NULL, FALSE);
- mousepad_return_val_if_fail (*filenames != NULL, FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (working_directory != NULL, FALSE);
+ g_return_val_if_fail (filenames != NULL, FALSE);
+ g_return_val_if_fail (*filenames != NULL, FALSE);
/* block menu updates */
lock_menu_updates++;
@@ -1618,9 +1618,9 @@ mousepad_window_add (MousepadWindow *window,
gint page;
MousepadDocument *prev_active = window->active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_NOTEBOOK (window->notebook));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_NOTEBOOK (window->notebook));
/* create the tab label */
label = mousepad_document_get_tab_label (document);
@@ -1665,8 +1665,8 @@ mousepad_window_close_document (MousepadWindow *window,
gint response;
gboolean readonly;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
/* check if the document has been modified */
if (gtk_text_buffer_get_modified (document->buffer))
@@ -1720,8 +1720,8 @@ mousepad_window_set_title (MousepadWindow *window)
gboolean show_full_path;
MousepadDocument *document = window->active;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* whether to show the full path */
show_full_path = MOUSEPAD_SETTING_GET_BOOLEAN (PATH_IN_TITLE);
@@ -1786,8 +1786,8 @@ mousepad_window_notebook_switch_page (GtkNotebook *notebook,
{
MousepadDocument *document;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
/* get the new active document */
document = MOUSEPAD_DOCUMENT (gtk_notebook_get_nth_page (notebook, page_num));
@@ -1817,8 +1817,8 @@ mousepad_window_notebook_reordered (GtkNotebook *notebook,
guint page_num,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (page));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (page));
/* update the go menu */
mousepad_window_update_gomenu (window);
@@ -1834,8 +1834,8 @@ mousepad_window_notebook_added (GtkNotebook *notebook,
{
MousepadDocument *document = MOUSEPAD_DOCUMENT (page);
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* connect signals to the document for this window */
g_signal_connect (G_OBJECT (page), "close-tab", G_CALLBACK (mousepad_window_button_close_tab), window);
@@ -1867,9 +1867,9 @@ mousepad_window_notebook_removed (GtkNotebook *notebook,
gint npages;
MousepadDocument *document = MOUSEPAD_DOCUMENT (page);
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
/* disconnect the old document signals */
mousepad_disconnect_by_func (G_OBJECT (page), mousepad_window_button_close_tab, window);
@@ -1939,7 +1939,7 @@ mousepad_window_notebook_button_press_event (GtkNotebook *notebook,
guint page_num = 0;
gint x_root;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
if (event->type == GDK_BUTTON_PRESS && (event->button == 3 || event->button == 2))
{
@@ -2006,8 +2006,8 @@ mousepad_window_notebook_button_release_event (GtkNotebook *notebook,
GdkEventButton *event,
MousepadWindow *window)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
/* focus the active textview */
mousepad_document_focus_textview (window->active);
@@ -2026,8 +2026,8 @@ mousepad_window_notebook_create_window (GtkNotebook *notebook,
{
MousepadDocument *document;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), NULL);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (page), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (page), NULL);
/* only create new window when there are more then 2 tabs */
if (gtk_notebook_get_n_pages (notebook) >= 2)
@@ -2059,7 +2059,7 @@ mousepad_window_notebook_create_window (GtkNotebook *notebook,
static void
mousepad_window_modified_changed (MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
mousepad_window_set_title (window);
}
@@ -2075,8 +2075,8 @@ mousepad_window_cursor_changed (MousepadDocument *document,
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
if (window->statusbar)
{
@@ -2131,8 +2131,8 @@ mousepad_window_overwrite_changed (MousepadDocument *document,
gboolean overwrite,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* set the new overwrite mode in the statusbar */
if (window->statusbar)
@@ -2325,9 +2325,9 @@ mousepad_window_menu_templates (GtkWidget *item,
const gchar *homedir;
gchar *templates_path;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (GTK_IS_MENU_ITEM (item));
- mousepad_return_if_fail (gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)) == NULL);
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (GTK_IS_MENU_ITEM (item));
+ g_return_if_fail (gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)) == NULL);
/* schedule the idle build of the recent menu */
mousepad_window_recent_menu (window);
@@ -2451,8 +2451,8 @@ mousepad_window_menu_tab_sizes_update (MousepadWindow *window)
gchar *name, *label = NULL;
GtkAction *action;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* avoid menu actions */
lock_menu_updates++;
@@ -2499,8 +2499,8 @@ static void
mousepad_window_menu_textview_deactivate (GtkWidget *menu,
GtkTextView *textview)
{
- mousepad_return_if_fail (GTK_IS_TEXT_VIEW (textview));
- mousepad_return_if_fail (textview->popup_menu == menu);
+ g_return_if_fail (GTK_IS_TEXT_VIEW (textview));
+ g_return_if_fail (textview->popup_menu == menu);
/* disconnect this signal */
mousepad_disconnect_by_func (G_OBJECT (menu), mousepad_window_menu_textview_deactivate, textview);
@@ -2518,11 +2518,11 @@ mousepad_window_menu_textview_popup (GtkTextView *textview,
{
GtkWidget *menu;
- mousepad_return_if_fail (GTK_WIDGET (old_menu) == textview->popup_menu);
- mousepad_return_if_fail (GTK_IS_TEXT_VIEW (textview));
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- mousepad_return_if_fail (GTK_IS_MENU (textview->popup_menu));
+ g_return_if_fail (GTK_WIDGET (old_menu) == textview->popup_menu);
+ g_return_if_fail (GTK_IS_TEXT_VIEW (textview));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (GTK_IS_MENU (textview->popup_menu));
/* destroy origional menu */
gtk_widget_destroy (textview->popup_menu);
@@ -2556,7 +2556,7 @@ mousepad_window_update_actions (MousepadWindow *window)
const gchar *action_name;
GtkSourceLanguage *language;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* update the actions for the active document */
if (G_LIKELY (document))
@@ -2664,7 +2664,7 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
GSList *group = NULL;
GList *actions, *iter;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
GDK_THREADS_ENTER ();
@@ -2752,7 +2752,7 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
static void
mousepad_window_update_gomenu_idle_destroy (gpointer user_data)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (user_data));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (user_data));
MOUSEPAD_WINDOW (user_data)->update_go_menu_id = 0;
}
@@ -2762,7 +2762,7 @@ mousepad_window_update_gomenu_idle_destroy (gpointer user_data)
static void
mousepad_window_update_gomenu (MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* leave when we're updating multiple files or there is this an idle function pending */
if (lock_menu_updates && window->update_go_menu_id != 0)
@@ -2788,8 +2788,8 @@ mousepad_window_recent_add (MousepadWindow *window,
const gchar *charset;
static gchar *groups[] = { (gchar *) PACKAGE_NAME, NULL };
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_FILE (file));
/* get the charset */
charset = mousepad_encoding_get_charset (mousepad_file_get_encoding (file));
@@ -3001,7 +3001,7 @@ mousepad_window_recent_menu_idle_destroy (gpointer user_data)
static void
mousepad_window_recent_menu (MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* leave when we're updating multiple files or there is this an idle function pending */
if (lock_menu_updates > 0 || window->update_recent_menu_id != 0)
@@ -3102,8 +3102,8 @@ mousepad_window_drag_data_received (GtkWidget *widget,
GtkWidget *child, *label;
gint i, n_pages;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
/* we only accept text/uri-list drops with format 8 and atleast one byte of data */
if (info == TARGET_TEXT_URI_LIST && selection_data->format == 8 && selection_data->length > 0)
@@ -3133,7 +3133,7 @@ mousepad_window_drag_data_received (GtkWidget *widget,
document = (GtkWidget **) selection_data->data;
/* check */
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (*document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (*document));
/* take a reference on the document before we remove it */
g_object_ref (G_OBJECT (*document));
@@ -3185,7 +3185,7 @@ mousepad_window_search (MousepadWindow *window,
gint npages, i;
GtkWidget *document;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), -1);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), -1);
if (flags & MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT)
{
@@ -3219,7 +3219,7 @@ mousepad_window_search (MousepadWindow *window,
else
{
/* should never be reaches */
- mousepad_assert_not_reached ();
+ g_assert_not_reached ();
}
return nmatches;
@@ -3235,9 +3235,9 @@ mousepad_window_hide_search_bar (MousepadWindow *window)
{
MousepadSearchFlags flags;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (window->search_bar));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (window->search_bar));
/* setup flags */
flags = MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT
@@ -3265,7 +3265,7 @@ mousepad_window_paste_history_add (MousepadWindow *window)
gchar *text;
GSList *li;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* get the current clipboard text */
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
@@ -3318,10 +3318,10 @@ mousepad_window_paste_history_menu_position (GtkMenu *menu,
GdkRectangle location;
gint iter_x, iter_y;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (GTK_IS_TEXT_VIEW (document->textview));
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (GTK_IS_TEXT_VIEW (document->textview));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
/* get the root coordinates of the texview widget */
gdk_window_get_origin (gtk_text_view_get_window (GTK_TEXT_VIEW (document->textview), GTK_TEXT_WINDOW_TEXT), x, y);
@@ -3350,10 +3350,10 @@ mousepad_window_paste_history_activate (GtkMenuItem *item,
{
const gchar *text;
- mousepad_return_if_fail (GTK_IS_MENU_ITEM (item));
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (window->active->textview));
+ g_return_if_fail (GTK_IS_MENU_ITEM (item));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_VIEW (window->active->textview));
/* get the menu item text */
text = mousepad_object_get_data (G_OBJECT (item), "history-pointer");
@@ -3442,7 +3442,7 @@ mousepad_window_paste_history_menu (MousepadWindow *window)
gchar mnemonic[4];
gint n;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), NULL);
/* create new menu and set the screen */
menu = gtk_menu_new ();
@@ -3520,8 +3520,8 @@ mousepad_window_button_close_tab (MousepadDocument *document,
{
gint page_num;
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* switch to the tab we're going to close */
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (window->notebook), GTK_WIDGET (document));
@@ -3537,7 +3537,7 @@ static gboolean
mousepad_window_delete_event (MousepadWindow *window,
GdkEvent *event)
{
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
/* try to close the window */
mousepad_window_action_close_window (NULL, window);
@@ -3561,7 +3561,7 @@ mousepad_window_action_new (GtkAction *action,
{
MousepadDocument *document;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* create new document */
document = mousepad_document_new ();
@@ -3576,7 +3576,7 @@ static void
mousepad_window_action_new_window (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* emit the new window signal */
g_signal_emit (G_OBJECT (window), window_signals[NEW_WINDOW], 0);
@@ -3596,8 +3596,8 @@ mousepad_window_action_new_from_template (GtkMenuItem *item,
GtkSourceLanguage *language;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (GTK_IS_MENU_ITEM (item));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (GTK_IS_MENU_ITEM (item));
/* get the filename from the menu item */
filename = mousepad_object_get_data (G_OBJECT (item), "filename");
@@ -3673,8 +3673,8 @@ mousepad_window_action_open (GtkAction *action,
const gchar *filename;
GSList *filenames, *li;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* create new file chooser dialog */
chooser = gtk_file_chooser_dialog_new (_("Open File"),
@@ -3758,8 +3758,8 @@ mousepad_window_action_open_recent (GtkAction *action,
gboolean succeed = FALSE;
GtkRecentInfo *info;
- mousepad_return_if_fail (GTK_IS_ACTION (action));
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (GTK_IS_ACTION (action));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* get the info */
info = mousepad_object_get_data (G_OBJECT (action), "gtk-recent-info");
@@ -3816,7 +3816,7 @@ static void
mousepad_window_action_clear_recent (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* ask the user if he or she really want to clear the history */
if (mousepad_dialogs_clear_recent (GTK_WINDOW (window)))
@@ -3847,8 +3847,8 @@ mousepad_window_action_save (GtkAction *action,
gboolean modified;
gint response;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
if (mousepad_file_get_filename (document->file) == NULL)
{
@@ -3920,8 +3920,8 @@ mousepad_window_action_save_as (GtkAction *action,
GtkWidget *dialog;
gboolean succeed = FALSE;
- mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
- mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (window->active), FALSE);
/* create the dialog */
dialog = gtk_file_chooser_dialog_new (_("Save As"),
@@ -3979,8 +3979,8 @@ mousepad_window_action_save_all (GtkAction *action,
gboolean succeed = TRUE;
GError *error = NULL;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the current active tab */
current = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
@@ -3992,7 +3992,7 @@ mousepad_window_action_save_all (GtkAction *action,
document = MOUSEPAD_DOCUMENT (gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), i));
/* debug check */
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* continue if the document is not modified */
if (!gtk_text_buffer_get_modified (document->buffer))
@@ -4078,8 +4078,8 @@ mousepad_window_action_revert (GtkAction *action,
gint response;
gboolean succeed;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* ask the user if he really wants to do this when the file is modified */
if (gtk_text_buffer_get_modified (document->buffer))
@@ -4100,7 +4100,7 @@ mousepad_window_action_revert (GtkAction *action,
}
/* small check for debug builds */
- mousepad_return_if_fail (response == MOUSEPAD_RESPONSE_REVERT);
+ g_return_if_fail (response == MOUSEPAD_RESPONSE_REVERT);
}
/* lock the undo manager */
@@ -4130,8 +4130,8 @@ mousepad_window_action_print (GtkAction *action,
GError *error = NULL;
gboolean succeed;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* create new print operation */
print = mousepad_print_new ();
@@ -4156,8 +4156,8 @@ static void
mousepad_window_action_detach (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* invoke function without cooridinates */
mousepad_window_notebook_create_window (GTK_NOTEBOOK (window->notebook),
@@ -4171,8 +4171,8 @@ static void
mousepad_window_action_close (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* close active document */
mousepad_window_close_document (window, window->active);
@@ -4187,8 +4187,8 @@ mousepad_window_action_close_window (GtkAction *action,
gint npages, i;
GtkWidget *document;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the number of page in the notebook */
npages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook)) - 1;
@@ -4203,7 +4203,7 @@ mousepad_window_action_close_window (GtkAction *action,
document = gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), i);
/* check for debug builds */
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
/* focus the tab we're going to close */
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), i);
@@ -4232,8 +4232,8 @@ static void
mousepad_window_action_undo (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* undo */
gtk_source_buffer_undo (GTK_SOURCE_BUFFER (window->active->buffer));
@@ -4248,8 +4248,8 @@ static void
mousepad_window_action_redo (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* redo */
gtk_source_buffer_redo (GTK_SOURCE_BUFFER (window->active->buffer));
@@ -4266,8 +4266,8 @@ mousepad_window_action_cut (GtkAction *action,
{
GtkEditable *entry;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get searchbar entry */
entry = mousepad_search_bar_entry (MOUSEPAD_SEARCH_BAR (window->search_bar));
@@ -4290,8 +4290,8 @@ mousepad_window_action_copy (GtkAction *action,
{
GtkEditable *entry;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get searchbar entry */
entry = mousepad_search_bar_entry (MOUSEPAD_SEARCH_BAR (window->search_bar));
@@ -4314,8 +4314,8 @@ mousepad_window_action_paste (GtkAction *action,
{
GtkEditable *entry;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get searchbar entry */
entry = mousepad_search_bar_entry (MOUSEPAD_SEARCH_BAR (window->search_bar));
@@ -4335,8 +4335,8 @@ mousepad_window_action_paste_history (GtkAction *action,
{
GtkWidget *menu;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the history menu */
menu = mousepad_window_paste_history_menu (window);
@@ -4356,8 +4356,8 @@ static void
mousepad_window_action_paste_column (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* paste the clipboard into a column */
mousepad_view_clipboard_paste (window->active->textview, NULL, TRUE);
@@ -4371,8 +4371,8 @@ mousepad_window_action_delete (GtkAction *action,
{
GtkEditable *entry;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get searchbar entry */
entry = mousepad_search_bar_entry (MOUSEPAD_SEARCH_BAR (window->search_bar));
@@ -4390,8 +4390,8 @@ static void
mousepad_window_action_select_all (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* select everything in the document */
mousepad_view_select_all (window->active->textview);
@@ -4403,8 +4403,8 @@ static void
mousepad_window_action_change_selection (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* change the selection */
mousepad_view_change_selection (window->active->textview);
@@ -4425,8 +4425,8 @@ static void
mousepad_window_action_lowercase (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert selection to lowercase */
mousepad_view_convert_selection_case (window->active->textview, LOWERCASE);
@@ -4438,8 +4438,8 @@ static void
mousepad_window_action_uppercase (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert selection to uppercase */
mousepad_view_convert_selection_case (window->active->textview, UPPERCASE);
@@ -4451,8 +4451,8 @@ static void
mousepad_window_action_titlecase (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert selection to titlecase */
mousepad_view_convert_selection_case (window->active->textview, TITLECASE);
@@ -4464,8 +4464,8 @@ static void
mousepad_window_action_opposite_case (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert selection to opposite case */
mousepad_view_convert_selection_case (window->active->textview, OPPOSITE_CASE);
@@ -4477,8 +4477,8 @@ static void
mousepad_window_action_tabs_to_spaces (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert tabs to spaces */
mousepad_view_convert_spaces_and_tabs (window->active->textview, TABS_TO_SPACES);
@@ -4490,8 +4490,8 @@ static void
mousepad_window_action_spaces_to_tabs (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert spaces to tabs */
mousepad_view_convert_spaces_and_tabs (window->active->textview, SPACES_TO_TABS);
@@ -4503,8 +4503,8 @@ static void
mousepad_window_action_strip_trailing_spaces (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* convert spaces to tabs */
mousepad_view_strip_trailing_spaces (window->active->textview);
@@ -4516,8 +4516,8 @@ static void
mousepad_window_action_transpose (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* transpose */
mousepad_view_transpose (window->active->textview);
@@ -4529,8 +4529,8 @@ static void
mousepad_window_action_move_line_up (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* move the selection on line up */
mousepad_view_move_selection (window->active->textview, MOVE_LINE_UP);
@@ -4542,8 +4542,8 @@ static void
mousepad_window_action_move_line_down (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* move the selection on line down */
mousepad_view_move_selection (window->active->textview, MOVE_LINE_DOWN);
@@ -4555,8 +4555,8 @@ static void
mousepad_window_action_duplicate (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* dupplicate */
mousepad_view_duplicate (window->active->textview);
@@ -4568,8 +4568,8 @@ static void
mousepad_window_action_increase_indent (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* increase the indent */
mousepad_view_indent (window->active->textview, INCREASE_INDENT);
@@ -4581,8 +4581,8 @@ static void
mousepad_window_action_decrease_indent (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* decrease the indent */
mousepad_view_indent (window->active->textview, DECREASE_INDENT);
@@ -4598,8 +4598,8 @@ mousepad_window_action_find (GtkAction *action,
GtkTextIter selection_end;
gchar *selection;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* create a new search bar is needed */
if (window->search_bar == NULL)
@@ -4642,8 +4642,8 @@ static void
mousepad_window_action_find_next (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* find the next occurence */
if (G_LIKELY (window->search_bar != NULL))
@@ -4656,8 +4656,8 @@ static void
mousepad_window_action_find_previous (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* find the previous occurence */
if (G_LIKELY (window->search_bar != NULL))
@@ -4668,9 +4668,9 @@ mousepad_window_action_find_previous (GtkAction *action,
static void
mousepad_window_action_replace_switch_page (MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_REPLACE_DIALOG (window->replace_dialog));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_REPLACE_DIALOG (window->replace_dialog));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* page switched */
mousepad_replace_dialog_page_switched (MOUSEPAD_REPLACE_DIALOG (window->replace_dialog));
@@ -4680,7 +4680,7 @@ mousepad_window_action_replace_switch_page (MousepadWindow *window)
static void
mousepad_window_action_replace_destroy (MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* disconnect tab switch signal */
mousepad_disconnect_by_func (G_OBJECT (window->notebook), mousepad_window_action_replace_switch_page, window);
@@ -4698,8 +4698,8 @@ mousepad_window_action_replace (GtkAction *action,
GtkTextIter selection_end;
gchar *selection;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
if (window->replace_dialog == NULL)
{
@@ -4742,9 +4742,9 @@ static void
mousepad_window_action_go_to_position (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
/* run jump dialog */
if (mousepad_dialogs_go_to (GTK_WINDOW (window), window->active->buffer))
@@ -4763,8 +4763,8 @@ mousepad_window_action_select_font (GtkAction *action,
GtkWidget *dialog;
gchar *font_name;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
dialog = gtk_font_selection_dialog_new (_("Choose Mousepad Font"));
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
@@ -4803,8 +4803,8 @@ mousepad_window_action_line_numbers (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the current state */
active = gtk_toggle_action_get_active (action);
@@ -4821,7 +4821,7 @@ mousepad_window_action_menubar (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
active = gtk_toggle_action_get_active (action);
@@ -4839,7 +4839,7 @@ mousepad_window_action_toolbar (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
active = gtk_toggle_action_get_active (action);
@@ -4855,8 +4855,8 @@ static void
mousepad_window_action_statusbar_overwrite (MousepadWindow *window,
gboolean overwrite)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* set the new overwrite mode */
mousepad_document_set_overwrite (window->active, overwrite);
@@ -4870,7 +4870,7 @@ mousepad_window_action_statusbar (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
active = gtk_toggle_action_get_active (action);
@@ -4954,8 +4954,8 @@ mousepad_window_action_auto_indent (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the current state */
active = gtk_toggle_action_get_active (action);
@@ -4973,10 +4973,10 @@ mousepad_window_action_line_ending (GtkRadioAction *action,
{
MousepadLineEnding eol;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- mousepad_return_if_fail (MOUSEPAD_IS_FILE (window->active->file));
- mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_FILE (window->active->file));
+ g_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
/* leave when menu updates are locked */
if (lock_menu_updates == 0)
@@ -5000,12 +5000,12 @@ mousepad_window_action_tab_size (GtkToggleAction *action,
{
gboolean tab_size;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* leave when menu updates are locked */
if (lock_menu_updates == 0 && gtk_toggle_action_get_active (action))
{
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* get the tab size */
tab_size = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
@@ -5036,8 +5036,8 @@ mousepad_window_action_insert_spaces (GtkToggleAction *action,
{
gboolean insert_spaces;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* leave when menu updates are locked */
if (lock_menu_updates == 0)
@@ -5058,8 +5058,8 @@ mousepad_window_action_word_wrap (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* leave when menu updates are locked */
if (lock_menu_updates == 0)
@@ -5080,8 +5080,8 @@ mousepad_window_action_write_bom (GtkToggleAction *action,
{
gboolean active;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
- mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
/* leave when menu updates are locked */
if (lock_menu_updates == 0)
@@ -5106,7 +5106,7 @@ mousepad_window_action_prev_tab (GtkAction *action,
gint page_num;
gint n_pages;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* get notebook info */
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
@@ -5125,7 +5125,7 @@ mousepad_window_action_next_tab (GtkAction *action,
gint page_num;
gint n_pages;
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* get notebook info */
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
@@ -5143,9 +5143,9 @@ mousepad_window_action_go_to_tab (GtkRadioAction *action,
{
gint page;
- mousepad_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- mousepad_return_if_fail (GTK_IS_RADIO_ACTION (action));
- mousepad_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
+ g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ g_return_if_fail (GTK_IS_RADIO_ACTION (action));
+ g_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
/* leave when the menu is locked or this is not the active radio button */
if (lock_menu_updates == 0
@@ -5165,7 +5165,7 @@ static void
mousepad_window_action_contents (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* show help */
mousepad_dialogs_show_help (GTK_WINDOW (window), NULL, NULL);
@@ -5177,7 +5177,7 @@ static void
mousepad_window_action_about (GtkAction *action,
MousepadWindow *window)
{
- mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+ g_return_if_fail (MOUSEPAD_IS_WINDOW (window));
/* show about dialog */
mousepad_dialogs_show_about (GTK_WINDOW (window));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list