diff --git a/m4/moo-flags.m4 b/m4/moo-flags.m4 index 0fbe191a..c9ec7c9b 100644 --- a/m4/moo-flags.m4 +++ b/m4/moo-flags.m4 @@ -91,8 +91,9 @@ MOO_COMPILER _MOO_AC_CHECK_COMPILER_OPTIONS([dnl -Wall -Wextra -fexceptions -fno-strict-aliasing dnl --Wno-missing-field-initializers -Wno-overlength-strings dnl +-Wno-missing-field-initializers dnl -Wno-format-y2k -Wno-overlength-strings dnl +-Wno-deprecated-declarations dnl ]) _MOO_AC_CHECK_CXX_COMPILER_OPTIONS([dnl -std=c++11 -fno-rtti dnl diff --git a/moo/medit-app/parse.h b/moo/medit-app/parse.h index d4ee1c28..2a2684a1 100644 --- a/moo/medit-app/parse.h +++ b/moo/medit-app/parse.h @@ -191,7 +191,7 @@ parse_file (const char *string, if (!*current_dir) *current_dir = g_get_current_dir (); - filename = g_build_filename (*current_dir, string, NULL); + filename = g_build_filename (*current_dir, string, nullptr); ret = parse_filename (filename); g_free (filename); diff --git a/moo/mooapp/mooapp.cpp b/moo/mooapp/mooapp.cpp index 0c4c374a..d2b97063 100644 --- a/moo/mooapp/mooapp.cpp +++ b/moo/mooapp/mooapp.cpp @@ -972,26 +972,26 @@ install_common_actions (void) "tooltip", GTK_STOCK_PREFERENCES, "stock-id", GTK_STOCK_PREFERENCES, "closure-callback", moo_app_prefs_dialog, - NULL); + nullptr); moo_window_class_new_action (klass, "About", NULL, "label", GTK_STOCK_ABOUT, "no-accel", TRUE, "stock-id", GTK_STOCK_ABOUT, "closure-callback", moo_app_about_dialog, - NULL); + nullptr); moo_window_class_new_action (klass, "Help", NULL, "label", GTK_STOCK_HELP, "default-accel", MOO_APP_ACCEL_HELP, "stock-id", GTK_STOCK_HELP, "closure-callback", moo_app_help, - NULL); + nullptr); moo_window_class_new_action (klass, "ReportBug", NULL, "label", _("Report a Bug..."), "closure-callback", moo_app_report_bug, - NULL); + nullptr); moo_window_class_new_action (klass, "Quit", NULL, "display-name", GTK_STOCK_QUIT, @@ -1001,7 +1001,7 @@ install_common_actions (void) "default-accel", MOO_APP_ACCEL_QUIT, "closure-callback", moo_app_quit, "closure-proxy-func", moo_app_instance, - NULL); + nullptr); g_type_class_unref (klass); } diff --git a/moo/mooapp/moohtml.cpp b/moo/mooapp/moohtml.cpp index ae97053e..ef300572 100644 --- a/moo/mooapp/moohtml.cpp +++ b/moo/mooapp/moohtml.cpp @@ -213,7 +213,7 @@ _moo_html_tag_class_init (MooHtmlTagClass *klass) g_param_spec_string ("href", "href", "href", - NULL, + nullptr, (GParamFlags) G_PARAM_READWRITE)); } @@ -221,9 +221,9 @@ _moo_html_tag_class_init (MooHtmlTagClass *klass) static void _moo_html_tag_init (MooHtmlTag *tag) { - tag->href = NULL; - tag->parent = NULL; - tag->attr = NULL; + tag->href = nullptr; + tag->parent = nullptr; + tag->attr = nullptr; } @@ -309,7 +309,7 @@ _moo_html_class_init (MooHtmlClass *klass) g_param_spec_string ("title", "title", "title", - NULL, + nullptr, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, @@ -317,7 +317,7 @@ _moo_html_class_init (MooHtmlClass *klass) g_param_spec_string ("markup", "markup", "markup", - NULL, + nullptr, G_PARAM_WRITABLE)); html_signals[LOAD_URL] = @@ -325,7 +325,7 @@ _moo_html_class_init (MooHtmlClass *klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (MooHtmlClass, load_url), - g_signal_accumulator_true_handled, NULL, + g_signal_accumulator_true_handled, nullptr, _moo_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); @@ -335,7 +335,7 @@ _moo_html_class_init (MooHtmlClass *klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (MooHtmlClass, hover_link), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -348,15 +348,15 @@ moo_html_data_new (void) MooHtmlData *data = g_new0 (MooHtmlData, 1); data->anchors = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); + g_free, nullptr); data->root_tags = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); - data->href_tags = NULL; - data->doc = NULL; + g_free, nullptr); + data->href_tags = nullptr; + data->doc = nullptr; - data->filename = NULL; - data->basename = NULL; - data->dirname = NULL; + data->filename = nullptr; + data->basename = nullptr; + data->dirname = nullptr; data->font_sizes[0] = PANGO_SCALE_X_SMALL; data->font_sizes[1] = PANGO_SCALE_SMALL; @@ -420,7 +420,7 @@ moo_html_get_data (GtkTextView* object) data = moo_html_data_new (); g_object_set_data_full(G_OBJECT(object), "moo-html-data", data, (GDestroyNotify) moo_html_data_free); - g_signal_connect (object, "size-allocate", G_CALLBACK (moo_html_size_allocate_cb), NULL); + g_signal_connect (object, "size-allocate", G_CALLBACK (moo_html_size_allocate_cb), nullptr); } return data; @@ -437,7 +437,7 @@ _moo_html_init (MooHtml *html) "editable", FALSE, "wrap-mode", GTK_WRAP_WORD, "pixels-below-lines", DEFAULT_PAR_SPACING, - NULL); + nullptr); } @@ -476,7 +476,7 @@ moo_html_set_property (GObject *object, if (!string) string = ""; - _moo_html_load_memory (GTK_TEXT_VIEW (html), string, -1, NULL, NULL); + _moo_html_load_memory (GTK_TEXT_VIEW (html), string, -1, nullptr, nullptr); break; default: @@ -523,7 +523,7 @@ moo_html_load_url (GtkTextView *view, MooHtmlData *data = moo_html_get_data (view); g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), FALSE); - g_return_val_if_fail (url != NULL, FALSE); + g_return_val_if_fail (url != nullptr, FALSE); if (!moo_html_parse_url (url, &scheme, &base, &anchor)) { @@ -537,7 +537,7 @@ moo_html_load_url (GtkTextView *view, if (!strcmp (scheme, "mailto:") || !strcmp (scheme, "mailto://")) { - result = moo_open_email (base, NULL, NULL); + result = moo_open_email (base, nullptr, nullptr); goto out; } @@ -555,9 +555,9 @@ moo_html_load_url (GtkTextView *view, { if (data->dirname) { - char *filename = g_build_filename (data->dirname, base, NULL); + char *filename = g_build_filename (data->dirname, base, nullptr); - result = _moo_html_load_file (view, filename, NULL); + result = _moo_html_load_file (view, filename, nullptr); if (result && anchor) moo_html_goto_anchor (view, anchor); @@ -567,7 +567,7 @@ moo_html_load_url (GtkTextView *view, } else { - result = _moo_html_load_file (view, base, NULL); + result = _moo_html_load_file (view, base, nullptr); if (result && anchor) moo_html_goto_anchor (view, anchor); @@ -606,13 +606,13 @@ moo_html_clear (GtkTextView *view) MooHtmlData *data = moo_html_get_data (view); g_hash_table_destroy (data->anchors); - data->anchors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + data->anchors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nullptr); buffer = gtk_text_view_get_buffer (view); table = gtk_text_buffer_get_tag_table (buffer); g_slist_foreach (data->href_tags, (GFunc) remove_tag, table); g_slist_free (data->href_tags); - data->href_tags = NULL; + data->href_tags = nullptr; gtk_text_buffer_get_bounds (buffer, &start, &end); gtk_text_buffer_delete (buffer, &start, &end); @@ -622,10 +622,10 @@ moo_html_clear (GtkTextView *view) if (data->doc) xmlFreeDoc (data->doc); - data->doc = NULL; + data->doc = nullptr; g_slist_free (data->rulers); - data->rulers = NULL; + data->rulers = nullptr; } @@ -634,8 +634,8 @@ moo_text_view_set_markup (GtkTextView *view, const char *markup) { g_return_if_fail (GTK_IS_TEXT_VIEW (view)); - g_return_if_fail (markup != NULL); - _moo_html_load_memory (view, markup, -1, NULL, NULL); + g_return_if_fail (markup != nullptr); + _moo_html_load_memory (view, markup, -1, nullptr, nullptr); } @@ -650,7 +650,7 @@ _moo_html_load_memory (GtkTextView *view, MooHtmlData *data; g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), FALSE); - g_return_val_if_fail (buffer != NULL, FALSE); + g_return_val_if_fail (buffer != nullptr, FALSE); data = moo_html_get_data (view); @@ -669,9 +669,9 @@ _moo_html_load_memory (GtkTextView *view, g_free (data->filename); g_free (data->basename); g_free (data->dirname); - data->filename = NULL; - data->basename = NULL; - data->dirname = NULL; + data->filename = nullptr; + data->basename = nullptr; + data->dirname = nullptr; moo_html_set_doc (view, doc); @@ -689,7 +689,7 @@ _moo_html_load_file (GtkTextView *view, MooHtmlData *data = moo_html_get_data (view); g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), FALSE); - g_return_val_if_fail (file != NULL, FALSE); + g_return_val_if_fail (file != nullptr, FALSE); doc = htmlReadFile (file, encoding, HTML_PARSE_NONET); @@ -717,7 +717,7 @@ moo_html_set_doc (GtkTextView *view, { MooHtmlData *data; - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); data = moo_html_get_data (view); g_return_if_fail (doc != data->doc); @@ -743,7 +743,7 @@ attr_compose (MooHtmlAttr *dest, static MooHtmlAttrMask font_face_mask = MOO_HTML_FONT_FACE | MOO_HTML_MONOSPACE; - g_return_if_fail (dest != NULL); + g_return_if_fail (dest != nullptr); if (!src) return; @@ -855,49 +855,49 @@ attr_apply (const MooHtmlAttr *attr, { MooHtmlData *data = moo_html_get_data (view); - g_return_if_fail (attr != NULL && tag != NULL); + g_return_if_fail (attr != nullptr && tag != nullptr); moo_html_attr_free (tag->attr); tag->attr = moo_html_attr_copy (attr); if (attr->mask & MOO_HTML_FG) - g_object_set (tag, "foreground", attr->fg, NULL); + g_object_set (tag, "foreground", attr->fg, nullptr); if (attr->mask & MOO_HTML_BG) - g_object_set (tag, "background", attr->bg, NULL); + g_object_set (tag, "background", attr->bg, nullptr); if (attr->mask & MOO_HTML_BOLD) - g_object_set (tag, "weight", PANGO_WEIGHT_BOLD, NULL); + g_object_set (tag, "weight", PANGO_WEIGHT_BOLD, nullptr); if (attr->mask & MOO_HTML_ITALIC) - g_object_set (tag, "style", PANGO_STYLE_ITALIC, NULL); + g_object_set (tag, "style", PANGO_STYLE_ITALIC, nullptr); if (attr->mask & MOO_HTML_UNDERLINE) - g_object_set (tag, "underline", PANGO_UNDERLINE_SINGLE, NULL); + g_object_set (tag, "underline", PANGO_UNDERLINE_SINGLE, nullptr); if (attr->mask & MOO_HTML_STRIKETHROUGH) - g_object_set (tag, "strikethrough", TRUE, NULL); + g_object_set (tag, "strikethrough", TRUE, nullptr); if (attr->mask & MOO_HTML_LEFT_MARGIN) - g_object_set (tag, "left-margin", attr->left_margin, NULL); + g_object_set (tag, "left-margin", attr->left_margin, nullptr); if (attr->mask & MOO_HTML_LINK) { g_free (tag->href); tag->href = g_strdup (attr->link); - g_object_set (tag, "foreground", "blue", NULL); + g_object_set (tag, "foreground", "blue", nullptr); } if (attr->mask & MOO_HTML_SUP) g_object_set (tag, "rise", 8 * PANGO_SCALE, "size", 8 * PANGO_SCALE, - NULL); + nullptr); if (attr->mask & MOO_HTML_SUB) g_object_set (tag, "rise", -8 * PANGO_SCALE, "size", 8 * PANGO_SCALE, - NULL); + nullptr); if (attr->mask & MOO_HTML_MONOSPACE) - g_object_set (tag, "font", data->monospace, NULL); + g_object_set (tag, "font", data->monospace, nullptr); else if (attr->mask & MOO_HTML_FONT_FACE) - g_object_set (tag, "font", attr->font_face, NULL); + g_object_set (tag, "font", attr->font_face, nullptr); if (attr->mask & MOO_HTML_HEADING) { @@ -914,7 +914,7 @@ attr_apply (const MooHtmlAttr *attr, g_object_set (tag, "scale", scale, "pixels-below-lines", DEFAULT_PAR_SPACING + space, - NULL); + nullptr); } else if (attr->mask & MOO_HTML_SMALLER) { @@ -927,7 +927,7 @@ attr_apply (const MooHtmlAttr *attr, g_object_set (tag, "scale", scale, "pixels-below-lines", DEFAULT_PAR_SPACING + space, - NULL); + nullptr); } else if (attr->mask & MOO_HTML_FONT_SIZE) { @@ -936,11 +936,11 @@ attr_apply (const MooHtmlAttr *attr, "scale", data->font_sizes[attr->font_size - 1], "pixels-below-lines", DEFAULT_PAR_SPACING + data->par_spacing[attr->font_size - 1], - NULL); + nullptr); } else if (attr->mask & MOO_HTML_FONT_PT_SIZE) { - g_object_set (tag, "size-points", (double) attr->font_pt_size, NULL); + g_object_set (tag, "size-points", (double) attr->font_pt_size, nullptr); } } @@ -958,11 +958,11 @@ moo_html_make_heading_tag (GtkTextView *view, "pixels-below-lines", DEFAULT_PAR_SPACING + data->heading_spacing[heading - 1], "scale", data->heading_sizes[heading - 1], - "weight", PANGO_WEIGHT_BOLD, NULL); + "weight", PANGO_WEIGHT_BOLD, nullptr); if (data->heading_faces[heading - 1]) g_object_set (tag, "family", - data->heading_faces[heading - 1], NULL); + data->heading_faces[heading - 1], nullptr); } @@ -976,7 +976,7 @@ moo_html_create_tag (GtkTextView *view, MooHtmlAttr real_attr; MooHtmlData *data = moo_html_get_data (view); - g_return_val_if_fail (attr != NULL, NULL); + g_return_val_if_fail (attr != nullptr, nullptr); if (!attr->mask && !force) return parent; @@ -991,7 +991,7 @@ moo_html_create_tag (GtkTextView *view, real_attr = *attr; } - tag = MOO_HTML_TAG (g_object_new (MOO_TYPE_HTML_TAG, (const char*) NULL)); + tag = MOO_HTML_TAG (g_object_new (MOO_TYPE_HTML_TAG, (const char*) nullptr)); gtk_text_tag_table_add (gtk_text_buffer_get_tag_table (gtk_text_view_get_buffer (view)), GTK_TEXT_TAG (tag)); g_object_unref (tag); @@ -1010,7 +1010,7 @@ moo_html_attr_copy (const MooHtmlAttr *src) { MooHtmlAttr *attr; - g_return_val_if_fail (src != NULL, NULL); + g_return_val_if_fail (src != nullptr, nullptr); attr = g_new (MooHtmlAttr, 1); @@ -1048,9 +1048,9 @@ moo_html_create_anchor (GtkTextView *view, char *alt_name; MooHtmlData *data = moo_html_get_data (view); - g_return_if_fail (name != NULL && (name[0] != '#' || name[1])); + g_return_if_fail (name != nullptr && (name[0] != '#' || name[1])); - mark = gtk_text_buffer_create_mark (buffer, NULL, iter, TRUE); + mark = gtk_text_buffer_create_mark (buffer, nullptr, iter, TRUE); if (name[0] == '#') alt_name = g_strdup (name + 1); @@ -1101,7 +1101,7 @@ moo_html_motion (GtkWidget *widget, if (tag) { - g_return_val_if_fail (tag->href != NULL, FALSE); + g_return_val_if_fail (tag->href != nullptr, FALSE); if (!html->data->hover_link || strcmp (html->data->hover_link, tag->href)) { @@ -1122,13 +1122,13 @@ moo_html_motion (GtkWidget *widget, GdkCursor *cursor; g_free (html->data->hover_link); - html->data->hover_link = NULL; + html->data->hover_link = nullptr; cursor = gdk_cursor_new (GDK_XTERM); gdk_window_set_cursor (event->window, cursor); gdk_cursor_unref (cursor); - g_signal_emit (html, html_signals[HOVER_LINK], 0, NULL); + g_signal_emit (html, html_signals[HOVER_LINK], 0, nullptr); } out: @@ -1140,18 +1140,18 @@ static MooHtmlTag* moo_html_get_link_tag (GtkTextIter *iter) { MooHtmlTag *tag = moo_html_get_tag (iter); - return (tag && tag->href) ? tag : NULL; + return (tag && tag->href) ? tag : nullptr; } static MooHtmlTag* moo_html_get_tag (GtkTextIter *iter) { - MooHtmlTag *tag = NULL; + MooHtmlTag *tag = nullptr; GSList *l; GSList *list = gtk_text_iter_get_tags (iter); - for (l = list; l != NULL; l = l->next) + for (l = list; l != nullptr; l = l->next) { if (MOO_IS_HTML_TAG (l->data)) { @@ -1206,7 +1206,7 @@ moo_html_button_release (GtkWidget *widget, if (tag) { gboolean result; - g_assert (tag->href != NULL); + g_assert (tag->href != nullptr); g_signal_emit (html, html_signals[LOAD_URL], 0, tag->href, &result); } @@ -1224,11 +1224,11 @@ moo_html_parse_url (const char *url, GRegex *regex; GMatchInfo *match_info; - g_return_val_if_fail (url != NULL, FALSE); + g_return_val_if_fail (url != nullptr, FALSE); g_return_val_if_fail (scheme && base && anchor, FALSE); - regex = g_regex_new ("^([a-zA-Z]+:(//)?)?([^#]*)(#(.*))?$", GRegexCompileFlags (0), GRegexMatchFlags (0), NULL); - g_return_val_if_fail (regex != NULL, FALSE); + regex = g_regex_new ("^([a-zA-Z]+:(//)?)?([^#]*)(#(.*))?$", GRegexCompileFlags (0), GRegexMatchFlags (0), nullptr); + g_return_val_if_fail (regex != nullptr, FALSE); if (!g_regex_match (regex, url, GRegexMatchFlags (0), &match_info)) { @@ -1241,9 +1241,9 @@ moo_html_parse_url (const char *url, *base = g_match_info_fetch (match_info, 3); *anchor = g_match_info_fetch (match_info, 5); - if (!*scheme || !**scheme) {g_free (*scheme); *scheme = NULL;} - if (!*base || !**base) {g_free (*base); *base = NULL;} - if (!*anchor || !**anchor) {g_free (*anchor); *anchor = NULL;} + if (!*scheme || !**scheme) {g_free (*scheme); *scheme = nullptr;} + if (!*base || !**base) {g_free (*base); *base = nullptr;} + if (!*anchor || !**anchor) {g_free (*anchor); *anchor = nullptr;} g_match_info_free (match_info); g_regex_unref (regex); @@ -1258,7 +1258,7 @@ moo_html_goto_anchor (GtkTextView *view, GtkTextMark *mark; MooHtmlData *data = moo_html_get_data (view); - g_return_val_if_fail (anchor != NULL, FALSE); + g_return_val_if_fail (anchor != nullptr, FALSE); mark = (GtkTextMark*) g_hash_table_lookup (data->anchors, anchor); @@ -1284,10 +1284,10 @@ moo_html_set_font (MooHtml *html, PangoFontDescription *font; g_return_if_fail (MOO_IS_HTML (html)); - g_return_if_fail (string != NULL); + g_return_if_fail (string != nullptr); font = pango_font_description_from_string (string); - g_return_if_fail (font != NULL); + g_return_if_fail (font != nullptr); gtk_widget_modify_font (GTK_WIDGET (html), font); pango_font_description_free (font); @@ -1299,7 +1299,7 @@ static void moo_html_size_allocate_real (GtkWidget *widget, G_GNUC_UNUSED GtkAllocation *allocation) { - int border_width, child_width, height; + int border_width, child_width; GSList *l; GdkWindow *window; MooHtmlData *data = moo_html_get_data (GTK_TEXT_VIEW (widget)); @@ -1308,17 +1308,16 @@ moo_html_size_allocate_real (GtkWidget *widget, return; window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT); - g_return_if_fail (window != NULL); + g_return_if_fail (window != nullptr); child_width = gdk_window_get_width (window); - height = gdk_window_get_height (window); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); child_width -= 2 * border_width + 2 * widget->style->xthickness + gtk_text_view_get_left_margin (GTK_TEXT_VIEW (widget)) + gtk_text_view_get_right_margin (GTK_TEXT_VIEW (widget)); child_width = MAX (child_width, 0); - for (l = data->rulers; l != NULL; l = l->next) + for (l = data->rulers; l != nullptr; l = l->next) { GtkWidget *ruler = GTK_WIDGET (l->data); gtk_widget_set_size_request (ruler, child_width, -1); @@ -1403,7 +1402,7 @@ moo_html_load_doc (GtkTextView *view, return; } - for (node = root->children; node != NULL; node = node->next) + for (node = root->children; node != nullptr; node = node->next) { if (IS_HEAD_ELEMENT (node)) { @@ -1427,7 +1426,7 @@ moo_html_load_head (GtkTextView *view, { xmlNode *child; - for (child = node->children; child != NULL; child = child->next) + for (child = node->children; child != nullptr; child = child->next) { if (IS_TITLE_ELEMENT (child)) { @@ -1462,7 +1461,7 @@ moo_html_new_line (GtkTextView *view, { if (tag) gtk_text_buffer_insert_with_tags (buffer, iter, "\n", 1, - GTK_TEXT_TAG (tag), NULL); + GTK_TEXT_TAG (tag), nullptr); else gtk_text_buffer_insert (buffer, iter, "\n", 1); } @@ -1483,7 +1482,7 @@ str_find_separator (const char *str) return p; } - return NULL; + return nullptr; } @@ -1515,9 +1514,9 @@ moo_html_insert_text (GtkTextView *view, { gtk_text_buffer_insert_with_tags (buffer, iter, text, p - text, - GTK_TEXT_TAG (tag), NULL); + GTK_TEXT_TAG (tag), nullptr); gtk_text_buffer_insert_with_tags (buffer, iter, " ", 1, - GTK_TEXT_TAG (tag), NULL); + GTK_TEXT_TAG (tag), nullptr); } else { @@ -1545,7 +1544,7 @@ moo_html_insert_text (GtkTextView *view, if (tag) gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, - GTK_TEXT_TAG (tag), NULL); + GTK_TEXT_TAG (tag), nullptr); else gtk_text_buffer_insert (buffer, iter, text, -1); data->new_line = FALSE; @@ -1595,7 +1594,7 @@ moo_html_insert_verbatim (GtkTextView *view, guint len; MooHtmlData *data = moo_html_get_data (view); - g_return_if_fail (text != NULL); + g_return_if_fail (text != nullptr); if (text[0] == '\n' && data->new_line) text++; @@ -1608,7 +1607,7 @@ moo_html_insert_verbatim (GtkTextView *view, if (tag) gtk_text_buffer_insert_with_tags (buffer, iter, text, len, - GTK_TEXT_TAG (tag), NULL); + GTK_TEXT_TAG (tag), nullptr); else gtk_text_buffer_insert (buffer, iter, text, len); @@ -1696,7 +1695,7 @@ moo_html_load_body (GtkTextView *view, buffer = gtk_text_view_get_buffer (view); gtk_text_buffer_get_end_iter (buffer, &iter); - process_elm_body (view, buffer, node, NULL, &iter); + process_elm_body (view, buffer, node, nullptr, &iter); } @@ -1708,11 +1707,11 @@ typedef struct { static MooHtmlAttr* get_format_elm_attr (xmlNode *node) { - static GHashTable *elms = NULL; + static GHashTable *elms = nullptr; MooHtmlAttr *attr; if (!IS_ELEMENT (node)) - return NULL; + return nullptr; if (!elms) { @@ -1765,7 +1764,7 @@ get_format_elm_attr (xmlNode *node) typedef void (*ProcessElm) (GtkTextView *view, GtkTextBuffer *buffer, xmlNode *elm, MooHtmlTag *parent, GtkTextIter *iter); -static GHashTable *proc_elm_funcs__ = NULL; +static GHashTable *proc_elm_funcs__ = nullptr; static void add_func__ (const char *static_elm_name, @@ -1807,7 +1806,7 @@ get_proc_elm_func (xmlNode *node) if (IS_ELEMENT (node)) return (ProcessElm) g_hash_table_lookup (proc_elm_funcs__, node->name); else - return NULL; + return nullptr; } @@ -1822,7 +1821,7 @@ process_elm_body (GtkTextView *view, MooHtmlAttr *attr; ProcessElm func; - for (child = elm->children; child != NULL; child = child->next) + for (child = elm->children; child != nullptr; child = child->next) { if (IS_TEXT (child)) @@ -1964,7 +1963,7 @@ parse_int (const char *str, return FALSE; errno = 0; - num = strtol (str, NULL, 10); + num = strtol (str, nullptr, 10); if (errno) return FALSE; @@ -1993,7 +1992,7 @@ static char* make_li_number (int count, OLType type) { - g_return_val_if_fail (count > 0, NULL); + g_return_val_if_fail (count > 0, nullptr); switch (type) { @@ -2003,14 +2002,14 @@ make_li_number (int count, case OL_NUM: return g_strdup_printf (" %d. ", count); case OL_LOWER_ALPHA: - g_return_val_if_fail (count <= 26, NULL); + g_return_val_if_fail (count <= 26, nullptr); return g_strdup_printf (" %c. ", count - 1 + 'a'); case OL_UPPER_ALPHA: - g_return_val_if_fail (count <= 26, NULL); + g_return_val_if_fail (count <= 26, nullptr); return g_strdup_printf (" %c. ", count - 1 + 'A'); } - g_return_val_if_reached (NULL); + g_return_val_if_reached (nullptr); } static void @@ -2023,7 +2022,7 @@ process_ol_elm (GtkTextView *view, int count; OLType list_type = OL_NUM; xmlNode *child; - xmlChar *start = NULL, *type = NULL; + xmlChar *start = nullptr, *type = nullptr; MooHtmlData *data = moo_html_get_data (view); count = 1; @@ -2051,7 +2050,7 @@ process_ol_elm (GtkTextView *view, moo_html_new_line (view, buffer, iter, current, FALSE); - for (child = elm->children; child != NULL; child = child->next) + for (child = elm->children; child != nullptr; child = child->next) { if (IS_LI_ELEMENT (child)) { @@ -2094,7 +2093,7 @@ process_ul_elm (GtkTextView *view, GtkTextIter *iter) { xmlNode *child; - for (child = elm->children; child != NULL; child = child->next) + for (child = elm->children; child != nullptr; child = child->next) process_elm_body (view, buffer, child, current, iter); } @@ -2156,7 +2155,7 @@ process_font_elm (GtkTextView *view, face = GET_PROP (elm, "face"); attr.mask = MOO_HTML_NONE; - attr.font_face = NULL; + attr.font_face = nullptr; if (size__) { @@ -2349,9 +2348,9 @@ process_img_elm (GtkTextView *view, { xmlChar *src; xmlChar *alt; - char *path = NULL; + char *path = nullptr; GdkPixbuf *pixbuf; - GError *error = NULL; + GError *error = nullptr; int offset; GtkTextIter before; MooHtmlData *data = moo_html_get_data (view); @@ -2359,13 +2358,13 @@ process_img_elm (GtkTextView *view, src = GET_PROP (elm, "src"); alt = GET_PROP (elm, "alt"); - g_return_if_fail (src != NULL); + g_return_if_fail (src != nullptr); if (!data->dirname) goto try_alt; - path = g_build_filename (data->dirname, src, NULL); - g_return_if_fail (path != NULL); + path = g_build_filename (data->dirname, src, nullptr); + g_return_if_fail (path != nullptr); pixbuf = gdk_pixbuf_new_from_file (path, &error); diff --git a/moo/mooedit/mooeditaction.cpp b/moo/mooedit/mooeditaction.cpp index e1fafa35..62ce6dd2 100644 --- a/moo/mooedit/mooeditaction.cpp +++ b/moo/mooedit/mooeditaction.cpp @@ -283,7 +283,7 @@ moo_edit_action_check_state_real (MooEditAction *action) visible = moo_edit_action_check_visible (action); sensitive = moo_edit_action_check_sensitive (action); - g_object_set (action, "sensitive", sensitive, "visible", visible, NULL); + g_object_set (action, "sensitive", sensitive, "visible", visible, nullptr); } diff --git a/moo/mooedit/mooeditdialogs.cpp b/moo/mooedit/mooeditdialogs.cpp index af32b4f3..110590bf 100644 --- a/moo/mooedit/mooeditdialogs.cpp +++ b/moo/mooedit/mooeditdialogs.cpp @@ -47,7 +47,7 @@ _moo_edit_open_dialog (GtkWidget *widget, MooOpenInfoArray *info_array = NULL; guint i; - moo_prefs_create_key (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), MOO_PREFS_STATE, G_TYPE_STRING, NULL); + moo_prefs_create_key (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), MOO_PREFS_STATE, G_TYPE_STRING, nullptr); if (current_doc && moo_prefs_get_bool (moo_edit_setting (MOO_EDIT_PREFS_DIALOGS_OPEN_FOLLOWS_DOC))) { @@ -64,8 +64,8 @@ _moo_edit_open_dialog (GtkWidget *widget, dialog = moo_file_dialog_new (MOO_FILE_DIALOG_OPEN, widget, TRUE, GTK_STOCK_OPEN, start, - NULL); - g_object_set (dialog, "enable-encodings", TRUE, NULL); + nullptr); + g_object_set (dialog, "enable-encodings", TRUE, nullptr); moo_file_dialog_set_help_id (dialog, "dialog-open"); moo_file_dialog_set_remember_size (dialog, moo_edit_setting (MOO_EDIT_PREFS_DIALOG_OPEN)); @@ -107,7 +107,7 @@ _moo_edit_save_as_dialog (MooEdit *doc, GFile *start = NULL; GFile *file = NULL; - g_return_val_if_fail (MOO_IS_EDIT (doc), NULL); + g_return_val_if_fail (MOO_IS_EDIT (doc), nullptr); moo_prefs_create_key (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), MOO_PREFS_STATE, G_TYPE_STRING, NULL); @@ -128,7 +128,7 @@ _moo_edit_save_as_dialog (MooEdit *doc, GTK_WIDGET (moo_edit_get_view (doc)), FALSE, GTK_STOCK_SAVE_AS, start, display_basename); - g_object_set (dialog, "enable-encodings", TRUE, NULL); + g_object_set (dialog, "enable-encodings", TRUE, nullptr); moo_file_dialog_set_encoding (dialog, moo_edit_get_encoding (doc)); moo_file_dialog_set_help_id (dialog, "dialog-save"); @@ -252,7 +252,7 @@ name_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column, gtk_tree_model_get (model, iter, COLUMN_EDIT, &doc, -1); g_return_if_fail (MOO_IS_EDIT (doc)); - g_object_set (cell, "text", moo_edit_get_display_basename (doc), NULL); + g_object_set (cell, "text", moo_edit_get_display_basename (doc), nullptr); g_object_unref (doc); } @@ -337,7 +337,7 @@ files_treeview_init (GtkTreeView *treeview, GtkWidget *dialog, MooEditArray *doc gtk_tree_view_append_column (treeview, column); cell = gtk_cell_renderer_toggle_new (); gtk_tree_view_column_pack_start (column, cell, FALSE); - g_object_set (cell, "activatable", TRUE, NULL); + g_object_set (cell, "activatable", TRUE, nullptr); gtk_tree_view_column_add_attribute (column, cell, "active", COLUMN_SAVE); g_signal_connect (cell, "toggled", G_CALLBACK (save_toggled), store); @@ -429,7 +429,7 @@ _moo_edit_save_multiple_changes_dialog (MooEditArray *docs, MOO_STOCK_SAVE_NONE, GTK_RESPONSE_NO, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, MOO_STOCK_SAVE_SELECTED, GTK_RESPONSE_YES, - NULL); + nullptr); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); @@ -530,7 +530,7 @@ moo_edit_question_dialog (MooEdit *doc, gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, button, GTK_RESPONSE_YES, - NULL); + nullptr); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_YES, @@ -623,7 +623,7 @@ _moo_edit_try_encoding_dialog (G_GNUC_UNUSED GFile *file, gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + nullptr); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_OK, @@ -779,7 +779,7 @@ _moo_text_search_from_start_dialog (GtkWidget *widget, gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_NO, GTK_RESPONSE_CANCEL, GTK_STOCK_YES, GTK_RESPONSE_YES, - NULL); + nullptr); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), GTK_RESPONSE_YES, @@ -817,7 +817,7 @@ _moo_text_regex_error_dialog (GtkWidget *parent, "%s", msg_text); moo_window_set_parent (dialog, parent); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, - GTK_RESPONSE_CANCEL, NULL); + GTK_RESPONSE_CANCEL, nullptr); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/moo/mooedit/mooeditor.cpp b/moo/mooedit/mooeditor.cpp index ce4498af..b908b5c6 100644 --- a/moo/mooedit/mooeditor.cpp +++ b/moo/mooedit/mooeditor.cpp @@ -334,7 +334,7 @@ moo_editor_class_init (MooEditorClass *klass) "label", Q_("Open Recent|_More..."), "default-accel", MOO_EDIT_ACCEL_OPEN_RECENT_DIALOG, "closure-callback", action_recent_dialog, - NULL); + nullptr); g_type_class_unref (edit_window_class); add_new_window_action (); @@ -602,7 +602,7 @@ add_new_window_action (void) "default-accel", MOO_EDIT_ACCEL_NEW_WINDOW, "closure-callback", moo_editor_new_window, "closure-proxy-func", moo_edit_window_get_editor, - NULL); + nullptr); } @@ -2997,7 +2997,7 @@ _moo_editor_apply_prefs (MooEditor *editor) g_object_set (editor, "save-backups", backups, - NULL); + nullptr); } diff --git a/moo/mooedit/mooeditprefs.cpp b/moo/mooedit/mooeditprefs.cpp index 6de4b028..7fbce596 100644 --- a/moo/mooedit/mooeditprefs.cpp +++ b/moo/mooedit/mooeditprefs.cpp @@ -211,7 +211,7 @@ _moo_edit_update_global_config (void) "add-newline", add_newline, "show-line-numbers", show_line_numbers, "wrap-mode", wrap_mode, - NULL); + nullptr); } @@ -248,9 +248,9 @@ _moo_edit_view_apply_prefs (MooEditView *view) "auto-indent", get_bool (MOO_EDIT_PREFS_AUTO_INDENT), "tab-indents", get_bool (MOO_EDIT_PREFS_TAB_INDENTS), "backspace-indents", get_bool (MOO_EDIT_PREFS_BACKSPACE_INDENTS), - NULL); + nullptr); - g_object_set (view, "draw-whitespace", ws_flags, NULL); + g_object_set (view, "draw-whitespace", ws_flags, nullptr); moo_text_view_set_font_from_string (MOO_TEXT_VIEW (view), get_string (MOO_EDIT_PREFS_FONT)); diff --git a/moo/mooedit/mooeditprefspage.cpp b/moo/mooedit/mooeditprefspage.cpp index 32a2ca85..513c7da8 100644 --- a/moo/mooedit/mooeditprefspage.cpp +++ b/moo/mooedit/mooeditprefspage.cpp @@ -140,7 +140,7 @@ page_general_init (MooPrefsPage *page) { MooTextStyleScheme *scheme; - g_object_set (gxml->fontbutton, "monospace", TRUE, NULL); + g_object_set (gxml->fontbutton, "monospace", TRUE, nullptr); scheme = moo_lang_mgr_get_active_scheme (moo_lang_mgr_default ()); g_return_if_fail (scheme != NULL); @@ -407,7 +407,7 @@ scheme_combo_data_func (G_GNUC_UNUSED GtkCellLayout *layout, MooTextStyleScheme *scheme = NULL; gtk_tree_model_get (model, iter, 0, &scheme, -1); g_return_if_fail (scheme != NULL); - g_object_set (cell, "text", moo_text_style_scheme_get_name (scheme), NULL); + g_object_set (cell, "text", moo_text_style_scheme_get_name (scheme), nullptr); g_object_unref (scheme); } @@ -652,7 +652,7 @@ set_sensitive (G_GNUC_UNUSED GtkCellLayout *cell_layout, { g_object_set (cell, "sensitive", !gtk_tree_model_iter_has_child (model, iter), - NULL); + nullptr); } @@ -733,7 +733,7 @@ lang_combo_init (GtkComboBox *combo, gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, - "text", COLUMN_NAME, NULL); + "text", COLUMN_NAME, nullptr); gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), cell, set_sensitive, NULL, NULL); @@ -987,7 +987,7 @@ filter_icon_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column, { gboolean invalid; gtk_tree_model_get (model, iter, FILTER_COLUMN_INVALID, &invalid, -1); - g_object_set (cell, "visible", invalid, NULL); + g_object_set (cell, "visible", invalid, nullptr); } static void @@ -1006,7 +1006,7 @@ create_filter_column (GtkTreeView *treeview, if (column_id == FILTER_COLUMN_FILTER) { cell = gtk_cell_renderer_pixbuf_new (); - g_object_set (cell, "stock-id", GTK_STOCK_DIALOG_ERROR, NULL); + g_object_set (cell, "stock-id", GTK_STOCK_DIALOG_ERROR, nullptr); gtk_tree_view_column_pack_start (column, cell, FALSE); gtk_tree_view_column_set_cell_data_func (column, cell, (GtkTreeCellDataFunc) filter_icon_data_func, @@ -1015,9 +1015,9 @@ create_filter_column (GtkTreeView *treeview, cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); - gtk_tree_view_column_set_attributes (column, cell, "text", column_id, NULL); + gtk_tree_view_column_set_attributes (column, cell, "text", column_id, nullptr); - g_object_set (cell, "editable", TRUE, NULL); + g_object_set (cell, "editable", TRUE, nullptr); g_object_set_data (G_OBJECT (cell), "filter-store-column-id", GINT_TO_POINTER (column_id)); g_signal_connect (cell, "edited", G_CALLBACK (filter_cell_edited), store); } diff --git a/moo/mooedit/mooeditview.cpp b/moo/mooedit/mooeditview.cpp index de6edb24..70c2adf0 100644 --- a/moo/mooedit/mooeditview.cpp +++ b/moo/mooedit/mooeditview.cpp @@ -437,7 +437,7 @@ _moo_edit_view_ui_set_line_wrap (MooEditView *view, g_return_if_fail (MOO_IS_EDIT_VIEW (view)); g_return_if_fail (view->priv->doc && view->priv->doc->config); - g_object_get (view, "wrap-mode", &mode, NULL); + g_object_get (view, "wrap-mode", &mode, nullptr); enabled = enabled != 0; old_enabled = mode != GTK_WRAP_NONE; @@ -454,7 +454,7 @@ _moo_edit_view_ui_set_line_wrap (MooEditView *view, moo_edit_config_set (view->priv->doc->config, MOO_EDIT_CONFIG_SOURCE_USER, - "wrap-mode", mode, NULL); + "wrap-mode", mode, nullptr); } void @@ -466,7 +466,7 @@ _moo_edit_view_ui_set_show_line_numbers (MooEditView *view, g_return_if_fail (MOO_IS_EDIT_VIEW (view)); g_return_if_fail (view->priv->doc && view->priv->doc->config); - g_object_get (view, "show-line-numbers", &old_show, NULL); + g_object_get (view, "show-line-numbers", &old_show, nullptr); if (!old_show == !show) return; diff --git a/moo/mooedit/mooeditwindow.cpp b/moo/mooedit/mooeditwindow.cpp index c061e071..1f24f7b4 100644 --- a/moo/mooedit/mooeditwindow.cpp +++ b/moo/mooedit/mooeditwindow.cpp @@ -383,7 +383,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (MooEditWindowClass, will_close), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -392,7 +392,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (MooEditWindowClass, new_doc), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__OBJECT, G_TYPE_NONE, 1, MOO_TYPE_EDIT); @@ -402,7 +402,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (MooEditWindowClass, close_doc), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__OBJECT, G_TYPE_NONE, 1, MOO_TYPE_EDIT); @@ -412,7 +412,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (MooEditWindowClass, close_doc_after), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -425,25 +425,25 @@ moo_edit_window_class_init (MooEditWindowClass *klass) moo_window_class_set_id (window_class, "Editor", "Editor"); - moo_window_class_new_action (window_class, "NewDoc", NULL, + moo_window_class_new_action (window_class, "NewDoc", nullptr, "display-name", GTK_STOCK_NEW, "label", GTK_STOCK_NEW, "tooltip", _("Create new document"), "stock-id", GTK_STOCK_NEW, "default-accel", MOO_EDIT_ACCEL_NEW, "closure-callback", action_new_doc, - NULL); + nullptr); - moo_window_class_new_action (window_class, "Open", NULL, + moo_window_class_new_action (window_class, "Open", nullptr, "display-name", GTK_STOCK_OPEN, "label", _("_Open..."), "tooltip", _("Open..."), "stock-id", GTK_STOCK_OPEN, "default-accel", MOO_EDIT_ACCEL_OPEN, "closure-callback", action_open, - NULL); + nullptr); - moo_window_class_new_action (window_class, "Reload", NULL, + moo_window_class_new_action (window_class, "Reload", nullptr, "display-name", _("Reload"), "label", _("_Reload"), "tooltip", _("Reload document"), @@ -451,21 +451,21 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_RELOAD, "closure-callback", action_reload, "condition::sensitive", "can-reload", - NULL); + nullptr); - moo_window_class_new_action_custom (window_class, "ReopenWithEncoding", NULL, + moo_window_class_new_action_custom (window_class, "ReopenWithEncoding", nullptr, (MooWindowActionFunc) create_reopen_with_encoding_action, - NULL, NULL); + nullptr, nullptr); - moo_window_class_new_action_custom (window_class, "EncodingMenu", NULL, + moo_window_class_new_action_custom (window_class, "EncodingMenu", nullptr, (MooWindowActionFunc) create_doc_encoding_action, - NULL, NULL); + nullptr, nullptr); - moo_window_class_new_action_custom (window_class, "LineEndMenu", NULL, + moo_window_class_new_action_custom (window_class, "LineEndMenu", nullptr, (MooWindowActionFunc) create_doc_line_end_action, - NULL, NULL); + nullptr, nullptr); - moo_window_class_new_action (window_class, "Save", NULL, + moo_window_class_new_action (window_class, "Save", nullptr, "display-name", GTK_STOCK_SAVE, "label", GTK_STOCK_SAVE, "tooltip", GTK_STOCK_SAVE, @@ -473,9 +473,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_SAVE, "closure-callback", action_save, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "SaveAs", NULL, + moo_window_class_new_action (window_class, "SaveAs", nullptr, "display-name", GTK_STOCK_SAVE_AS, "label", _("Save _As..."), "tooltip", _("Save as..."), @@ -483,9 +483,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_SAVE_AS, "closure-callback", action_save_as, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Close", NULL, + moo_window_class_new_action (window_class, "Close", nullptr, "display-name", GTK_STOCK_CLOSE, "label", GTK_STOCK_CLOSE, "tooltip", _("Close document"), @@ -493,18 +493,18 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_CLOSE, "closure-callback", action_close_tab, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "CloseAll", NULL, + moo_window_class_new_action (window_class, "CloseAll", nullptr, "display-name", _("Close All"), "label", _("Close A_ll"), "tooltip", _("Close all documents"), "default-accel", MOO_EDIT_ACCEL_CLOSE_ALL, "closure-callback", action_close_all, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "PreviousTab", NULL, + moo_window_class_new_action (window_class, "PreviousTab", nullptr, "display-name", _("Previous Tab"), "label", _("_Previous Tab"), "tooltip", _("Previous tab"), @@ -512,9 +512,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_PREV_TAB, "closure-callback", action_previous_tab, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "NextTab", NULL, + moo_window_class_new_action (window_class, "NextTab", nullptr, "display-name", _("Next Tab"), "label", _("_Next Tab"), "tooltip", _("Next tab"), @@ -522,27 +522,27 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", MOO_EDIT_ACCEL_NEXT_TAB, "closure-callback", action_next_tab, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "PreviousTabInView", NULL, + moo_window_class_new_action (window_class, "PreviousTabInView", nullptr, "display-name", _("Previous Tab In View"), "label", _("_Previous Tab In View"), "tooltip", _("Previous tab in view"), "default-accel", MOO_EDIT_ACCEL_PREV_TAB_IN_VIEW, "closure-callback", action_previous_tab_in_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "NextTabInView", NULL, + moo_window_class_new_action (window_class, "NextTabInView", nullptr, "display-name", _("Next Tab In View"), "label", _("_Next Tab In View"), "tooltip", _("Next tab in view"), "default-accel", MOO_EDIT_ACCEL_NEXT_TAB_IN_VIEW, "closure-callback", action_next_tab_in_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Find", NULL, + moo_window_class_new_action (window_class, "Find", nullptr, "display-name", GTK_STOCK_FIND, "label", GTK_STOCK_FIND, "tooltip", GTK_STOCK_FIND, @@ -551,9 +551,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-signal", "find-interactive", "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FindNext", NULL, + moo_window_class_new_action (window_class, "FindNext", nullptr, "display-name", _("Find Next"), "label", _("Find _Next"), "tooltip", _("Find next"), @@ -562,9 +562,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-signal", "find-next-interactive", "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FindPrevious", NULL, + moo_window_class_new_action (window_class, "FindPrevious", nullptr, "display-name", _("Find Previous"), "label", _("Find _Previous"), "tooltip", _("Find previous"), @@ -573,9 +573,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-signal", "find-prev-interactive", "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Replace", NULL, + moo_window_class_new_action (window_class, "Replace", nullptr, "display-name", GTK_STOCK_FIND_AND_REPLACE, "label", GTK_STOCK_FIND_AND_REPLACE, "tooltip", GTK_STOCK_FIND_AND_REPLACE, @@ -584,27 +584,27 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-signal", "replace-interactive", "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FindCurrent", NULL, + moo_window_class_new_action (window_class, "FindCurrent", nullptr, "display-name", _("Find Current Word"), "label", _("Find Current _Word"), "stock-id", GTK_STOCK_FIND, "default-accel", MOO_EDIT_ACCEL_FIND_CURRENT, "closure-callback", action_find_now_f, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FindCurrentBack", NULL, + moo_window_class_new_action (window_class, "FindCurrentBack", nullptr, "display-name", _("Find Current Word Backwards"), "label", _("Find Current Word _Backwards"), "stock-id", GTK_STOCK_FIND, "default-accel", MOO_EDIT_ACCEL_FIND_CURRENT_BACK, "closure-callback", action_find_now_b, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "GoToLine", NULL, + moo_window_class_new_action (window_class, "GoToLine", nullptr, "display-name", _("Go to Line"), "label", _("_Go to Line..."), "tooltip", _("Go to line..."), @@ -612,72 +612,72 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-signal", "goto-line-interactive", "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "WrapText", NULL, + moo_window_class_new_action (window_class, "WrapText", nullptr, "action-type::", MOO_TYPE_TOGGLE_ACTION, "display-name", _("Toggle Text Wrapping"), "label", _("_Wrap Text"), "toggled-callback", wrap_text_toggled, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "LineNumbers", NULL, + moo_window_class_new_action (window_class, "LineNumbers", nullptr, "action-type::", MOO_TYPE_TOGGLE_ACTION, "display-name", _("Toggle Line Numbers Display"), "label", _("Show _Line Numbers"), "toggled-callback", line_numbers_toggled, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FocusDoc", NULL, + moo_window_class_new_action (window_class, "FocusDoc", nullptr, "display-name", _("Focus Document"), "label", _("_Focus Document"), "default-accel", MOO_EDIT_ACCEL_FOCUS_DOC, "closure-callback", action_focus_doc, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "FocusOtherSplitNotebook", NULL, + moo_window_class_new_action (window_class, "FocusOtherSplitNotebook", nullptr, "display-name", _("Focus Other Split Notebook"), "label", _("Focus Other Split Notebook"), "default-accel", MOO_EDIT_ACCEL_FOCUS_SPLIT_NOTEBOOK, "closure-callback", action_focus_other_split_notebook, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "MoveToSplitView", NULL, + moo_window_class_new_action (window_class, "MoveToSplitView", nullptr, "display-name", _("Move to Split Notebook"), "label", _("_Move to Split Notebook"), "default-accel", MOO_EDIT_ACCEL_MOVE_TO_SPLIT_NOTEBOOK, "closure-callback", action_move_to_split_notebook, "condition::sensitive", "can-move-to-split-notebook", - NULL); + nullptr); - moo_window_class_new_action (window_class, "SplitViewHorizontal", NULL, + moo_window_class_new_action (window_class, "SplitViewHorizontal", nullptr, "action-type::", MOO_TYPE_TOGGLE_ACTION, "display-name", _("Split View Horizontally"), "label", _("Split View Horizontally"), "toggled-callback", split_view_horizontal_toggled, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "SplitViewVertical", NULL, + moo_window_class_new_action (window_class, "SplitViewVertical", nullptr, "action-type::", MOO_TYPE_TOGGLE_ACTION, "display-name", _("Split View Vertically"), "label", _("Split View Vertically"), "toggled-callback", split_view_vertical_toggled, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "CycleSplitViews", NULL, + moo_window_class_new_action (window_class, "CycleSplitViews", nullptr, "display-name", _("Focus Next Split View"), "label", _("Focus Next Split View"), "closure-callback", action_focus_next_split_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, STOP_ACTION_ID, NULL, + moo_window_class_new_action (window_class, STOP_ACTION_ID, nullptr, "display-name", GTK_STOCK_STOP, "label", GTK_STOCK_STOP, "tooltip", GTK_STOCK_STOP, @@ -686,13 +686,13 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-callback", action_abort_jobs, "condition::sensitive", "has-jobs-running", "condition::visible", "has-stop-clients", - NULL); + nullptr); for (i = 1; i < 10; ++i) { char *action_id = g_strdup_printf (DOCUMENT_ACTION "%u", i); char *accel = g_strdup_printf (MOO_EDIT_ACCEL_SWITCH_TO_TAB "%u", i); - _moo_window_class_new_action_callback (window_class, action_id, NULL, + _moo_window_class_new_action_callback (window_class, action_id, nullptr, G_CALLBACK (action_switch_to_tab), _moo_marshal_VOID__UINT, G_TYPE_NONE, 1, @@ -700,7 +700,7 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "default-accel", accel, "connect-accel", TRUE, "accel-editable", FALSE, - NULL); + nullptr); g_free (accel); g_free (action_id); } @@ -708,39 +708,39 @@ moo_edit_window_class_init (MooEditWindowClass *klass) for (i = 1; i < 10; ++i) { char *action_id = g_strdup_printf (MOO_EDIT_GOTO_BOOKMARK_ACTION "%u", i); - moo_window_class_new_action_custom (window_class, action_id, NULL, + moo_window_class_new_action_custom (window_class, action_id, nullptr, create_goto_bookmark_action, GUINT_TO_POINTER (i), - NULL); + nullptr); g_free (action_id); } - moo_window_class_new_action (window_class, "ToggleBookmark", NULL, + moo_window_class_new_action (window_class, "ToggleBookmark", nullptr, "display-name", _("Toggle Bookmark"), "label", _("Toggle _Bookmark"), "stock-id", MOO_STOCK_EDIT_BOOKMARK, "default-accel", MOO_EDIT_ACCEL_BOOKMARK, "closure-callback", action_toggle_bookmark, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "NextBookmark", NULL, + moo_window_class_new_action (window_class, "NextBookmark", nullptr, "display-name", _("Next Bookmark"), "label", _("_Next Bookmark"), "default-accel", MOO_EDIT_ACCEL_NEXT_BOOKMARK, "connect-accel", TRUE, "closure-callback", action_next_bookmark, - NULL); + nullptr); - moo_window_class_new_action (window_class, "PreviousBookmark", NULL, + moo_window_class_new_action (window_class, "PreviousBookmark", nullptr, "display-name", _("Previous Bookmark"), "label", _("_Previous Bookmark"), "default-accel", MOO_EDIT_ACCEL_PREV_BOOKMARK, "connect-accel", TRUE, "closure-callback", action_prev_bookmark, - NULL); + nullptr); - moo_window_class_new_action (window_class, "Comment", NULL, + moo_window_class_new_action (window_class, "Comment", nullptr, /* action */ "display-name", _("Comment"), "label", _("Comment"), @@ -748,9 +748,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-callback", moo_edit_comment_selection, "closure-proxy-func", moo_edit_window_get_active_doc, "condition::sensitive", "has-comments", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Uncomment", NULL, + moo_window_class_new_action (window_class, "Uncomment", nullptr, /* action */ "display-name", _("Uncomment"), "label", _("Uncomment"), @@ -758,9 +758,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-callback", moo_edit_uncomment_selection, "closure-proxy-func", moo_edit_window_get_active_doc, "condition::sensitive", "has-comments", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Indent", NULL, + moo_window_class_new_action (window_class, "Indent", nullptr, "display-name", GTK_STOCK_INDENT, "label", GTK_STOCK_INDENT, "tooltip", GTK_STOCK_INDENT, @@ -768,9 +768,9 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-callback", moo_text_view_indent, "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Unindent", NULL, + moo_window_class_new_action (window_class, "Unindent", nullptr, "display-name", GTK_STOCK_UNINDENT, "label", GTK_STOCK_UNINDENT, "tooltip", GTK_STOCK_UNINDENT, @@ -778,35 +778,35 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "closure-callback", moo_text_view_unindent, "closure-proxy-func", moo_edit_window_get_active_view, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "NoDocuments", NULL, + moo_window_class_new_action (window_class, "NoDocuments", nullptr, /* Insensitive menu item which appears in Window menu with no documents open */ "label", _("No Documents"), "no-accel", TRUE, "sensitive", FALSE, "condition::visible", "!has-open-document", - NULL); + nullptr); #ifdef ENABLE_PRINTING - moo_window_class_new_action (window_class, "PageSetup", NULL, + moo_window_class_new_action (window_class, "PageSetup", nullptr, "display-name", _("Page Setup"), "label", _("Page S_etup..."), "tooltip", _("Page Setup..."), "default-accel", MOO_EDIT_ACCEL_PAGE_SETUP, "closure-callback", action_page_setup, - NULL); + nullptr); - moo_window_class_new_action (window_class, "PrintPreview", NULL, + moo_window_class_new_action (window_class, "PrintPreview", nullptr, "display-name", GTK_STOCK_PRINT_PREVIEW, "label", GTK_STOCK_PRINT_PREVIEW, "tooltip", GTK_STOCK_PRINT_PREVIEW, "stock-id", GTK_STOCK_PRINT_PREVIEW, "closure-callback", action_print_preview, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "Print", NULL, + moo_window_class_new_action (window_class, "Print", nullptr, "display-name", GTK_STOCK_PRINT, "label", _("Print..."), "tooltip", _("Print..."), @@ -814,21 +814,21 @@ moo_edit_window_class_init (MooEditWindowClass *klass) "stock-id", GTK_STOCK_PRINT, "closure-callback", action_print, "condition::sensitive", "has-open-document", - NULL); + nullptr); - moo_window_class_new_action (window_class, "PrintPdf", NULL, + moo_window_class_new_action (window_class, "PrintPdf", nullptr, "display-name", _("Export as PDF"), "label", _("E_xport as PDF..."), "tooltip", _("Export as PDF..."), "stock-id", GTK_STOCK_PRINT, "closure-callback", action_print_pdf, "condition::sensitive", "has-open-document", - NULL); + nullptr); #endif - moo_window_class_new_action_custom (window_class, LANG_ACTION_ID, NULL, + moo_window_class_new_action_custom (window_class, LANG_ACTION_ID, nullptr, (MooWindowActionFunc) create_lang_action, - NULL, NULL); + nullptr, nullptr); { GValue val = { 0 }; @@ -845,14 +845,14 @@ moo_edit_window_init (MooEditWindow *window) window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, MOO_TYPE_EDIT_WINDOW, MooEditWindowPrivate); new(window->priv) MooEditWindowPrivate; - window->priv->history = NULL; + window->priv->history = nullptr; window->priv->history_blocked = FALSE; window->priv->enable_history = TRUE; g_object_set (G_OBJECT (window), "menubar-ui-name", "Editor/Menubar", "toolbar-ui-name", "Editor/Toolbar", - NULL); + nullptr); set_title_format_from_prefs (window); @@ -866,7 +866,7 @@ moo_edit_window_init (MooEditWindow *window) MooEditor * moo_edit_window_get_editor (MooEditWindow *window) { - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); return window->priv->editor; } @@ -893,14 +893,14 @@ moo_edit_window_destroy (GtkObject *object) GSList *list, *l; moo_edit_window_abort_jobs (window); - g_slist_foreach (window->priv->jobs, (GFunc) g_free, NULL); + g_slist_foreach (window->priv->jobs, (GFunc) g_free, nullptr); g_slist_free (window->priv->jobs); - window->priv->jobs = NULL; + window->priv->jobs = nullptr; list = g_slist_copy (window->priv->stop_clients); - for (l = list; l != NULL; l = l->next) + for (l = list; l != nullptr; l = l->next) moo_edit_window_remove_stop_client (window, (GObject*) l->data); - g_assert (window->priv->stop_clients == NULL); + g_assert (window->priv->stop_clients == nullptr); g_slist_free (list); } @@ -977,13 +977,13 @@ static void moo_edit_window_get_property(GObject *object, break; case PROP_HAS_COMMENTS: doc = ACTIVE_DOC (window); - g_value_set_boolean (value, doc && _moo_edit_has_comments (doc, NULL, NULL)); + g_value_set_boolean (value, doc && _moo_edit_has_comments (doc, nullptr, nullptr)); break; case PROP_HAS_JOBS_RUNNING: - g_value_set_boolean (value, window->priv->jobs != NULL); + g_value_set_boolean (value, window->priv->jobs != nullptr); break; case PROP_HAS_STOP_CLIENTS: - g_value_set_boolean (value, window->priv->stop_clients != NULL); + g_value_set_boolean (value, window->priv->stop_clients != nullptr); break; default: @@ -1010,7 +1010,7 @@ moo_edit_window_constructor (GType type, G_OBJECT_CLASS(moo_edit_window_parent_class)->constructor (type, n_props, props); window = MOO_EDIT_WINDOW (object); - g_return_val_if_fail (window->priv->editor != NULL, object); + g_return_val_if_fail (window->priv->editor != nullptr, object); group = gtk_window_group_new (); gtk_window_group_add_window (group, GTK_WINDOW (window)); @@ -1031,7 +1031,7 @@ moo_edit_window_constructor (GType type, "show-tabs", TRUE, "enable-popup", TRUE, "enable-reordering", TRUE, - (const char*) NULL)); + (const char*) nullptr)); if (i == 0) gtk_widget_show (notebook); @@ -1048,11 +1048,11 @@ moo_edit_window_constructor (GType type, create_statusbar (window); - g_signal_connect (window, "realize", G_CALLBACK (update_window_title), NULL); + g_signal_connect (window, "realize", G_CALLBACK (update_window_title), nullptr); g_signal_connect (window, "notify::menubar", - G_CALLBACK (moo_edit_window_connect_menubar), NULL); + G_CALLBACK (moo_edit_window_connect_menubar), nullptr); - edit_changed (window, NULL); + edit_changed (window, nullptr); moo_edit_window_check_actions (window); return object; @@ -1122,7 +1122,7 @@ parse_title_format(const std::string& format, MooEdit *doc) { GString *str; - str = g_string_new (NULL); + str = g_string_new (nullptr); for (const char* p = format.c_str(); *p; ) { @@ -1205,7 +1205,7 @@ update_window_title (MooEditWindow *window) if (doc) title = parse_title_format (window->priv->title_format, doc); else - title = parse_title_format (window->priv->title_format_no_doc, NULL); + title = parse_title_format (window->priv->title_format_no_doc, nullptr); moo_window_set_title (MOO_WINDOW (window), title.c_str()); } @@ -1216,7 +1216,7 @@ check_format (const std::string& format) if (format.empty()) return DEFAULT_TITLE_FORMAT; - if (!g_utf8_validate (format.c_str(), -1, NULL)) + if (!g_utf8_validate (format.c_str(), -1, nullptr)) { g_critical ("window title format is not valid UTF8"); return DEFAULT_TITLE_FORMAT; @@ -1318,7 +1318,7 @@ action_open (MooEditWindow *window) MooEdit *active = moo_edit_window_get_active_doc (window); MooOpenInfoArray *files = _moo_edit_open_dialog (GTK_WIDGET (window), active); if (!moo_open_info_array_is_empty (files)) - moo_editor_open_files (window->priv->editor, files, GTK_WIDGET (window), NULL); + moo_editor_open_files (window->priv->editor, files, GTK_WIDGET (window), nullptr); moo_open_info_array_free (files); } @@ -1327,8 +1327,8 @@ static void action_reload (MooEditWindow *window) { MooEdit *doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); - moo_edit_reload (doc, NULL, NULL); + g_return_if_fail (doc != nullptr); + moo_edit_reload (doc, nullptr, nullptr); } @@ -1341,10 +1341,10 @@ reopen_encoding_item_activated (const char *encoding, MooReloadInfo *info; doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); info = moo_reload_info_new (encoding, -1); - moo_edit_reload (doc, info, NULL); + moo_edit_reload (doc, info, nullptr); } static GtkAction * @@ -1374,7 +1374,7 @@ update_doc_encoding_item (MooEditWindow *window) return; action = moo_window_get_action (MOO_WINDOW (window), "EncodingMenu"); - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); enc = moo_edit_get_encoding (doc); @@ -1392,7 +1392,7 @@ doc_encoding_item_activated (const char *encoding, MooEdit *doc; doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); moo_edit_set_encoding (doc, encoding); } @@ -1414,7 +1414,7 @@ create_doc_encoding_action (MooEditWindow *window) static const char *line_end_menu_items[] = { - NULL, /* MOO_LE_NONE */ + nullptr, /* MOO_LE_NONE */ "LineEndUnix", /* MOO_LE_UNIX */ "LineEndWin32", /* MOO_LE_WIN32 */ "LineEndMac", /* MOO_LE_MAC */ @@ -1431,7 +1431,7 @@ update_doc_line_end_item (MooEditWindow *window) return; action = moo_window_get_action (MOO_WINDOW (window), "LineEndMenu"); - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); le = moo_edit_get_line_end_type (doc); g_return_if_fail (le > 0 && le < G_N_ELEMENTS(line_end_menu_items)); @@ -1446,7 +1446,7 @@ doc_line_end_item_set_active (MooEditWindow *window, gpointer data) MooEdit *doc; doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); moo_edit_set_line_end_type (doc, (MooLineEndType) GPOINTER_TO_INT (data)); } @@ -1462,23 +1462,23 @@ create_doc_line_end_action (MooEditWindow *window) g_signal_connect_swapped (mgr, "radio-set-active", G_CALLBACK (doc_line_end_item_set_active), window); - moo_menu_mgr_append (mgr, NULL, + moo_menu_mgr_append (mgr, nullptr, line_end_menu_items[MOO_LE_WIN32], - _("_Windows (CR+LF)"), NULL, MOO_MENU_ITEM_RADIO, - GINT_TO_POINTER (MOO_LE_WIN32), NULL); - moo_menu_mgr_insert (mgr, NULL, + _("_Windows (CR+LF)"), nullptr, MOO_MENU_ITEM_RADIO, + GINT_TO_POINTER (MOO_LE_WIN32), nullptr); + moo_menu_mgr_insert (mgr, nullptr, #ifdef MOO_OS_WIN32 1, #else 0, #endif line_end_menu_items[MOO_LE_UNIX], - _("_Unix (LF)"), NULL, MOO_MENU_ITEM_RADIO, - GINT_TO_POINTER (MOO_LE_UNIX), NULL); - moo_menu_mgr_append (mgr, NULL, + _("_Unix (LF)"), nullptr, MOO_MENU_ITEM_RADIO, + GINT_TO_POINTER (MOO_LE_UNIX), nullptr); + moo_menu_mgr_append (mgr, nullptr, line_end_menu_items[MOO_LE_MAC], - _("_Mac (CR)"), NULL, MOO_MENU_ITEM_RADIO, - GINT_TO_POINTER (MOO_LE_MAC), NULL); + _("_Mac (CR)"), nullptr, MOO_MENU_ITEM_RADIO, + GINT_TO_POINTER (MOO_LE_MAC), nullptr); moo_bind_bool_property (action, "sensitive", window, "has-open-document", FALSE); @@ -1491,8 +1491,8 @@ static void action_save (MooEditWindow *window) { MooEdit *doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); - moo_editor_save (window->priv->editor, doc, NULL); + g_return_if_fail (doc != nullptr); + moo_editor_save (window->priv->editor, doc, nullptr); } @@ -1500,8 +1500,8 @@ static void action_save_as (MooEditWindow *window) { MooEdit *doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); - moo_editor_save_as (window->priv->editor, doc, NULL, NULL); + g_return_if_fail (doc != nullptr); + moo_editor_save_as (window->priv->editor, doc, nullptr, nullptr); } @@ -1509,7 +1509,7 @@ static void action_close_tab (MooEditWindow *window) { MooEdit *doc = ACTIVE_DOC (window); - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); moo_editor_close_doc (window->priv->editor, doc); } @@ -1641,7 +1641,7 @@ moo_edit_window_find_now (MooEditWindow *window, MooEditView *view; view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); g_signal_emit_by_name (view, "find-word-at-cursor", forward); } @@ -1666,7 +1666,7 @@ action_focus_doc (MooEditWindow *window) MooEditView *active_view; active_view = ACTIVE_VIEW (window); - g_return_if_fail (active_view != NULL); + g_return_if_fail (active_view != nullptr); if (!GTK_WIDGET_HAS_FOCUS (active_view)) { @@ -1724,7 +1724,7 @@ static void action_toggle_bookmark (MooEditWindow *window) { MooEditView *view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); moo_edit_toggle_bookmark (moo_edit_view_get_doc (view), moo_text_view_get_cursor_line (GTK_TEXT_VIEW (view))); } @@ -1738,7 +1738,7 @@ action_next_bookmark (MooEditWindow *window) MooEditView *view = ACTIVE_VIEW (window); MooEdit *doc = moo_edit_view_get_doc (view); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); cursor = moo_text_view_get_cursor_line (GTK_TEXT_VIEW (view)); bookmarks = moo_edit_get_bookmarks_in_range (doc, cursor + 1, -1); @@ -1755,11 +1755,11 @@ static void action_prev_bookmark (MooEditWindow *window) { int cursor; - GSList *bookmarks = NULL; + GSList *bookmarks = nullptr; MooEditView *view = ACTIVE_VIEW (window); MooEdit *doc = moo_edit_view_get_doc (view); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); cursor = moo_text_view_get_cursor_line (GTK_TEXT_VIEW (view)); @@ -1785,10 +1785,10 @@ goto_bookmark_activated (GtkAction *action, guint n = GPOINTER_TO_UINT (data); window = (MooEditWindow*) _moo_action_get_window (action); - g_return_if_fail (window != NULL); + g_return_if_fail (window != nullptr); view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); if ((bk = moo_edit_get_bookmark (moo_edit_view_get_doc (view), n))) moo_edit_view_goto_bookmark (view, bk); @@ -1808,7 +1808,7 @@ create_goto_bookmark_action (MooWindow *window, action = GTK_ACTION (g_object_new (MOO_TYPE_ACTION, "name", name, "default-accel", accel, "connect-accel", TRUE, "accel-editable", FALSE, - (const char*) NULL)); + (const char*) nullptr)); g_signal_connect (action, "activate", G_CALLBACK (goto_bookmark_activated), data); moo_bind_bool_property (action, "sensitive", window, "has-open-document", FALSE); @@ -1839,7 +1839,7 @@ create_bookmark_item (MooEditWindow *window, MooEditBookmark *bk) { char *label, *bk_text; - GtkWidget *item = NULL; + GtkWidget *item = nullptr; MooEdit *doc = moo_edit_view_get_doc (view); bk_text = _moo_edit_bookmark_get_text (bk); @@ -1857,7 +1857,7 @@ create_bookmark_item (MooEditWindow *window, if (action) { - g_object_set (action, "label", label, "use-underline", FALSE, NULL); + g_object_set (action, "label", label, "use-underline", FALSE, nullptr); item = gtk_action_create_menu_item (action); } else @@ -1871,7 +1871,7 @@ create_bookmark_item (MooEditWindow *window, if (!item) { item = gtk_menu_item_new_with_label (label); - g_signal_connect (item, "activate", G_CALLBACK (bookmark_item_activated), NULL); + g_signal_connect (item, "activate", G_CALLBACK (bookmark_item_activated), nullptr); } widget_bookmark.set(item, g::object_ref (bk), g_object_unref); @@ -1900,7 +1900,7 @@ populate_bookmark_menu (MooEditWindow *window, pos = g_list_index (children, next_bk_item); g_return_if_fail (pos >= 0); - for (l = g_list_nth (children, pos + 1); l != NULL; l = l->next) + for (l = g_list_nth (children, pos + 1); l != nullptr; l = l->next) { if (g_object_get_data ((GObject*) l->data, "moo-bookmark-menu-item")) gtk_container_remove (GTK_CONTAINER (menu), (GtkWidget*) l->data); @@ -1911,13 +1911,13 @@ populate_bookmark_menu (MooEditWindow *window, g_list_free (children); view = ACTIVE_VIEW (window); - doc = view ? moo_edit_view_get_doc (view) : NULL; - bookmarks = doc ? moo_edit_list_bookmarks (doc) : NULL; + doc = view ? moo_edit_view_get_doc (view) : nullptr; + bookmarks = doc ? moo_edit_list_bookmarks (doc) : nullptr; pn = moo_window_get_action (MOO_WINDOW (window), "PreviousBookmark"); - gtk_action_set_sensitive (pn, bookmarks != NULL); + gtk_action_set_sensitive (pn, bookmarks != nullptr); pn = moo_window_get_action (MOO_WINDOW (window), "NextBookmark"); - gtk_action_set_sensitive (pn, bookmarks != NULL); + gtk_action_set_sensitive (pn, bookmarks != nullptr); if (bookmarks) { @@ -1948,7 +1948,7 @@ doc_item_selected (MooWindow *window, next_bk_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window), window->menubar, "Editor/Menubar/Document/NextBookmark"); - g_return_if_fail (menu != NULL && next_bk_item != NULL); + g_return_if_fail (menu != nullptr && next_bk_item != nullptr); populate_bookmark_menu (MOO_EDIT_WINDOW (window), menu, next_bk_item); } @@ -1966,7 +1966,7 @@ moo_edit_window_connect_menubar (MooWindow *window) doc_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window), window->menubar, "Editor/Menubar/Document"); - g_return_if_fail (doc_item != NULL); + g_return_if_fail (doc_item != nullptr); g_signal_connect_swapped (doc_item, "select", G_CALLBACK (doc_item_selected), window); @@ -1974,7 +1974,7 @@ moo_edit_window_connect_menubar (MooWindow *window) win_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window), window->menubar, "Editor/Menubar/Window"); - g_return_if_fail (win_item != NULL); + g_return_if_fail (win_item != nullptr); g_signal_connect_swapped (win_item, "select", G_CALLBACK (window_menu_item_selected), window); @@ -1993,7 +1993,7 @@ static void action_print (MooEditWindow *window) { MooEditView *view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); _moo_edit_print (GTK_TEXT_VIEW (view), GTK_WIDGET (window)); } @@ -2002,7 +2002,7 @@ static void action_print_preview (MooEditWindow *window) { MooEditView *view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); _moo_edit_print_preview (GTK_TEXT_VIEW (view), GTK_WIDGET (window)); } @@ -2014,9 +2014,9 @@ action_print_pdf (MooEditWindow *window) const char *doc_name, *dot; const char *filename; MooEditView *view = ACTIVE_VIEW (window); - MooEdit *doc = view ? moo_edit_view_get_doc (view) : NULL; + MooEdit *doc = view ? moo_edit_view_get_doc (view) : nullptr; - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); doc_name = doc ? moo_edit_get_display_basename (doc) : "output"; dot = strrchr (doc_name, '.'); @@ -2037,7 +2037,7 @@ action_print_pdf (MooEditWindow *window) start_name, _("Export as PDF"), moo_edit_setting (MOO_EDIT_PREFS_PDF_LAST_DIR), - NULL); + nullptr); if (filename) _moo_edit_export_pdf (GTK_TEXT_VIEW (view), filename); @@ -2052,7 +2052,7 @@ wrap_text_toggled (MooEditWindow *window, gboolean active) { MooEditView *view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); _moo_edit_view_ui_set_line_wrap (view, active); } @@ -2062,7 +2062,7 @@ line_numbers_toggled (MooEditWindow *window, gboolean active) { MooEditView *view = ACTIVE_VIEW (window); - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); _moo_edit_view_ui_set_show_line_numbers (view, active); } @@ -2111,7 +2111,7 @@ detach_activated (GtkWidget *item, g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); g_return_if_fail (MOO_IS_EDIT (doc)); - _moo_editor_move_doc (window->priv->editor, doc, NULL, NULL, TRUE); + _moo_editor_move_doc (window->priv->editor, doc, nullptr, nullptr, TRUE); } @@ -2126,7 +2126,7 @@ move_to_split_notebook_activated (GtkWidget *item, static void copy_full_path_activated (GtkWidget *item, - MooEditWindow *window) + G_GNUC_UNUSED MooEditWindow *window) { MooEdit *doc = widget_doc.get(item); GtkClipboard *clipboard = gtk_widget_get_clipboard(item, GDK_SELECTION_CLIPBOARD); @@ -2135,8 +2135,8 @@ copy_full_path_activated (GtkWidget *item, static void -open_containing_folder_activated (GtkWidget *item, - MooEditWindow *window) +open_containing_folder_activated (G_GNUC_UNUSED GtkWidget *item, + G_GNUC_UNUSED MooEditWindow *window) { } @@ -2207,7 +2207,7 @@ move_tab_to_split_view (MooEditWindow *window, g_object_ref (tab); - window->priv->active_tab = NULL; + window->priv->active_tab = nullptr; gtk_container_remove (GTK_CONTAINER (old_nb), GTK_WIDGET (tab)); label = create_tab_label (window, tab, doc); @@ -2271,7 +2271,7 @@ add_separator (GtkMenu *menu) gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(g_object_new(GTK_TYPE_SEPARATOR_MENU_ITEM, "visible", TRUE, - (const char*) NULL))); + (const char*) nullptr))); } static gboolean @@ -2367,9 +2367,9 @@ set_use_tabs (MooEditWindow *window, MooNotebook *notebook) { g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); - g_return_if_fail (notebook != NULL); + g_return_if_fail (notebook != nullptr); g_object_set (notebook, "show-tabs", - moo_prefs_get_bool (moo_edit_setting (MOO_EDIT_PREFS_USE_TABS)), NULL); + moo_prefs_get_bool (moo_edit_setting (MOO_EDIT_PREFS_USE_TABS)), nullptr); } void @@ -2388,7 +2388,7 @@ static MooNotebook * get_notebook (MooEditWindow *window, int i) { - g_return_val_if_fail (i >= 0 && i < (int) window->priv->notebooks.size(), NULL); + g_return_val_if_fail (i >= 0 && i < (int) window->priv->notebooks.size(), nullptr); return window->priv->notebooks[i].get(); } @@ -2398,12 +2398,12 @@ get_notebook_active_view (MooNotebook *notebook) GtkWidget *tab; int page; - g_return_val_if_fail (notebook != NULL, NULL); + g_return_val_if_fail (notebook != nullptr, nullptr); page = moo_notebook_get_current_page (notebook); if (page < 0) - return NULL; + return nullptr; tab = moo_notebook_get_nth_page (notebook, page); return moo_edit_tab_get_active_view (MOO_EDIT_TAB (tab)); @@ -2413,7 +2413,7 @@ static MooEdit * get_notebook_active_doc (MooNotebook *notebook) { MooEditView *view = get_notebook_active_view (notebook); - return view ? moo_edit_view_get_doc (view) : NULL; + return view ? moo_edit_view_get_doc (view) : nullptr; } static MooNotebook * @@ -2424,8 +2424,8 @@ get_active_notebook (MooEditWindow *window) nb1 = get_notebook (window, 0); nb2 = get_notebook (window, 1); - g_return_val_if_fail (nb2 != NULL, nb1); - g_return_val_if_fail (nb1 != NULL, nb2); + g_return_val_if_fail (nb2 != nullptr, nb1); + g_return_val_if_fail (nb1 != nullptr, nb2); if (!GTK_WIDGET_VISIBLE (nb2)) return nb1; @@ -2485,7 +2485,7 @@ notebook_close_button_clicked (GtkWidget *button, MooEditWindow *window) { MooNotebook *notebook = data_notebook.get(button); - g_return_if_fail (notebook != NULL); + g_return_if_fail (notebook != nullptr); moo_editor_close_doc (window->priv->editor, get_notebook_active_doc (notebook)); } @@ -2504,7 +2504,7 @@ setup_notebook (MooEditWindow *window, g_signal_connect (notebook, "button-press-event", G_CALLBACK (notebook_button_press), window); - frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); + frame = gtk_aspect_frame_new (nullptr, 0.5, 0.5, 1.0, FALSE); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); button = gtk_button_new (); @@ -2621,9 +2621,9 @@ view_wrap_mode_changed (MooEditWindow *window, return; action = moo_window_get_action (MOO_WINDOW (window), "WrapText"); - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); - g_object_get (view, "wrap-mode", &mode, NULL); + g_object_get (view, "wrap-mode", &mode, nullptr); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), mode != GTK_WRAP_NONE); /* XXX menu item and action go out of sync for some reason */ @@ -2643,9 +2643,9 @@ view_show_line_numbers_changed (MooEditWindow *window, return; action = moo_window_get_action (MOO_WINDOW (window), "LineNumbers"); - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); - g_object_get (view, "show-line-numbers", &show, NULL); + g_object_get (view, "show-line-numbers", &show, nullptr); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show); /* XXX menu item and action go out of sync for some reason */ @@ -2663,8 +2663,8 @@ update_doc_view_actions (MooEditWindow *window) if (!view) return; - view_wrap_mode_changed (window, NULL, view); - view_show_line_numbers_changed (window, NULL, view); + view_wrap_mode_changed (window, nullptr, view); + view_show_line_numbers_changed (window, nullptr, view); } @@ -2694,7 +2694,7 @@ MooEdit * moo_edit_window_get_active_doc (MooEditWindow *window) { MooEditView *view = moo_edit_window_get_active_view (window); - return view ? moo_edit_view_get_doc (view) : NULL; + return view ? moo_edit_view_get_doc (view) : nullptr; } /** @@ -2704,7 +2704,7 @@ MooEditView * moo_edit_window_get_active_view (MooEditWindow *window) { MooEditTab *tab = moo_edit_window_get_active_tab (window); - return tab ? moo_edit_tab_get_active_view (tab) : NULL; + return tab ? moo_edit_tab_get_active_view (tab) : nullptr; } /** @@ -2713,10 +2713,10 @@ moo_edit_window_get_active_view (MooEditWindow *window) MooEditTab * moo_edit_window_get_active_tab (MooEditWindow *window) { - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); if (window->priv->notebooks.empty()) - return NULL; + return nullptr; if (!window->priv->active_tab) { @@ -2724,12 +2724,12 @@ moo_edit_window_get_active_tab (MooEditWindow *window) int page; MooNotebook *notebook = get_active_notebook (window); - g_return_val_if_fail (notebook != NULL, NULL); + g_return_val_if_fail (notebook != nullptr, nullptr); page = moo_notebook_get_current_page (notebook); if (page < 0) - return NULL; + return nullptr; tab = moo_notebook_get_nth_page (notebook, page); window->priv->active_tab = MOO_EDIT_TAB (tab); @@ -2758,7 +2758,7 @@ moo_edit_window_set_active_doc (MooEditWindow *window, guint i; MooEditViewArray *views; - view = NULL; + view = nullptr; views = moo_edit_get_views (doc); for (i = 0; i < moo_edit_view_array_get_size (views); ++i) @@ -2774,7 +2774,7 @@ moo_edit_window_set_active_doc (MooEditWindow *window, moo_edit_view_array_free (views); } - g_return_if_fail (view != NULL); + g_return_if_fail (view != nullptr); moo_edit_window_set_active_view (window, view); } @@ -2787,7 +2787,7 @@ moo_edit_window_set_active_view (MooEditWindow *window, MooEditView *view) { int page; - MooNotebook *notebook = NULL; + MooNotebook *notebook = nullptr; g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); g_return_if_fail (MOO_IS_EDIT_VIEW (view)); @@ -2824,10 +2824,10 @@ moo_edit_window_get_docs (MooEditWindow *window) MooEditArray *docs; guint i; - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); tabs = moo_edit_window_get_tabs (window); - g_return_val_if_fail (tabs != NULL, NULL); + g_return_val_if_fail (tabs != nullptr, nullptr); docs = moo_edit_array_new (); @@ -2853,7 +2853,7 @@ moo_edit_window_get_views (MooEditWindow *window) int inb; MooEditViewArray *views; - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); views = moo_edit_view_array_new (); @@ -2885,7 +2885,7 @@ moo_edit_window_get_tabs (MooEditWindow *window) int inb; MooEditTabArray *tabs; - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); tabs = moo_edit_tab_array_new (); @@ -2924,7 +2924,7 @@ get_nth_doc (MooNotebook *notebook, guint n) { MooEditTab *tab = get_nth_tab (*notebook, n); - return tab ? moo_edit_tab_get_doc (tab) : NULL; + return tab ? moo_edit_tab_get_doc (tab) : nullptr; } static MooEditTab * @@ -2932,7 +2932,7 @@ get_nth_tab (MooNotebook ¬ebook, guint n) { GtkWidget *tab = moo_notebook_get_nth_page (¬ebook, n); - return tab ? MOO_EDIT_TAB (tab) : NULL; + return tab ? MOO_EDIT_TAB (tab) : nullptr; } static int @@ -2941,7 +2941,7 @@ get_active_tab (MooEditWindow *window) int tab = 0; MooNotebook *notebook = get_active_notebook (window); - g_return_val_if_fail (notebook != NULL, -1); + g_return_val_if_fail (notebook != nullptr, -1); for (const auto& nb: window->priv->notebooks) { @@ -2983,7 +2983,7 @@ get_view_page_num (MooEditWindow *window, } if (pnotebook) - *pnotebook = NULL; + *pnotebook = nullptr; return -1; } @@ -3068,7 +3068,7 @@ _moo_edit_window_insert_tab (MooEditWindow *window, GtkWidget *label; MooEdit *doc; MooEditViewArray *views; - MooNotebook *notebook = NULL; + MooNotebook *notebook = nullptr; int page = -1; guint i; @@ -3141,7 +3141,7 @@ _moo_edit_window_remove_doc (MooEditWindow *window, MooEditView *new_view; MooEditViewArray *views; gboolean had_focus = FALSE; - MooNotebook *notebook = NULL; + MooNotebook *notebook = nullptr; MooEditTab *tab; guint i; @@ -3155,10 +3155,10 @@ _moo_edit_window_remove_doc (MooEditWindow *window, g_return_if_fail (moo_edit_view_array_get_size (views) > 0); page = get_view_page_num (window, views->elms[0], ¬ebook); - g_return_if_fail (notebook != NULL && page >= 0); + g_return_if_fail (notebook != nullptr && page >= 0); if (tab == window->priv->active_tab) - window->priv->active_tab = NULL; + window->priv->active_tab = nullptr; for (i = 0; i < views->n_elms; ++i) { @@ -3206,7 +3206,7 @@ _moo_edit_window_remove_doc (MooEditWindow *window, moo_edit_window_set_active_doc (window, (MooEdit*) window->priv->history->data); } - edit_changed (window, NULL); + edit_changed (window, nullptr); g_signal_emit (window, signals[CLOSE_DOC_AFTER], 0); @@ -3292,7 +3292,7 @@ tab_icon_start_drag (GtkWidget *evbox, g_signal_connect (evbox, "drag-data-get", G_CALLBACK (tab_icon_drag_data_get), window); g_signal_connect (evbox, "drag-end", G_CALLBACK (tab_icon_drag_end), window); - targets = gtk_target_list_new (NULL, 0); + targets = gtk_target_list_new (nullptr, 0); gtk_target_list_add (targets, moo_atom_uri_list (), @@ -3318,7 +3318,7 @@ tab_icon_motion_notify (GtkWidget *evbox, DragInfo *info; info = data_drag_info.get(evbox); - g_return_val_if_fail (info != NULL, FALSE); + g_return_val_if_fail (info != nullptr, FALSE); if (info->drag_started) return TRUE; @@ -3469,7 +3469,7 @@ create_tab_label (MooEditWindow *window, } } - frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, FALSE); + frame = gtk_aspect_frame_new (nullptr, 0.5, 0.5, 1.0, FALSE); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); button = gtk_button_new (); @@ -3545,7 +3545,7 @@ update_tab_label (MooEditTab *tab, MooEdit *doc; doc = moo_edit_tab_get_doc (tab); - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); hbox = moo_notebook_get_tab_label (¬ebook, GTK_WIDGET (tab)); g_return_if_fail (GTK_IS_WIDGET (hbox)); @@ -3626,7 +3626,7 @@ save_paned_config (MooEditWindow *window) const char *old_config; config = moo_big_paned_get_config (window->paned); - g_return_if_fail (config != NULL); + g_return_if_fail (config != nullptr); old_config = moo_prefs_get_string (MOO_EDIT_PREFS_PREFIX "/window/paned"); @@ -3645,7 +3645,7 @@ create_paned (MooEditWindow *window) paned = MOO_BIG_PANED (g_object_new (MOO_TYPE_BIG_PANED, "handle-cursor-type", GDK_FLEUR, "enable-detaching", TRUE, - (const char*) NULL)); + (const char*) nullptr)); gtk_widget_show (GTK_WIDGET (paned)); gtk_box_pack_start (GTK_BOX (MOO_WINDOW(window)->vbox), GTK_WIDGET (paned), TRUE, TRUE, 0); @@ -3653,7 +3653,7 @@ create_paned (MooEditWindow *window) window->paned = paned; moo_prefs_create_key (MOO_EDIT_PREFS_PREFIX "/window/paned", - MOO_PREFS_STATE, G_TYPE_STRING, NULL); + MOO_PREFS_STATE, G_TYPE_STRING, nullptr); config = moo_prefs_get_string (MOO_EDIT_PREFS_PREFIX "/window/paned"); if (config) @@ -3695,7 +3695,7 @@ add_pane_action (MooEditWindow *window, { guint merge_id; - _moo_window_class_new_action_callback (klass, action_id, NULL, + _moo_window_class_new_action_callback (klass, action_id, nullptr, G_CALLBACK (show_pane_callback), _moo_marshal_VOID__STRING, G_TYPE_NONE, 1, @@ -3705,7 +3705,7 @@ add_pane_action (MooEditWindow *window, "label", label->label, /* XXX IconInfo */ "stock-id", label->icon_stock_id, - NULL); + nullptr); xml = moo_editor_get_ui_xml (moo_editor_instance ()); merge_id = moo_ui_xml_new_merge_id (xml); @@ -3715,8 +3715,8 @@ add_pane_action (MooEditWindow *window, } action = moo_window_get_action (MOO_WINDOW (window), action_id); - g_return_if_fail (action != NULL); - g_object_set (action, "visible", TRUE, NULL); + g_return_if_fail (action != nullptr); + g_object_set (action, "visible", TRUE, nullptr); g_free (action_id); } @@ -3732,7 +3732,7 @@ remove_pane_action (MooEditWindow *window, action = moo_window_get_action (MOO_WINDOW (window), action_id); if (action) - g_object_set (action, "visible", FALSE, NULL); + g_object_set (action, "visible", FALSE, nullptr); #if 0 klass = g_type_class_peek (MOO_TYPE_EDIT_WINDOW); @@ -3754,18 +3754,18 @@ moo_edit_window_add_pane_full (MooEditWindow *window, { MooPane *pane; - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); - g_return_val_if_fail (user_id != NULL, NULL); - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - g_return_val_if_fail (label != NULL, NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); + g_return_val_if_fail (user_id != nullptr, nullptr); + g_return_val_if_fail (GTK_IS_WIDGET (widget), nullptr); + g_return_val_if_fail (label != nullptr, nullptr); - g_return_val_if_fail (moo_edit_window_get_pane (window, user_id) == NULL, NULL); + g_return_val_if_fail (moo_edit_window_get_pane (window, user_id) == nullptr, nullptr); g_object_ref_sink (widget); pane = moo_big_paned_insert_pane (window->paned, widget, user_id, label, position, -1); - if (pane != NULL) + if (pane != nullptr) { moo_pane_set_removable (pane, FALSE); @@ -3811,7 +3811,7 @@ moo_edit_window_remove_pane (MooEditWindow *window, MooPane *pane; g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), FALSE); - g_return_val_if_fail (user_id != NULL, FALSE); + g_return_val_if_fail (user_id != nullptr, FALSE); remove_pane_action (window, user_id); @@ -3838,7 +3838,7 @@ moo_edit_window_show_pane (MooEditWindow *window, g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); pane = moo_edit_window_get_pane (window, user_id); - g_return_if_fail (pane != NULL); + g_return_if_fail (pane != nullptr); moo_big_paned_present_pane (window->paned, pane); } @@ -3856,11 +3856,11 @@ moo_edit_window_get_pane (MooEditWindow *window, { MooPane *pane; - g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL); - g_return_val_if_fail (user_id != NULL, NULL); + g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), nullptr); + g_return_val_if_fail (user_id != nullptr, nullptr); pane = moo_big_paned_lookup_pane (window->paned, user_id); - return pane ? moo_pane_get_child (pane) : NULL; + return pane ? moo_pane_get_child (pane) : nullptr; } @@ -3950,8 +3950,8 @@ update_statusbar (MooEditWindow *window) window->priv->statusbar_idle = g_idle_add_full (G_PRIORITY_HIGH, (GSourceFunc) update_statusbar_idle, - window, NULL); - moo_window_message (MOO_WINDOW (window), NULL); + window, nullptr); + moo_window_message (MOO_WINDOW (window), nullptr); } static void @@ -3966,7 +3966,7 @@ create_statusbar (MooEditWindow *window) "pack-type", GTK_PACK_END, "expand", FALSE, "fill", FALSE, - NULL); + nullptr); window->priv->cursor_label = xml->cursor; window->priv->chars_label = xml->chars; @@ -3996,7 +3996,7 @@ lang_item_activated (MooEditWindow *window, const char *old_val; gboolean do_set = FALSE; - g_return_if_fail (doc != NULL); + g_return_if_fail (doc != nullptr); g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); old_val = moo_edit_config_get_string (doc->config, "lang"); @@ -4008,7 +4008,7 @@ lang_item_activated (MooEditWindow *window, if (do_set) moo_edit_config_set (doc->config, MOO_EDIT_CONFIG_SOURCE_USER, - "lang", lang_name, NULL); + "lang", lang_name, nullptr); } @@ -4032,24 +4032,24 @@ create_lang_action (MooEditWindow *window) action = moo_menu_action_new (LANG_ACTION_ID, _("_Language")); menu_mgr = moo_menu_action_get_mgr (MOO_MENU_ACTION (action)); - moo_menu_mgr_append (menu_mgr, NULL, + moo_menu_mgr_append (menu_mgr, nullptr, /* Menu item in the Language menu */ - MOO_LANG_NONE, Q_("Language|None"), NULL, - MOO_MENU_ITEM_RADIO, NULL, NULL); + MOO_LANG_NONE, Q_("Language|None"), nullptr, + MOO_MENU_ITEM_RADIO, nullptr, nullptr); - for (l = sections; l != NULL; l = l->next) - moo_menu_mgr_append (menu_mgr, NULL, - (const char*) l->data, (const char*) l->data, NULL, - MOO_MENU_ITEM_FLAGS_NONE, NULL, NULL); + for (l = sections; l != nullptr; l = l->next) + moo_menu_mgr_append (menu_mgr, nullptr, + (const char*) l->data, (const char*) l->data, nullptr, + MOO_MENU_ITEM_FLAGS_NONE, nullptr, nullptr); - for (l = langs; l != NULL; l = l->next) + for (l = langs; l != nullptr; l = l->next) { MooLang *lang = (MooLang*) l->data; if (!_moo_lang_get_hidden (lang)) moo_menu_mgr_append (menu_mgr, _moo_lang_get_section (lang), _moo_lang_id (lang), _moo_lang_display_name (lang), - NULL, MOO_MENU_ITEM_RADIO, + nullptr, MOO_MENU_ITEM_RADIO, g_strdup (_moo_lang_id (lang)), g_free); } @@ -4057,9 +4057,9 @@ create_lang_action (MooEditWindow *window) g_signal_connect_swapped (menu_mgr, "radio-set-active", G_CALLBACK (lang_item_activated), window); - g_slist_foreach (langs, (GFunc) g_object_unref, NULL); + g_slist_foreach (langs, (GFunc) g_object_unref, nullptr); g_slist_free (langs); - g_slist_foreach (sections, (GFunc) g_free, NULL); + g_slist_foreach (sections, (GFunc) g_free, nullptr); g_slist_free (sections); moo_bind_bool_property (action, "sensitive", window, "has-open-document", FALSE); @@ -4081,7 +4081,7 @@ update_lang_menu (MooEditWindow *window) lang = moo_text_view_get_lang (MOO_TEXT_VIEW (view)); action = moo_window_get_action (MOO_WINDOW (window), LANG_ACTION_ID); - g_return_if_fail (action != NULL); + g_return_if_fail (action != nullptr); moo_menu_mgr_set_active (moo_menu_action_get_mgr (MOO_MENU_ACTION (action)), _moo_lang_id (lang), TRUE); @@ -4142,7 +4142,7 @@ window_check_one_action (const char *action_id, sensitive = func (action, window, doc, data); } - g_object_set (action, "visible", visible, "sensitive", sensitive, NULL); + g_object_set (action, "visible", visible, "sensitive", sensitive, nullptr); } @@ -4186,9 +4186,9 @@ moo_edit_window_set_action_check (const char *action_id, { ActionCheck *check; - g_return_if_fail (action_id != NULL); + g_return_if_fail (action_id != nullptr); g_return_if_fail (type < N_ACTION_CHECKS); - g_return_if_fail (func != NULL); + g_return_if_fail (func != nullptr); action_checks_init (); @@ -4202,7 +4202,7 @@ moo_edit_window_set_action_check (const char *action_id, if (check->checks[type].func) { - check->checks[type].func = NULL; + check->checks[type].func = nullptr; if (check->checks[type].notify) check->checks[type].notify (check->checks[type].data); @@ -4228,7 +4228,7 @@ moo_edit_window_remove_action_check (const char *action_id, gboolean remove = TRUE; guint i; - g_return_if_fail (action_id != NULL); + g_return_if_fail (action_id != nullptr); g_return_if_fail (type <= N_ACTION_CHECKS); if (!action_checks) @@ -4252,7 +4252,7 @@ moo_edit_window_remove_action_check (const char *action_id, if (!remove && check->checks[type].func && check->checks[type].notify) { - check->checks[type].func = NULL; + check->checks[type].func = nullptr; check->checks[type].notify (check->checks[type].data); } } @@ -4296,9 +4296,9 @@ moo_edit_window_set_action_filter (const char *action_id, MooActionCheckType type, const char *filter_string) { - MooEditFilter *filter = NULL; + MooEditFilter *filter = nullptr; - g_return_if_fail (action_id != NULL); + g_return_if_fail (action_id != nullptr); g_return_if_fail (type < N_ACTION_CHECKS); if (filter_string && filter_string[0]) @@ -4319,7 +4319,7 @@ action_checks_init (void) { if (!action_checks) action_checks = - g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nullptr); } @@ -4413,7 +4413,7 @@ moo_edit_window_add_stop_client (MooEditWindow *window, g_return_if_fail (query.n_params == 0); #undef REAL_TYPE - had_clients = window->priv->stop_clients != NULL; + had_clients = window->priv->stop_clients != nullptr; window->priv->stop_clients = g_slist_prepend (window->priv->stop_clients, client); g_object_weak_ref (client, (GWeakNotify) client_died, window); g_signal_connect (client, "job-started", G_CALLBACK (client_job_started), window); @@ -4460,7 +4460,7 @@ moo_edit_window_abort_jobs (MooEditWindow *window) jobs = g_slist_copy (window->priv->jobs); - for (l = jobs; l != NULL; l = l->next) + for (l = jobs; l != nullptr; l = l->next) { Job *j = (Job*) l->data; j->abort (j->job); @@ -4480,14 +4480,14 @@ moo_edit_window_job_started (MooEditWindow *window, gboolean had_jobs; g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); - g_return_if_fail (func != NULL); - g_return_if_fail (job != NULL); + g_return_if_fail (func != nullptr); + g_return_if_fail (job != nullptr); j = g_new0 (Job, 1); j->abort = func; j->job = job; - had_jobs = window->priv->jobs != NULL; + had_jobs = window->priv->jobs != nullptr; window->priv->jobs = g_slist_prepend (window->priv->jobs, j); if (!had_jobs) @@ -4500,19 +4500,19 @@ moo_edit_window_job_finished (MooEditWindow *window, gpointer job) { GSList *l; - Job *j = NULL; + Job *j = nullptr; g_return_if_fail (MOO_IS_EDIT_WINDOW (window)); - g_return_if_fail (job != NULL); + g_return_if_fail (job != nullptr); - for (l = window->priv->jobs; l != NULL; l = l->next) + for (l = window->priv->jobs; l != nullptr; l = l->next) { j = (Job*) l->data; if (j->job == job) break; else - j = NULL; + j = nullptr; } if (j) @@ -4580,7 +4580,7 @@ populate_window_menu (MooEditWindow *window, pos = g_list_index (children, no_docs_item); g_return_if_fail (pos >= 0); - for (l = g_list_nth (children, pos + 1); l != NULL; l = l->next) + for (l = g_list_nth (children, pos + 1); l != nullptr; l = l->next) { if (data_is_doc_menu_item.get(GTK_WIDGET (l->data))) gtk_container_remove (GTK_CONTAINER (menu), (GtkWidget*) l->data); @@ -4646,7 +4646,7 @@ window_menu_item_selected (MooWindow *window, no_docs_item = moo_ui_xml_get_widget (moo_window_get_ui_xml (window), window->menubar, "Editor/Menubar/Window/NoDocuments"); - g_return_if_fail (menu != NULL && no_docs_item != NULL); + g_return_if_fail (menu != nullptr && no_docs_item != nullptr); populate_window_menu (MOO_EDIT_WINDOW (window), menu, no_docs_item); } @@ -4697,7 +4697,7 @@ notebook_drag_motion (GtkWidget *widget, { GdkAtom target; - target = gtk_drag_dest_find_target (widget, context, NULL); + target = gtk_drag_dest_find_target (widget, context, nullptr); if (target == GDK_NONE) return FALSE; @@ -4721,7 +4721,7 @@ notebook_drag_drop (GtkWidget *widget, { GdkAtom target; - target = gtk_drag_dest_find_target (widget, context, NULL); + target = gtk_drag_dest_find_target (widget, context, nullptr); if (target == GDK_NONE) { @@ -4756,12 +4756,12 @@ notebook_drag_data_recv (GtkWidget *widget, if (data->target == MOO_EDIT_TAB_ATOM) { GtkWidget *toplevel; - GtkWidget *src_notebook = NULL; + GtkWidget *src_notebook = nullptr; MooEdit *doc; MooEditTab *tab; tab = (MooEditTab*) moo_selection_data_get_pointer (data, MOO_EDIT_TAB_ATOM); - doc = tab ? moo_edit_tab_get_doc (tab) : NULL; + doc = tab ? moo_edit_tab_get_doc (tab) : nullptr; if (!doc) goto out; @@ -4796,9 +4796,9 @@ notebook_drag_data_recv (GtkWidget *widget, for (u = uris; *u; ++u) { - char *filename = g_filename_from_uri (*u, NULL, NULL); + char *filename = g_filename_from_uri (*u, nullptr, nullptr); if (!filename || !g_file_test (filename, G_FILE_TEST_IS_DIR)) - moo_editor_open_uri (window->priv->editor, *u, NULL, -1, window); + moo_editor_open_uri (window->priv->editor, *u, nullptr, -1, window); g_free (filename); } @@ -4855,7 +4855,7 @@ notebook_drag_data_recv (GtkWidget *widget, if (toplevel == GTK_WIDGET (window)) { - GtkWidget *src_notebook = NULL; + GtkWidget *src_notebook = nullptr; src_notebook = gtk_widget_get_parent (GTK_WIDGET (tab)); g_assert (MOO_IS_NOTEBOOK (widget)); can_move = src_notebook != widget; @@ -4894,7 +4894,7 @@ split_view_horizontal_toggled (MooEditWindow *window, gboolean active) { MooEditTab *tab = ACTIVE_TAB (window); - g_return_if_fail (tab != NULL); + g_return_if_fail (tab != nullptr); if (_moo_edit_tab_set_split_horizontal (tab, active)) update_split_view_actions (window); } @@ -4904,7 +4904,7 @@ split_view_vertical_toggled (MooEditWindow *window, gboolean active) { MooEditTab *tab = ACTIVE_TAB (window); - g_return_if_fail (tab != NULL); + g_return_if_fail (tab != nullptr); if (_moo_edit_tab_set_split_vertical (tab, active)) update_split_view_actions (window); } @@ -4913,7 +4913,7 @@ static void action_focus_next_split_view (MooEditWindow *window) { MooEditTab *tab = ACTIVE_TAB (window); - g_return_if_fail (tab != NULL); + g_return_if_fail (tab != nullptr); _moo_edit_tab_focus_next_view (tab); update_doc_view_actions (window); } @@ -4932,11 +4932,11 @@ update_split_view_actions (MooEditWindow *window) return; action_cycle = moo_window_get_action (MOO_WINDOW (window), "CycleSplitViews"); - g_return_if_fail (action_cycle != NULL); + g_return_if_fail (action_cycle != nullptr); action_split_horizontal = moo_window_get_action (MOO_WINDOW (window), "SplitViewHorizontal"); - g_return_if_fail (action_split_horizontal != NULL); + g_return_if_fail (action_split_horizontal != nullptr); action_split_vertical = moo_window_get_action (MOO_WINDOW (window), "SplitViewVertical"); - g_return_if_fail (action_split_vertical != NULL); + g_return_if_fail (action_split_vertical != nullptr); has_split_horizontal = _moo_edit_tab_get_split_horizontal (tab); has_split_vertical = _moo_edit_tab_get_split_vertical (tab); diff --git a/moo/mooedit/moolangmgr.cpp b/moo/mooedit/moolangmgr.cpp index cdb091ef..0f69c83e 100644 --- a/moo/mooedit/moolangmgr.cpp +++ b/moo/mooedit/moolangmgr.cpp @@ -75,7 +75,7 @@ moo_lang_mgr_init (MooLangMgr *mgr) mgr->lang_mgr = gtk_source_language_manager_new (); dirs = moo_get_data_subdirs (LANGUAGE_DIR); - g_object_set (mgr->lang_mgr, "search-path", dirs, NULL); + g_object_set (mgr->lang_mgr, "search-path", dirs, nullptr); mgr->style_mgr = gtk_source_style_scheme_manager_new (); gtk_source_style_scheme_manager_set_search_path (mgr->style_mgr, dirs); diff --git a/moo/mooedit/mootextbtree.c b/moo/mooedit/mootextbtree.c index d56f325f..123fbced 100644 --- a/moo/mooedit/mootextbtree.c +++ b/moo/mooedit/mootextbtree.c @@ -322,7 +322,7 @@ static void merge_nodes (BTNode *parent, guint first) { BTNode *node, *next; - guint i; + int i; g_assert (first + 1 < parent->n_children); diff --git a/moo/mooedit/mootextview.c b/moo/mooedit/mootextview.c index 532bf715..de7faf33 100644 --- a/moo/mooedit/mootextview.c +++ b/moo/mooedit/mootextview.c @@ -3725,6 +3725,7 @@ moo_text_view_size_allocate (GtkWidget *widget, { case MOO_TEXT_VIEW_POS_RIGHT: child_alloc.x = MAX (allocation->width - border_width - right, 0); + // fallthrough case MOO_TEXT_VIEW_POS_LEFT: child_alloc.width = child_req.width; child_alloc.height = MAX (allocation->height - 2*border_width - top - bottom, 1); @@ -3732,6 +3733,7 @@ moo_text_view_size_allocate (GtkWidget *widget, case MOO_TEXT_VIEW_POS_BOTTOM: child_alloc.y = MAX (allocation->height - bottom - border_width, 0); + // fallthrough case MOO_TEXT_VIEW_POS_TOP: child_alloc.height = child_req.height; child_alloc.width = MAX (allocation->width - 2*border_width - left - right, 1); diff --git a/moo/moofileview/moofileview.c b/moo/moofileview/moofileview.c index 92e8d8db..d11281ee 100644 --- a/moo/moofileview/moofileview.c +++ b/moo/moofileview/moofileview.c @@ -1384,11 +1384,13 @@ init_gui (MooFileView *fileview) TREEVIEW_PAGE); _moo_tree_view_set_active (fileview->priv->view, GTK_WIDGET (fileview->priv->treeview)); + break; case MOO_FILE_VIEW_BOOKMARK: fileview->priv->file_view_type = MOO_FILE_VIEW_ICON; gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), BOOKMARK_PAGE); + break; } moo_file_view_focus_files (fileview); diff --git a/moo/moolua/lua/luaall.cpp b/moo/moolua/lua/luaall.cpp index b299c4a5..04ae6622 100644 --- a/moo/moolua/lua/luaall.cpp +++ b/moo/moolua/lua/luaall.cpp @@ -2,6 +2,10 @@ * all.c -- Lua core, libraries and interpreter in a single file */ +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wmisleading-indentation" + #define luaall_c #include "lapi.c" diff --git a/moo/moopython/moopython-tests.cpp b/moo/moopython/moopython-tests.cpp index 0e09037d..62959f8f 100644 --- a/moo/moopython/moopython-tests.cpp +++ b/moo/moopython/moopython-tests.cpp @@ -22,7 +22,7 @@ test_func (MooTestEnv *env) { char *dir; been_here = TRUE; - dir = g_build_filename (moo_test_get_data_dir ().get(), "test-python", NULL); + dir = g_build_filename (moo_test_get_data_dir ().get(), "test-python", nullptr); moo_python_add_path (dir); g_free (dir); } diff --git a/moo/mooutils/moo-test-utils.cpp b/moo/mooutils/moo-test-utils.cpp index b0b565de..7bdbae43 100644 --- a/moo/mooutils/moo-test-utils.cpp +++ b/moo/mooutils/moo-test-utils.cpp @@ -404,7 +404,7 @@ moo_test_find_data_file (const char *basename) g_return_val_if_fail(!registry.data_dir.empty(), gstr()); if (!_moo_path_is_absolute(basename)) - return gstr::take(g_build_filename(registry.data_dir.get(), basename, NULL)); + return gstr::take(g_build_filename(registry.data_dir.get(), basename, nullptr)); else return gstr(basename); } @@ -421,7 +421,7 @@ moo_test_list_data_files (const char *dir) if (!_moo_path_is_absolute (dir)) { g_return_val_if_fail (registry.data_dir != nullptr, NULL); - tmp.steal(g_build_filename(registry.data_dir.get(), dir, NULL)); + tmp.steal(g_build_filename(registry.data_dir.get(), dir, nullptr)); dir = tmp.get(); } @@ -454,7 +454,7 @@ moo_test_load_data_file (const char *basename) g_return_val_if_fail (registry.data_dir != nullptr, NULL); if (!_moo_path_is_absolute (basename)) - fullname = g_build_filename (registry.data_dir.get(), basename, NULL); + fullname = g_build_filename (registry.data_dir.get(), basename, nullptr); else fullname = g_strdup (basename); diff --git a/moo/mooutils/mooapp-ipc.c b/moo/mooutils/mooapp-ipc.c index a2535906..3379520c 100644 --- a/moo/mooutils/mooapp-ipc.c +++ b/moo/mooutils/mooapp-ipc.c @@ -244,7 +244,7 @@ moo_ipc_send (GObject *sender, g_string_append (header, ipc_data.app_id); g_string_append_printf (header, "%08x", ++ipc_data.stamp); - g_string_append_printf (header, "%04x", id_len); + g_string_append_printf (header, "%04x", (unsigned) id_len); g_string_append (header, id); _moo_app_input_broadcast (header->str, data, len); diff --git a/moo/mooutils/mooentry.cpp b/moo/mooutils/mooentry.cpp index 74a3174e..708f29fb 100644 --- a/moo/mooutils/mooentry.cpp +++ b/moo/mooutils/mooentry.cpp @@ -918,7 +918,7 @@ insert_action_merge (InsertAction *last_action, return FALSE; } - tmp = g_strconcat (last_action->text, action->text, NULL); + tmp = g_strconcat (last_action->text, action->text, nullptr); g_free (last_action->text); last_action->length += action->length; last_action->text = tmp; @@ -953,7 +953,7 @@ delete_action_merge (DeleteAction *last_action, return FALSE; } - tmp = g_strconcat (last_action->text, action->text, NULL); + tmp = g_strconcat (last_action->text, action->text, nullptr); g_free (last_action->text); last_action->end += (action->end - action->start); last_action->text = tmp; @@ -967,7 +967,7 @@ delete_action_merge (DeleteAction *last_action, return FALSE; } - tmp = g_strconcat (action->text, last_action->text, NULL); + tmp = g_strconcat (action->text, last_action->text, nullptr); g_free (last_action->text); last_action->start = action->start; last_action->text = tmp; diff --git a/moo/mooutils/moofilewriter.cpp b/moo/mooutils/moofilewriter.cpp index 16c7f138..35a6733e 100644 --- a/moo/mooutils/moofilewriter.cpp +++ b/moo/mooutils/moofilewriter.cpp @@ -631,8 +631,8 @@ test_moo_file_writer (void) GError *error = NULL; dir = moo_test_get_working_dir (); - my_dir = g_build_filename (dir, "cfg-writer", NULL); - filename = g_build_filename (my_dir, "configfile", NULL); + my_dir = g_build_filename (dir, "cfg-writer", nullptr); + filename = g_build_filename (my_dir, "configfile", nullptr); bak_filename = g_strdup_printf ("%s~", filename); writer = moo_config_writer_new (filename, TRUE, &error); diff --git a/moo/mooutils/mooi18n.cpp b/moo/mooutils/mooi18n.cpp index fcf50e62..1a678886 100644 --- a/moo/mooutils/mooi18n.cpp +++ b/moo/mooutils/mooi18n.cpp @@ -92,7 +92,7 @@ moo_pgettext2 (G_GNUC_UNUSED const char *context, const char *msgctxtid) g_return_val_if_fail (msgctxtid != NULL, NULL); init_gettext (); - tmp = g_strjoin (context, "\004", msgctxtid, NULL); + tmp = g_strjoin (context, "\004", msgctxtid, nullptr); translation = dgettext (GETTEXT_PACKAGE, tmp); if (translation == tmp) @@ -171,8 +171,8 @@ test_mooi18n (void) char *po_file, *po_file2; locale_dir = moo_get_locale_dir (); - po_file = g_build_filename (locale_dir, "ru", "LC_MESSAGES", GETTEXT_PACKAGE ".mo", NULL); - po_file2 = g_build_filename (locale_dir, "ru", "LC_MESSAGES", GETTEXT_PACKAGE "-gsv.mo", NULL); + po_file = g_build_filename (locale_dir, "ru", "LC_MESSAGES", GETTEXT_PACKAGE ".mo", nullptr); + po_file2 = g_build_filename (locale_dir, "ru", "LC_MESSAGES", GETTEXT_PACKAGE "-gsv.mo", nullptr); TEST_ASSERT_MSG (g_file_test (po_file, G_FILE_TEST_EXISTS), "mo file '%s' does not exist", po_file); TEST_ASSERT_MSG (g_file_test (po_file2, G_FILE_TEST_EXISTS), "mo file '%s' does not exist", po_file2); diff --git a/moo/mooutils/moopaned.c b/moo/mooutils/moopaned.c index db17fe74..be092027 100644 --- a/moo/mooutils/moopaned.c +++ b/moo/mooutils/moopaned.c @@ -1659,6 +1659,7 @@ draw_border (MooPaned *paned, rect.x = widget->allocation.width - paned->priv->button_box_size - paned->priv->border_size; + // fallthrough case MOO_PANE_POS_LEFT: rect.y = 0; rect.height = widget->allocation.height; @@ -1679,6 +1680,7 @@ draw_border (MooPaned *paned, rect.y = widget->allocation.height - paned->priv->button_box_size - paned->priv->border_size; + // fallthrough case MOO_PANE_POS_TOP: rect.x = 0; rect.width = widget->allocation.width; @@ -2043,12 +2045,14 @@ _moo_paned_get_button_position (MooPaned *paned, { case MOO_PANE_POS_RIGHT: rect->x = widget->allocation.width - 30; + // fallthrough case MOO_PANE_POS_LEFT: rect->height = 60; rect->width = 30; break; case MOO_PANE_POS_BOTTOM: rect->y = widget->allocation.height - 30; + // fallthrough case MOO_PANE_POS_TOP: rect->width = 60; rect->height = 30; diff --git a/moo/mooutils/mooutils-fs.cpp b/moo/mooutils/mooutils-fs.cpp index 95b995d1..e2bb7a29 100644 --- a/moo/mooutils/mooutils-fs.cpp +++ b/moo/mooutils/mooutils-fs.cpp @@ -526,7 +526,7 @@ _moo_filename_to_uri (const char *file, if (!_moo_path_is_absolute (file)) { char *cd = g_get_current_dir (); - file = freeme = g_build_filename (cd, file, NULL); + file = freeme = g_build_filename (cd, file, nullptr); g_free (cd); } @@ -731,7 +731,7 @@ normalize_full_path_win32 (const char *fullpath) { if (prefix) { - char *tmp = g_strconcat (prefix, path, NULL); + char *tmp = g_strconcat (prefix, path, nullptr); g_free (path); path = tmp; } @@ -764,7 +764,7 @@ normalize_path (const char *filename) { char *working_dir = g_get_current_dir (); g_return_val_if_fail (working_dir != NULL, g_strdup (filename)); - freeme = g_build_filename (working_dir, filename, NULL); + freeme = g_build_filename (working_dir, filename, nullptr); filename = freeme; g_free (working_dir); } @@ -925,7 +925,7 @@ make_cases (gboolean unix_paths) { g_ptr_array_add (paths, g_strdup (rel_files_common[i])); if (rel_files_common[i+1]) - g_ptr_array_add (paths, g_build_filename (current_dir, rel_files_common[i+1], NULL)); + g_ptr_array_add (paths, g_build_filename (current_dir, rel_files_common[i+1], nullptr)); else g_ptr_array_add (paths, g_strdup (current_dir)); } @@ -936,7 +936,7 @@ make_cases (gboolean unix_paths) { g_ptr_array_add (paths, g_strdup (rel_files_unix[i])); if (rel_files_unix[i+1]) - g_ptr_array_add (paths, g_build_filename (current_dir, rel_files_unix[i+1], NULL)); + g_ptr_array_add (paths, g_build_filename (current_dir, rel_files_unix[i+1], nullptr)); else g_ptr_array_add (paths, g_strdup (current_dir)); } diff --git a/moo/mooutils/mooutils-misc.cpp b/moo/mooutils/mooutils-misc.cpp index c9fc6544..b241fe10 100644 --- a/moo/mooutils/mooutils-misc.cpp +++ b/moo/mooutils/mooutils-misc.cpp @@ -686,7 +686,7 @@ moo_log_window_insert (MooLogWindow *log, { GtkTextIter iter; gtk_text_buffer_get_end_iter (log->buf, &iter); - gtk_text_buffer_insert_with_tags (log->buf, &iter, text, -1, tag, NULL); + gtk_text_buffer_insert_with_tags (log->buf, &iter, text, -1, tag, nullptr); gtk_text_view_scroll_mark_onscreen (log->textview, log->insert); } @@ -1193,7 +1193,7 @@ moo_get_user_cache_dir (void) G_LOCK (moo_user_cache_dir); if (!moo_user_cache_dir) - moo_user_cache_dir = g_build_filename (g_get_user_cache_dir (), MOO_PACKAGE_NAME, NULL); + moo_user_cache_dir = g_build_filename (g_get_user_cache_dir (), MOO_PACKAGE_NAME, nullptr); G_UNLOCK (moo_user_cache_dir); @@ -1277,7 +1277,7 @@ moo_get_user_data_dir (void) moo_user_data_dir = g_build_filename (basedir, MOO_PACKAGE_NAME, - NULL); + nullptr); g_free (freeme); } @@ -1340,7 +1340,7 @@ moo_make_user_data_dir (const char *path) user_dir = moo_get_user_data_dir (); g_return_val_if_fail (user_dir != NULL, FALSE); - full_path = g_build_filename (user_dir, path, NULL); + full_path = g_build_filename (user_dir, path, nullptr); result = _moo_mkdir_with_parents (full_path, &err); if (result != 0) @@ -1428,7 +1428,7 @@ enumerate_data_dirs (MooDataDirType type, const char* const *p; for (p = g_get_system_data_dirs (); p && *p; ++p) - g_ptr_array_add (dirs, g_build_filename (*p, MOO_PACKAGE_NAME, NULL)); + g_ptr_array_add (dirs, g_build_filename (*p, MOO_PACKAGE_NAME, nullptr)); g_ptr_array_add (dirs, g_strdup (MOO_DATA_DIR)); } @@ -1576,7 +1576,7 @@ moo_get_stuff_subdirs (const char *subdir, dirs = g_new0 (char*, n_dirs + 1); for (i = 0; i < n_dirs; ++i) - dirs[i] = g_build_filename (data_dirs[i], subdir, NULL); + dirs[i] = g_build_filename (data_dirs[i], subdir, nullptr); g_strfreev (data_dirs); return dirs; @@ -1650,7 +1650,7 @@ get_user_data_file (const char *basename, g_return_val_if_fail (dir != NULL, NULL); - file = g_build_filename (dir, basename, NULL); + file = g_build_filename (dir, basename, nullptr); g_free (dir); return file; diff --git a/moo/plugins/moofilelist.cpp b/moo/plugins/moofilelist.cpp index 459a46a0..ef3f3c6d 100644 --- a/moo/plugins/moofilelist.cpp +++ b/moo/plugins/moofilelist.cpp @@ -195,7 +195,7 @@ file_list_init (FileList *list) gtk_tree_store_set_column_types (GTK_TREE_STORE (list), 2, types); list->n_user_items = 0; - list->docs = NULL; + list->docs = nullptr; } static void @@ -217,7 +217,7 @@ static Item * get_item_at_iter (FileList *list, GtkTreeIter *iter) { - Item *item = NULL; + Item *item = nullptr; gtk_tree_model_get (GTK_TREE_MODEL (list), iter, COLUMN_ITEM, &item, -1); @@ -234,7 +234,7 @@ get_item_at_path (FileList *list, GtkTreeIter iter; if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (list), &iter, path)) - return NULL; + return nullptr; else return get_item_at_iter (list, &iter); } @@ -315,10 +315,10 @@ file_new (void) ITEM (file)->ref_count = 1; ITEM (file)->type = ITEM_FILE; - file->uri = NULL; - file->doc = NULL; - file->display_name = NULL; - file->display_basename = NULL; + file->uri = nullptr; + file->doc = nullptr; + file->display_name = nullptr; + file->display_basename = nullptr; return file; } @@ -328,7 +328,7 @@ file_new_doc (MooEdit *doc) { File *file; - g_return_val_if_fail (MOO_IS_EDIT (doc), NULL); + g_return_val_if_fail (MOO_IS_EDIT (doc), nullptr); file = file_new (); file_set_doc (file, doc); @@ -343,8 +343,8 @@ file_set_uri (File *file, char *tmp; char *filename; - g_return_if_fail (file != NULL); - g_return_if_fail (uri != NULL); + g_return_if_fail (file != nullptr); + g_return_if_fail (uri != nullptr); tmp = file->uri; file->uri = g_strdup (uri); @@ -353,7 +353,7 @@ file_set_uri (File *file, g_free (file->display_name); g_free (file->display_basename); - filename = g_filename_from_uri (uri, NULL, NULL); + filename = g_filename_from_uri (uri, nullptr, nullptr); if (filename) { @@ -374,7 +374,7 @@ file_new_uri (const char *uri) { File *file; - g_return_val_if_fail (uri != NULL, NULL); + g_return_val_if_fail (uri != nullptr, nullptr); file = file_new (); file_set_uri (file, uri); @@ -402,7 +402,7 @@ item_get_tooltip (Item *item) if (ITEM_IS_FILE (item)) return FILE_ITEM (item)->display_name; else - return NULL; + return nullptr; } static Item * @@ -455,7 +455,7 @@ check_list (G_GNUC_UNUSED FileList *list) GtkTreeIter iter; int index = 0; - if (gtk_tree_model_iter_children (GTK_TREE_MODEL (list), &iter, NULL)) + if (gtk_tree_model_iter_children (GTK_TREE_MODEL (list), &iter, nullptr)) { do { @@ -463,12 +463,12 @@ check_list (G_GNUC_UNUSED FileList *list) if (list->n_user_items) { - g_assert (index == list->n_user_items || item != NULL); - g_assert (index != list->n_user_items || item == NULL); + g_assert (index == list->n_user_items || item != nullptr); + g_assert (index != list->n_user_items || item == nullptr); } else { - g_assert (item != NULL); + g_assert (item != nullptr); } index += 1; @@ -477,7 +477,7 @@ check_list (G_GNUC_UNUSED FileList *list) } g_assert (list->n_user_items == 0 || - list->n_user_items < gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list), NULL)); + list->n_user_items < gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list), nullptr)); #endif } @@ -519,7 +519,7 @@ file_list_find_uri (FileList *list, const char *uri, GtkTreeIter *iter) { - return iter_find_uri (list, uri, NULL, iter); + return iter_find_uri (list, uri, nullptr, iter); } @@ -543,7 +543,7 @@ file_list_remove_row (FileList *list, if (last_user_item) { GtkTreeIter sep; - gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &sep, NULL, 0); + gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &sep, nullptr, 0); gtk_tree_store_remove (GTK_TREE_STORE (list), &sep); } @@ -555,7 +555,7 @@ file_list_append_row (FileList *list, Item *item, GtkTreeIter *iter) { - gtk_tree_store_append (GTK_TREE_STORE (list), iter, NULL); + gtk_tree_store_append (GTK_TREE_STORE (list), iter, nullptr); gtk_tree_store_set (GTK_TREE_STORE (list), iter, COLUMN_ITEM, item, COLUMN_TOOLTIP, item_get_tooltip (item), @@ -596,7 +596,7 @@ file_list_insert_row (FileList *list, if (first_user_item) { GtkTreeIter sep; - gtk_tree_store_insert (GTK_TREE_STORE (list), &sep, NULL, list->n_user_items); + gtk_tree_store_insert (GTK_TREE_STORE (list), &sep, nullptr, list->n_user_items); gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), iter, parent_iter, index); } @@ -639,7 +639,7 @@ get_doc_row (FileList *list, MooEdit *doc) { GtkTreeRowReference *row = file_list_row_data.get(doc); if (row && g_object_get_qdata (G_OBJECT (doc), FILE_LIST_QUARK) != list->plugin) - row = NULL; + row = nullptr; return row; } @@ -724,14 +724,14 @@ file_list_update_doc (FileList *list, item = get_item_at_iter (list, &iter); DEBUG_ASSERT (ITEM_IS_FILE (item) && FILE_ITEM (item)->doc == doc); - DEBUG_ASSERT (FILE_ITEM (item)->uri != NULL); + DEBUG_ASSERT (FILE_ITEM (item)->uri != nullptr); gstr new_uri = gstr::take (moo_edit_get_uri (doc)); if (new_uri.empty() || strcmp (new_uri.get(), FILE_ITEM (item)->uri) != 0) { file_list_row_data.set(doc, nullptr); - file_set_doc (FILE_ITEM (item), NULL); + file_set_doc (FILE_ITEM (item), nullptr); file_list_add_doc (list, doc, FALSE); } } @@ -742,7 +742,7 @@ file_list_remove_doc (FileList *list, { GtkTreeIter iter; - DEBUG_ASSERT (g_slist_find (list->docs, doc) != NULL); + DEBUG_ASSERT (g_slist_find (list->docs, doc) != nullptr); if (doc_get_list_iter (list, doc, &iter)) { @@ -755,13 +755,13 @@ file_list_remove_doc (FileList *list, if (file_list_iter_is_auto (list, &iter)) file_list_remove_row (list, &iter); else - file_set_doc (FILE_ITEM (item), NULL); + file_set_doc (FILE_ITEM (item), nullptr); } if (get_doc_row (list, doc)) { file_list_row_data.set(doc, nullptr); - g_object_set_qdata (G_OBJECT (doc), FILE_LIST_QUARK, NULL); + g_object_set_qdata (G_OBJECT (doc), FILE_LIST_QUARK, nullptr); } disconnect_doc (list, doc); @@ -774,10 +774,10 @@ remove_auto_items (FileList *list) if (list->n_user_items) while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &iter, - NULL, list->n_user_items + 1)) + nullptr, list->n_user_items + 1)) gtk_tree_store_remove (GTK_TREE_STORE (list), &iter); else - while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &iter, NULL, 0)) + while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list), &iter, nullptr, 0)) gtk_tree_store_remove (GTK_TREE_STORE (list), &iter); } @@ -790,13 +790,13 @@ file_list_update (FileList *list, remove_auto_items (list); - for (l = docs; l != NULL; l = l->next) + for (l = docs; l != nullptr; l = l->next) file_list_update_doc (list, (MooEdit*) l->data); old_docs = g_slist_copy (list->docs); - for (l = docs; l != NULL; l = l->next) + for (l = docs; l != nullptr; l = l->next) old_docs = g_slist_remove (old_docs, l->data); - for (l = old_docs; l != NULL; l = l->next) + for (l = old_docs; l != nullptr; l = l->next) file_list_remove_doc (list, (MooEdit*) l->data); check_list (list); @@ -818,13 +818,13 @@ file_list_shutdown (FileList *list) { Item *item = get_item_at_iter (list, &iter); DEBUG_ASSERT (ITEM_IS_FILE (item)); - file_set_doc (FILE_ITEM (item), NULL); + file_set_doc (FILE_ITEM (item), nullptr); } if (get_doc_row (list, doc)) { file_list_row_data.set(doc, nullptr); - g_object_set_qdata (G_OBJECT (doc), FILE_LIST_QUARK, NULL); + g_object_set_qdata (G_OBJECT (doc), FILE_LIST_QUARK, nullptr); } disconnect_doc (list, doc); @@ -836,8 +836,8 @@ static UIConfig * ui_config_new (void) { UIConfig *cfg = g_new0 (UIConfig, 1); - cfg->expanded_rows = NULL; - cfg->selected_row = NULL; + cfg->expanded_rows = nullptr; + cfg->selected_row = nullptr; return cfg; } @@ -846,7 +846,7 @@ ui_config_free (UIConfig *cfg) { if (cfg) { - g_slist_foreach (cfg->expanded_rows, (GFunc) gtk_tree_path_free, NULL); + g_slist_foreach (cfg->expanded_rows, (GFunc) gtk_tree_path_free, nullptr); g_slist_free (cfg->expanded_rows); gtk_tree_path_free (cfg->selected_row); g_free (cfg); @@ -879,7 +879,7 @@ parse_node (FileList *list, file_list_insert_row (list, ITEM (group), &iter, parent, -1); item_unref (ITEM (group)); - for (child = elm->children; child != NULL; child = child->next) + for (child = elm->children; child != nullptr; child = child->next) if (MOO_MARKUP_IS_ELEMENT (child)) parse_node (list, child, &iter, filename, ui_config); } @@ -905,7 +905,7 @@ parse_node (FileList *list, const char *expanded_rows; const char *selected_row; UIConfig *config; - char **rows = NULL, **p; + char **rows = nullptr, **p; if (*ui_config) { @@ -949,11 +949,11 @@ file_list_load_config (FileList *list, UIConfig **ui_configp) { MooMarkupDoc *doc; - GError *error = NULL; + GError *error = nullptr; MooMarkupNode *root, *node; const char *version; - *ui_configp = NULL; + *ui_configp = nullptr; if (!g_file_test (filename, G_FILE_TEST_EXISTS)) return; @@ -984,12 +984,12 @@ file_list_load_config (FileList *list, goto out; } - for (node = root->children; node != NULL; node = node->next) + for (node = root->children; node != nullptr; node = node->next) { if (!MOO_MARKUP_IS_ELEMENT (node)) continue; - parse_node (list, node, NULL, filename, ui_configp); + parse_node (list, node, nullptr, filename, ui_configp); } out: @@ -1061,7 +1061,7 @@ file_list_save_config (FileList *list, { GtkTreeIter iter; GString *buffer; - GError *error = NULL; + GError *error = nullptr; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list), &iter)) { @@ -1083,7 +1083,7 @@ file_list_save_config (FileList *list, g_string_append (buffer, " " PROP_EXPANDED_ROWS "=\""); - for (l = ui_config->expanded_rows; l != NULL; l = l->next) + for (l = ui_config->expanded_rows; l != nullptr; l = l->next) { GtkTreePath *path = (GtkTreePath*) l->data; char *tmp = gtk_tree_path_to_string (path); @@ -1135,9 +1135,9 @@ static GtkTreePath * file_list_add_group (FileList *list, GtkTreePath *path) { - GtkTreePath *parent = NULL; + GtkTreePath *parent = nullptr; GtkTreeIter parent_iter, new_iter; - GtkTreeIter *piter = NULL; + GtkTreeIter *piter = nullptr; Group *group; int index = -1; @@ -1205,7 +1205,7 @@ static void file_list_remove_items (FileList *list, GList *paths) { - GSList *rows = NULL; + GSList *rows = nullptr; while (paths) { @@ -1223,7 +1223,7 @@ file_list_remove_items (FileList *list, while (rows) { - GtkTreePath *path = NULL; + GtkTreePath *path = nullptr; if (gtk_tree_row_reference_valid ((GtkTreeRowReference*) rows->data)) path = gtk_tree_row_reference_get_path ((GtkTreeRowReference*) rows->data); @@ -1316,12 +1316,12 @@ copy_row (FileList *list, { GtkTreeRowReference *source_row; GtkTreeIter iter, parent_iter; - GtkTreeIter *piter = NULL; + GtkTreeIter *piter = nullptr; Item *item; gtk_tree_model_get_iter (GTK_TREE_MODEL (list), &iter, source); item = get_item_at_iter (list, &iter); - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); source_row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list), source); @@ -1346,7 +1346,7 @@ move_row (FileList *list, GtkTreePath *parent, int index) { - GtkTreePath *source_parent = NULL; + GtkTreePath *source_parent = nullptr; gboolean same_parent = FALSE; GtkTreeIter iter; Item *item; @@ -1366,7 +1366,7 @@ move_row (FileList *list, file_set_uri (FILE_ITEM (item), uri.get()); file_list_row_data.set(FILE_ITEM (item)->doc, nullptr); - file_set_doc (FILE_ITEM (item), NULL); + file_set_doc (FILE_ITEM (item), nullptr); } if (gtk_tree_path_get_depth (source) > 1) @@ -1382,7 +1382,7 @@ move_row (FileList *list, if (same_parent) { - GtkTreeIter *piter = NULL; + GtkTreeIter *piter = nullptr; gboolean first_user = FALSE; if (parent) @@ -1399,7 +1399,7 @@ move_row (FileList *list, if (index >= gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list), piter) || index < 0) { gtk_tree_model_get_iter (GTK_TREE_MODEL (list), &iter, source); - gtk_tree_store_move_before (GTK_TREE_STORE (list), &iter, NULL); + gtk_tree_store_move_before (GTK_TREE_STORE (list), &iter, nullptr); } else { @@ -1411,7 +1411,7 @@ move_row (FileList *list, if (first_user) gtk_tree_store_insert (GTK_TREE_STORE (list), &iter, - NULL, list->n_user_items); + nullptr, list->n_user_items); } else { @@ -1444,7 +1444,7 @@ uri_is_directory (const char *uri) char *filename; gboolean retval = FALSE; - filename = g_filename_from_uri (uri, NULL, NULL); + filename = g_filename_from_uri (uri, nullptr, nullptr); if (filename) retval = g_file_test (filename, G_FILE_TEST_IS_DIR); @@ -1496,9 +1496,9 @@ add_row_from_uri (FileList *list, int index) { GtkTreeIter iter, dummy; - GtkTreeIter *piter = NULL; + GtkTreeIter *piter = nullptr; - g_return_val_if_fail (uri != NULL, FALSE); + g_return_val_if_fail (uri != nullptr, FALSE); if (parent) { @@ -1521,10 +1521,10 @@ find_drop_destination (FileList *list, int *index) { int n_children; - Group *parent_group = NULL; + Group *parent_group = nullptr; GtkTreeIter parent_iter; - *parent_path = NULL; + *parent_path = nullptr; *index = 0; if (gtk_tree_path_get_depth (dest) > 1) @@ -1571,7 +1571,7 @@ find_drop_destination (FileList *list, } else { - parent_group = NULL; + parent_group = nullptr; *index = gtk_tree_path_get_indices (parent)[0]; } @@ -1610,7 +1610,7 @@ drop_uris (FileList *list, GtkTreePath *dest, char **uris) { - GtkTreePath *parent_path = NULL; + GtkTreePath *parent_path = nullptr; int index = 0; if (!find_drop_destination (list, dest, &parent_path, &index)) @@ -1638,7 +1638,7 @@ drop_tree_model_row (FileList *list, GtkTreePath *dest, GtkTreePath *source) { - GtkTreePath *parent_path = NULL; + GtkTreePath *parent_path = nullptr; int index; gboolean retval; @@ -1678,10 +1678,10 @@ drag_dest_drag_data_received (GtkTreeDragDest *drag_dest, { if (selection_data->target == TREE_MODEL_ROW_ATOM) { - GtkTreePath *path = NULL; + GtkTreePath *path = nullptr; gboolean retval; - if (!gtk_tree_get_row_drag_data (selection_data, NULL, &path)) + if (!gtk_tree_get_row_drag_data (selection_data, nullptr, &path)) return FALSE; if ((retval = drop_tree_model_row (FILE_LIST (drag_dest), dest, path))) @@ -1729,8 +1729,8 @@ _moo_str_semicase_compare (const char *string, gboolean has_upper; const char *p; - g_return_val_if_fail (string != NULL, FALSE); - g_return_val_if_fail (key != NULL, FALSE); + g_return_val_if_fail (string != nullptr, FALSE); + g_return_val_if_fail (key != nullptr, FALSE); for (p = key, has_upper = FALSE; *p && !has_upper; ++p) has_upper = g_ascii_isupper (*p); @@ -1747,7 +1747,7 @@ row_separator_func (GtkTreeModel *model, GtkTreeIter *iter) { Item *item = get_item_at_iter (FILE_LIST (model), iter); - return item == NULL; + return item == nullptr; } static gboolean @@ -1756,7 +1756,7 @@ tree_view_search_equal_func (GtkTreeModel *model, const char *key, GtkTreeIter *iter) { - const char *compare_with = NULL; + const char *compare_with = nullptr; Item *item; item = get_item_at_iter (FILE_LIST (model), iter); @@ -1780,9 +1780,9 @@ pixbuf_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column, { Item *item = get_item_at_iter (FILE_LIST (model), iter); if (ITEM_IS_GROUP (item)) - g_object_set (cell, "stock-id", GTK_STOCK_DIRECTORY, NULL); + g_object_set (cell, "stock-id", GTK_STOCK_DIRECTORY, nullptr); else if (ITEM_IS_FILE (item)) - g_object_set (cell, "stock-id", GTK_STOCK_FILE, NULL); + g_object_set (cell, "stock-id", GTK_STOCK_FILE, nullptr); } static void @@ -1794,9 +1794,9 @@ text_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column, Item *item = get_item_at_iter (FILE_LIST (model), iter); if (ITEM_IS_GROUP (item)) - g_object_set (cell, "text", GROUP_ITEM (item)->name, NULL); + g_object_set (cell, "text", GROUP_ITEM (item)->name, nullptr); else if (ITEM_IS_FILE (item)) - g_object_set (cell, "text", FILE_ITEM (item)->display_basename, NULL); + g_object_set (cell, "text", FILE_ITEM (item)->display_basename, nullptr); } static void @@ -1809,10 +1809,10 @@ text_cell_edited (GtkCellRenderer *cell, Item *item; GtkTreePath *path; - g_object_set (cell, "editable", FALSE, NULL); + g_object_set (cell, "editable", FALSE, nullptr); path = gtk_tree_path_new_from_string (path_string); - g_return_if_fail (path != NULL); + g_return_if_fail (path != nullptr); gtk_tree_model_get_iter (GTK_TREE_MODEL (plugin->list), &iter, path); item = get_item_at_iter (plugin->list, &iter); @@ -1827,14 +1827,14 @@ text_cell_edited (GtkCellRenderer *cell, static void text_cell_editing_canceled (GtkCellRenderer *cell) { - g_object_set (cell, "editable", FALSE, NULL); + g_object_set (cell, "editable", FALSE, nullptr); } static void start_edit (WindowPlugin *plugin, GtkTreePath *path) { - g_object_set (plugin->text_cell, "editable", TRUE, NULL); + g_object_set (plugin->text_cell, "editable", TRUE, nullptr); gtk_tree_view_set_cursor_on_cell (plugin->treeview, path, plugin->column, plugin->text_cell, @@ -1846,13 +1846,13 @@ get_selected_rows (WindowPlugin *plugin) { GtkTreeSelection *selection; selection = gtk_tree_view_get_selection (plugin->treeview); - return gtk_tree_selection_get_selected_rows (selection, NULL); + return gtk_tree_selection_get_selected_rows (selection, nullptr); } static void path_list_free (GList *paths) { - g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL); + g_list_foreach (paths, (GFunc) gtk_tree_path_free, nullptr); g_list_free (paths); } @@ -1893,7 +1893,7 @@ add_group_activated (G_GNUC_UNUSED GtkWidget *menuitem, if (selected) path = (GtkTreePath*) g_list_last (selected)->data; else - path = NULL; + path = nullptr; new_path = file_list_add_group (plugin->list, path); @@ -1937,7 +1937,7 @@ open_file (WindowPlugin *plugin, Item *item; item = get_item_at_path (plugin->list, path); - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); if (ITEM_IS_FILE (item)) { @@ -1950,7 +1950,7 @@ open_file (WindowPlugin *plugin, else { moo_editor_open_uri (moo_editor_instance (), - FILE_ITEM (item)->uri, NULL, -1, + FILE_ITEM (item)->uri, nullptr, -1, MOO_WIN_PLUGIN (plugin)->window); } } @@ -1986,7 +1986,7 @@ open_activated (G_GNUC_UNUSED GtkWidget *menuitem, selected = get_selected_rows (plugin); - for (l = selected; l != NULL; l = l->next) + for (l = selected; l != nullptr; l = l->next) open_file (plugin, (GtkTreePath*) l->data); path_list_free (selected); @@ -1997,7 +1997,7 @@ can_open (G_GNUC_UNUSED FileList *list, GList *paths) { /* XXX */ - return paths != NULL; + return paths != nullptr; } static gboolean @@ -2027,26 +2027,26 @@ popup_menu (WindowPlugin *plugin, GtkTreePath *single_path; Item *single_item; - single_path = (selected && !selected->next) ? (GtkTreePath*) selected->data : NULL; - single_item = single_path ? get_item_at_path (plugin->list, single_path) : NULL; + single_path = (selected && !selected->next) ? (GtkTreePath*) selected->data : nullptr; + single_item = single_path ? get_item_at_path (plugin->list, single_path) : nullptr; menu = gtk_menu_new (); if (can_open (plugin->list, selected)) { - menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL); + menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, nullptr); g_signal_connect (menuitem, "activate", G_CALLBACK (open_activated), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); } - menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_ADD, NULL); + menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_ADD, nullptr); gtk_label_set_text (GTK_LABEL (GTK_BIN (menuitem)->child), "Add Group"); g_signal_connect (menuitem, "activate", G_CALLBACK (add_group_activated), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); if (selected) { - menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_REMOVE, NULL); + menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_REMOVE, nullptr); g_signal_connect (menuitem, "activate", G_CALLBACK (remove_activated), plugin); gtk_widget_set_sensitive (menuitem, can_remove (plugin->list, selected)); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); @@ -2054,14 +2054,14 @@ popup_menu (WindowPlugin *plugin, if (single_item && ITEM_IS_GROUP (single_item)) { - menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_EDIT, NULL); + menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_EDIT, nullptr); gtk_label_set_text (GTK_LABEL (GTK_BIN (menuitem)->child), "Rename"); g_signal_connect (menuitem, "activate", G_CALLBACK (rename_activated), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); } gtk_widget_show_all (menu); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, time); + gtk_menu_popup (GTK_MENU (menu), nullptr, nullptr, nullptr, nullptr, button, time); } static gboolean @@ -2070,7 +2070,7 @@ treeview_button_press (GtkTreeView *treeview, WindowPlugin *plugin) { GtkTreeSelection *selection; - GtkTreePath *path = NULL; + GtkTreePath *path = nullptr; GList *selected; int x, y; @@ -2078,7 +2078,7 @@ treeview_button_press (GtkTreeView *treeview, return FALSE; gtk_tree_view_get_path_at_pos (treeview, (int) event->x, (int) event->y, - &path, NULL, &x, &y); + &path, nullptr, &x, &y); selection = gtk_tree_view_get_selection (treeview); @@ -2087,13 +2087,13 @@ treeview_button_press (GtkTreeView *treeview, else if (!gtk_tree_selection_path_is_selected (selection, path)) gtk_tree_view_set_cursor (treeview, path, plugin->column, FALSE); - selected = gtk_tree_selection_get_selected_rows (selection, NULL); + selected = gtk_tree_selection_get_selected_rows (selection, nullptr); popup_menu (plugin, selected, event->button, event->time); if (path) gtk_tree_path_free (path); - g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL); + g_list_foreach (selected, (GFunc) gtk_tree_path_free, nullptr); g_list_free (selected); return TRUE; @@ -2106,7 +2106,7 @@ treeview_row_activated (WindowPlugin *plugin, Item *item; item = get_item_at_path (plugin->list, path); - g_return_if_fail (item != NULL); + g_return_if_fail (item != nullptr); if (ITEM_IS_FILE (item)) open_file (plugin, path); @@ -2126,10 +2126,10 @@ create_treeview (WindowPlugin *plugin) gtk_tree_view_set_headers_visible (plugin->treeview, FALSE); gtk_tree_view_set_row_separator_func (plugin->treeview, (GtkTreeViewRowSeparatorFunc) row_separator_func, - NULL, NULL); + nullptr, nullptr); gtk_tree_view_set_search_equal_func (plugin->treeview, (GtkTreeViewSearchEqualFunc) tree_view_search_equal_func, - NULL, NULL); + nullptr, nullptr); gtk_tree_view_set_tooltip_column (plugin->treeview, COLUMN_TOOLTIP); selection = gtk_tree_view_get_selection (plugin->treeview); @@ -2163,13 +2163,13 @@ create_treeview (WindowPlugin *plugin) gtk_tree_view_column_pack_start (plugin->column, cell, FALSE); gtk_tree_view_column_set_cell_data_func (plugin->column, cell, (GtkTreeCellDataFunc) pixbuf_data_func, - NULL, NULL); + nullptr, nullptr); plugin->text_cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (plugin->column, plugin->text_cell, TRUE); gtk_tree_view_column_set_cell_data_func (plugin->column, plugin->text_cell, (GtkTreeCellDataFunc) text_data_func, - NULL, NULL); + nullptr, nullptr); g_signal_connect (plugin->text_cell, "edited", G_CALLBACK (text_cell_edited), plugin); g_signal_connect (plugin->text_cell, "editing-canceled", @@ -2179,7 +2179,7 @@ create_treeview (WindowPlugin *plugin) static void create_model (WindowPlugin *plugin) { - plugin->list = (FileList*) g_object_new (file_list_get_type (), (const char*) NULL); + plugin->list = (FileList*) g_object_new (file_list_get_type (), (const char*) nullptr); plugin->list->plugin = plugin; file_list_load_config (plugin->list, plugin->filename, &plugin->ui_config); @@ -2218,7 +2218,7 @@ do_update (WindowPlugin *plugin) docs = moo_edit_window_get_docs (MOO_WIN_PLUGIN (plugin)->window); - for (i = 0, list = NULL; i < docs->n_elms; ++i) + for (i = 0, list = nullptr; i < docs->n_elms; ++i) list = g_slist_prepend (list, docs->elms[i]); list = g_slist_sort (list, (GCompareFunc) compare_docs_by_name); @@ -2233,7 +2233,7 @@ do_update (WindowPlugin *plugin) static void window_plugin_queue_update (WindowPlugin *plugin) { - g_return_if_fail (plugin != NULL); + g_return_if_fail (plugin != nullptr); if (!plugin->update_idle) plugin->update_idle = g_idle_add ((GSourceFunc) do_update, @@ -2250,7 +2250,7 @@ load_ui_config (WindowPlugin *plugin) { UIConfig *cfg = plugin->ui_config; - plugin->ui_config = NULL; + plugin->ui_config = nullptr; while (cfg->expanded_rows) { @@ -2262,7 +2262,7 @@ load_ui_config (WindowPlugin *plugin) } if (cfg->selected_row) - gtk_tree_view_set_cursor (plugin->treeview, cfg->selected_row, NULL, FALSE); + gtk_tree_view_set_cursor (plugin->treeview, cfg->selected_row, nullptr, FALSE); else _moo_tree_view_select_first (plugin->treeview); @@ -2316,7 +2316,7 @@ do_update_ui (WindowPlugin *plugin) static void window_plugin_queue_update_ui (WindowPlugin *plugin) { - g_return_if_fail (plugin != NULL); + g_return_if_fail (plugin != nullptr); if (!plugin->update_ui_idle) plugin->update_ui_idle = g_idle_add ((GSourceFunc) do_update_ui, plugin); @@ -2339,14 +2339,14 @@ file_list_window_plugin_create (WindowPlugin *plugin) create_treeview (plugin); create_model (plugin); - scrolled_window = gtk_scrolled_window_new (NULL, NULL); + scrolled_window = gtk_scrolled_window_new (nullptr, nullptr); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (plugin->treeview)); gtk_widget_show_all (scrolled_window); label = moo_pane_label_new (GTK_STOCK_DIRECTORY, - NULL, _("File List"), + nullptr, _("File List"), _("File List")); moo_edit_window_add_pane (window, FILE_LIST_PLUGIN_ID, @@ -2355,7 +2355,7 @@ file_list_window_plugin_create (WindowPlugin *plugin) moo_pane_label_free (label); pane = moo_big_paned_find_pane (window->paned, - GTK_WIDGET (scrolled_window), NULL); + GTK_WIDGET (scrolled_window), nullptr); moo_pane_set_drag_dest (pane); plugin->first_time_show = TRUE; @@ -2409,7 +2409,7 @@ MOO_PLUGIN_DEFINE_INFO (file_list, MOO_VERSION) MOO_WIN_PLUGIN_DEFINE (FileList, file_list) MOO_PLUGIN_DEFINE (FileList, file_list, - NULL, NULL, NULL, NULL, NULL, + nullptr, nullptr, nullptr, nullptr, nullptr, file_list_window_plugin_get_type (), 0) diff --git a/moo/plugins/moofileselector-prefs.cpp b/moo/plugins/moofileselector-prefs.cpp index 08a98fa7..185ac93d 100644 --- a/moo/plugins/moofileselector-prefs.cpp +++ b/moo/plugins/moofileselector-prefs.cpp @@ -86,7 +86,7 @@ _moo_file_selector_prefs_page (MooPlugin *plugin) cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); - gtk_tree_view_column_set_attributes (column, cell, "text", COLUMN_LABEL, NULL); + gtk_tree_view_column_set_attributes (column, cell, "text", COLUMN_LABEL, nullptr); store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); diff --git a/moo/plugins/moofileselector.cpp b/moo/plugins/moofileselector.cpp index b626edf4..86e84858 100644 --- a/moo/plugins/moofileselector.cpp +++ b/moo/plugins/moofileselector.cpp @@ -162,7 +162,7 @@ _moo_file_selector_class_init (MooFileSelectorClass *klass) G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (goto_current_doc_dir), - NULL, NULL, + nullptr, nullptr, _moo_marshal_VOID__VOID, G_TYPE_NONE, 0); } @@ -238,7 +238,7 @@ file_selector_go_home (MooFileView *fileview) dir = moo_prefs_get_filename (PREFS_LAST_DIR); - if (!dir || !moo_file_view_chdir_path (fileview, dir, NULL)) + if (!dir || !moo_file_view_chdir_path (fileview, dir, nullptr)) g_signal_emit_by_name (fileview, "go-home"); } @@ -254,8 +254,8 @@ moo_file_selector_chdir (MooFileView *fileview, if (result) { - char *new_dir = NULL; - g_object_get (fileview, "current-directory", &new_dir, NULL); + char *new_dir = nullptr; + g_object_get (fileview, "current-directory", &new_dir, nullptr); moo_prefs_set_filename (PREFS_LAST_DIR, new_dir); g_free (new_dir); } @@ -273,7 +273,7 @@ moo_file_selector_activate (MooFileView *fileview, gboolean is_text = TRUE, is_exe = FALSE; mgw_errno_t err; - g_return_if_fail (path != NULL); + g_return_if_fail (path != nullptr); if (mgw_stat (path, &statbuf, &err) != 0) { @@ -306,7 +306,7 @@ moo_file_selector_activate (MooFileView *fileview, if (is_text) moo_editor_open_path (moo_edit_window_get_editor (filesel->window), - path, NULL, -1, filesel->window); + path, nullptr, -1, filesel->window); else if (!is_exe) moo_open_file (path); } @@ -317,11 +317,11 @@ goto_current_doc_dir (MooFileSelector *filesel) { MooEdit *doc; GFile *file, *parent_file; - GError *error = NULL; + GError *error = nullptr; doc = moo_edit_window_get_active_doc (filesel->window); - file = doc ? moo_edit_get_file (doc) : NULL; - parent_file = file ? g_file_get_parent (file) : NULL; + file = doc ? moo_edit_get_file (doc) : nullptr; + parent_file = file ? g_file_get_parent (file) : nullptr; if (parent_file) { @@ -375,7 +375,7 @@ create_new_file_dialog (GtkWidget *parent, char *display_dirname, *label_text; display_dirname = g_filename_display_basename (dirname); - g_return_val_if_fail (display_dirname != NULL, NULL); + g_return_val_if_fail (display_dirname != nullptr, nullptr); *xml = new_file_dialog_xml_new (); dialog = GTK_WIDGET ((*xml)->NewFileDialog); @@ -403,12 +403,12 @@ new_file_dialog (GtkWidget *parent, const char *dirname, const char *start_name) { - NewFileDialogXml *xml = NULL; - GtkWidget *dialog = NULL; - GtkEntry *entry = NULL; - char *fullname = NULL; + NewFileDialogXml *xml = nullptr; + GtkWidget *dialog = nullptr; + GtkEntry *entry = nullptr; + char *fullname = nullptr; - g_return_val_if_fail (dirname != NULL, NULL); + g_return_val_if_fail (dirname != nullptr, nullptr); while (TRUE) { @@ -419,7 +419,7 @@ new_file_dialog (GtkWidget *parent, if (!dialog) { dialog = create_new_file_dialog (parent, dirname, start_name, &xml); - g_return_val_if_fail (dialog != NULL, NULL); + g_return_val_if_fail (dialog != nullptr, nullptr); entry = GTK_ENTRY (xml->entry); } @@ -435,7 +435,7 @@ new_file_dialog (GtkWidget *parent, } /* XXX error checking, you know */ - name = g_filename_from_utf8 (text, -1, NULL, NULL, NULL); + name = g_filename_from_utf8 (text, -1, nullptr, nullptr, nullptr); if (!name) { @@ -450,18 +450,18 @@ new_file_dialog (GtkWidget *parent, continue; } - fullname = g_build_filename (dirname, name, NULL); + fullname = g_build_filename (dirname, name, nullptr); g_free (name); if (!g_file_test (fullname, G_FILE_TEST_EXISTS)) goto out; err_text = g_strdup_printf (_("File '%s' already exists"), text); - moo_error_dialog (err_text, NULL, dialog); + moo_error_dialog (err_text, nullptr, dialog); g_free (err_text); g_free (fullname); - fullname = NULL; + fullname = nullptr; } out: @@ -474,9 +474,9 @@ out: static void file_selector_create_file (MooFileSelector *filesel) { - char *path = NULL, *dir = NULL; + char *path = nullptr, *dir = nullptr; MooEdit *doc; - GList *selected = NULL; + GList *selected = nullptr; MooOpenInfo *info; selected = _moo_file_view_get_filenames (MOO_FILE_VIEW (filesel)); @@ -491,18 +491,18 @@ file_selector_create_file (MooFileSelector *filesel) dir = (char*) selected->data; g_list_free (selected); - selected = NULL; + selected = nullptr; if (!g_file_test (dir, G_FILE_TEST_IS_DIR)) { g_free (dir); - dir = NULL; + dir = nullptr; } } if (!dir) { - g_object_get (filesel, "current-directory", &dir, NULL); + g_object_get (filesel, "current-directory", &dir, nullptr); if (!dir) goto out; @@ -513,18 +513,18 @@ file_selector_create_file (MooFileSelector *filesel) if (!path) goto out; - info = moo_open_info_new (path, NULL, -1, MOO_OPEN_FLAGS_NONE); + info = moo_open_info_new (path, nullptr, -1, MOO_OPEN_FLAGS_NONE); doc = moo_editor_new_file (moo_edit_window_get_editor (filesel->window), - info, GTK_WIDGET (filesel), NULL); + info, GTK_WIDGET (filesel), nullptr); g_object_unref (info); if (doc) - moo_edit_save (doc, NULL); + moo_edit_save (doc, nullptr); out: g_free (path); g_free (dir); - g_list_foreach (selected, (GFunc) g_free, NULL); + g_list_foreach (selected, (GFunc) g_free, nullptr); g_list_free (selected); } @@ -532,8 +532,8 @@ out: static void file_selector_open_files (MooFileSelector *filesel) { - GList *selected = NULL; - GList *files = NULL; + GList *selected = nullptr; + GList *files = nullptr; selected = _moo_file_view_get_filenames (MOO_FILE_VIEW (filesel)); @@ -560,7 +560,7 @@ file_selector_open_files (MooFileSelector *filesel) while (files) { moo_editor_open_path (moo_edit_window_get_editor (filesel->window), - (const char*) files->data, NULL, -1, filesel->window); + (const char*) files->data, nullptr, -1, filesel->window); g_free (files->data); files = g_list_delete_link (files, files); } @@ -570,7 +570,7 @@ static void notify_show_hidden_files (MooFileSelector *filesel) { gboolean show = FALSE; - g_object_get (filesel, "show-hidden-files", &show, NULL); + g_object_get (filesel, "show-hidden-files", &show, nullptr); moo_prefs_set_bool (PREFS_HIDDEN_FILES, show); } @@ -596,14 +596,14 @@ moo_file_selector_constructor (GType type, filesel = MOO_FILE_SELECTOR (object); fileview = MOO_FILE_VIEW (object); - g_return_val_if_fail (filesel->window != NULL, object); + g_return_val_if_fail (filesel->window != nullptr, object); file_selector_go_home (MOO_FILE_VIEW (fileview)); - g_object_set (fileview, "show-hidden-files", moo_prefs_get_bool (PREFS_HIDDEN_FILES), NULL); - g_signal_connect (fileview, "notify::show-hidden-files", G_CALLBACK (notify_show_hidden_files), NULL); + g_object_set (fileview, "show-hidden-files", moo_prefs_get_bool (PREFS_HIDDEN_FILES), nullptr); + g_signal_connect (fileview, "notify::show-hidden-files", G_CALLBACK (notify_show_hidden_files), nullptr); - group = moo_action_collection_get_group (moo_file_view_get_actions (MOO_FILE_VIEW (fileview)), NULL); + group = moo_action_collection_get_group (moo_file_view_get_actions (MOO_FILE_VIEW (fileview)), nullptr); xml = moo_file_view_get_ui_xml (MOO_FILE_VIEW (fileview)); merge_id = moo_ui_xml_new_merge_id (xml); @@ -612,7 +612,7 @@ moo_file_selector_constructor (GType type, "tooltip", _("Go to current document directory"), "closure-object", fileview, "closure-signal", "goto-current-doc-dir", - NULL); + nullptr); moo_ui_xml_insert_markup (xml, merge_id, "MooFileView/Toolbar", -1, ""); @@ -626,14 +626,14 @@ moo_file_selector_constructor (GType type, "stock-id", GTK_STOCK_NEW, "closure-object", filesel, "closure-callback", file_selector_create_file, - NULL); + nullptr); moo_action_group_add_action (group, "Open", "label", GTK_STOCK_OPEN, "tooltip", GTK_STOCK_OPEN, "stock-id", GTK_STOCK_OPEN, "closure-object", filesel, "closure-callback", file_selector_open_files, - NULL); + nullptr); moo_ui_xml_insert_markup_before (xml, merge_id, "MooFileView/Menu", "NewFolder", @@ -644,14 +644,14 @@ moo_file_selector_constructor (GType type, ""); label = moo_pane_label_new (MOO_STOCK_FILE_SELECTOR, - NULL, _("File Selector"), + nullptr, _("File Selector"), _("File Selector")); moo_edit_window_add_pane (filesel->window, MOO_FILE_SELECTOR_PLUGIN_ID, GTK_WIDGET (filesel), label, MOO_PANE_POS_RIGHT); moo_pane_label_free (label); pane = moo_big_paned_find_pane (filesel->window->paned, - GTK_WIDGET (filesel), NULL); + GTK_WIDGET (filesel), nullptr); moo_pane_set_drag_dest (pane); return object; @@ -773,12 +773,12 @@ save_as_dialog (GtkWidget *parent, gboolean ask_name, const char *title) { - SaveAsDialogXml *xml = NULL; - GtkWidget *dialog = NULL; - GtkEntry *entry = NULL; - char *fullname = NULL; + SaveAsDialogXml *xml = nullptr; + GtkWidget *dialog = nullptr; + GtkEntry *entry = nullptr; + char *fullname = nullptr; - g_return_val_if_fail (dirname != NULL, NULL); + g_return_val_if_fail (dirname != nullptr, nullptr); while (TRUE) { @@ -811,7 +811,7 @@ save_as_dialog (GtkWidget *parent, } /* XXX error checking, you know */ - name = g_filename_from_utf8 (text, -1, NULL, NULL, NULL); + name = g_filename_from_utf8 (text, -1, nullptr, nullptr, nullptr); if (!name) { @@ -826,7 +826,7 @@ save_as_dialog (GtkWidget *parent, continue; } - fullname = g_build_filename (dirname, name, NULL); + fullname = g_build_filename (dirname, name, nullptr); g_free (name); if (!g_file_test (fullname, G_FILE_TEST_EXISTS)) @@ -842,7 +842,7 @@ save_as_dialog (GtkWidget *parent, g_free (display_dirname); g_free (fullname); - fullname = NULL; + fullname = nullptr; } out: @@ -858,7 +858,7 @@ moo_file_selector_select_path (MooFileSelector *filesel, { char *basename; - g_return_if_fail (filename != NULL); + g_return_if_fail (filename != nullptr); basename = g_path_get_basename (filename); _moo_file_view_select_name (MOO_FILE_VIEW (filesel), basename); @@ -882,8 +882,8 @@ save_as_path (MooEdit *doc, { MooSaveInfo *info; gboolean result; - info = moo_save_info_new (path, NULL); - result = moo_edit_save_as (doc, info, NULL); + info = moo_save_info_new (path, nullptr); + result = moo_edit_save_as (doc, info, nullptr); g_object_unref (info); return result; } @@ -953,8 +953,8 @@ doc_save_copy (MooFileSelector *filesel, if (filename) { - MooSaveInfo *info = moo_save_info_new (filename, NULL); - if (moo_edit_save_copy (doc, info, NULL)) + MooSaveInfo *info = moo_save_info_new (filename, nullptr); + if (moo_edit_save_copy (doc, info, nullptr)) moo_file_selector_select_path (filesel, filename); g_object_unref (info); g_free (filename); @@ -971,7 +971,7 @@ doc_move (MooFileSelector *filesel, char *filename; old_file = moo_edit_get_file (doc); - g_return_if_fail (old_file != NULL); + g_return_if_fail (old_file != nullptr); filename = save_as_dialog (GTK_WIDGET (filesel), destdir, moo_edit_get_display_basename (doc), @@ -981,7 +981,7 @@ doc_move (MooFileSelector *filesel, { if (save_as_path (doc, filename)) { - g_file_delete (old_file, NULL, NULL); + g_file_delete (old_file, nullptr, nullptr); moo_file_selector_select_path (filesel, filename); } @@ -1014,7 +1014,7 @@ drop_item_activated (GObject *item, doc = (MooEdit*) g_object_get_data (item, "moo-file-selector-drop-doc"); destdir = (char*) g_object_get_data (item, "moo-file-selector-drop-destdir"); alternate = GPOINTER_TO_INT (g_object_get_data (item, "moo-menu-item-alternate")); - g_return_if_fail (doc != NULL && destdir != NULL); + g_return_if_fail (doc != nullptr && destdir != nullptr); action = (DropDocAction) GPOINTER_TO_INT (data); @@ -1086,7 +1086,7 @@ alternate_toggled (GtkWidget *menu) items = (GSList*) g_object_get_data (G_OBJECT (menu), "moo-menu-items"); - for (l = items; l != NULL; l = l->next) + for (l = items; l != nullptr; l = l->next) { GtkWidget *item = (GtkWidget*) l->data; const char *label; @@ -1108,10 +1108,10 @@ create_drop_doc_menu (MooFileSelector *filesel, const char *destdir) { GtkWidget *menu, *item; - GSList *items = NULL; + GSList *items = nullptr; menu = moo_menu_new (); - g_signal_connect (menu, "alternate-toggled", G_CALLBACK (alternate_toggled), NULL); + g_signal_connect (menu, "alternate-toggled", G_CALLBACK (alternate_toggled), nullptr); item = create_menu_item (filesel, doc, destdir, MOO_STOCK_FILE_MOVE, @@ -1147,7 +1147,7 @@ create_drop_doc_menu (MooFileSelector *filesel, gtk_widget_show (item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - item = gtk_image_menu_item_new_from_stock (GTK_STOCK_CANCEL, NULL); + item = gtk_image_menu_item_new_from_stock (GTK_STOCK_CANCEL, nullptr); gtk_widget_show (item); _moo_menu_item_set_accel_label (item, "Escape"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -1170,7 +1170,7 @@ moo_file_selector_drop_doc (MooFileSelector *filesel, DropDocAction action; g_return_if_fail (MOO_IS_EDIT (doc)); - g_return_if_fail (destdir != NULL); + g_return_if_fail (destdir != nullptr); g_return_if_fail (GTK_IS_WIDGET (widget)); if (moo_edit_is_untitled (doc)) @@ -1197,7 +1197,7 @@ moo_file_selector_drop_doc (MooFileSelector *filesel, GtkWidget *menu = create_drop_doc_menu (filesel, doc, destdir); g_object_ref_sink (menu); _moo_file_view_drag_finish (MOO_FILE_VIEW (filesel), context, TRUE, FALSE, time); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, 0); + gtk_menu_popup (GTK_MENU (menu), nullptr, nullptr, nullptr, nullptr, 0, 0); g_object_unref (menu); return; } @@ -1228,7 +1228,7 @@ moo_file_selector_drop_doc (MooFileSelector *filesel, static gboolean file_selector_plugin_init (G_GNUC_UNUSED Plugin *plugin) { - moo_prefs_create_key (PREFS_LAST_DIR, MOO_PREFS_STATE, G_TYPE_STRING, NULL); + moo_prefs_create_key (PREFS_LAST_DIR, MOO_PREFS_STATE, G_TYPE_STRING, nullptr); moo_prefs_create_key (PREFS_HIDDEN_FILES, MOO_PREFS_RC, G_TYPE_BOOLEAN, FALSE); return TRUE; } @@ -1239,7 +1239,7 @@ file_selector_plugin_deinit (Plugin *plugin) { if (plugin->bookmark_mgr) g_object_unref (plugin->bookmark_mgr); - plugin->bookmark_mgr = NULL; + plugin->bookmark_mgr = nullptr; } @@ -1258,7 +1258,7 @@ file_selector_plugin_attach (MooPlugin *mplugin, g_object_new (MOO_TYPE_FILE_SELECTOR, "bookmark-mgr", plugin->bookmark_mgr, "window", window, - (const char*) NULL)); + (const char*) nullptr)); plugin->instances = g_slist_prepend (plugin->instances, filesel); } @@ -1271,7 +1271,7 @@ file_selector_plugin_detach (MooPlugin *mplugin, Plugin *plugin = FILE_SELECTOR_PLUGIN (mplugin); GtkWidget *filesel = moo_edit_window_get_pane (window, MOO_FILE_SELECTOR_PLUGIN_ID); - g_return_if_fail (filesel != NULL); + g_return_if_fail (filesel != nullptr); plugin->instances = g_slist_remove (plugin->instances, filesel); moo_edit_window_remove_pane (window, MOO_FILE_SELECTOR_PLUGIN_ID); @@ -1282,7 +1282,7 @@ void _moo_file_selector_update_tools (MooPlugin *plugin) { GSList *l; - for (l = ((Plugin*)plugin)->instances; l != NULL; l = l->next) + for (l = ((Plugin*)plugin)->instances; l != nullptr; l = l->next) _moo_file_view_tools_load ((MooFileView*) l->data); } @@ -1294,7 +1294,7 @@ MOO_PLUGIN_DEFINE_INFO (file_selector, MOO_VERSION) MOO_PLUGIN_DEFINE (FileSelector, file_selector, file_selector_plugin_attach, file_selector_plugin_detach, - NULL, NULL, + nullptr, nullptr, _moo_file_selector_prefs_page, 0, 0) @@ -1304,7 +1304,7 @@ get_widget_meth (G_GNUC_UNUSED gpointer plugin, MooEditWindow *window) { gpointer widget = moo_edit_window_get_pane (window, MOO_FILE_SELECTOR_PLUGIN_ID); - return widget ? g_object_ref (widget) : NULL; + return widget ? g_object_ref (widget) : nullptr; } @@ -1316,7 +1316,7 @@ _moo_file_selector_plugin_init (void) if (!moo_plugin_register (MOO_FILE_SELECTOR_PLUGIN_ID, ptype, &file_selector_plugin_info, - NULL)) + nullptr)) return FALSE; moo_plugin_method_new ("get-widget", ptype, diff --git a/moo/plugins/moofind.cpp b/moo/plugins/moofind.cpp index f20befdb..d52f5eb2 100644 --- a/moo/plugins/moofind.cpp +++ b/moo/plugins/moofind.cpp @@ -206,7 +206,7 @@ ensure_output (WindowStuff *stuff) "foreground", "#008040", NULL); stuff->error_tag = moo_text_view_lookup_tag (MOO_TEXT_VIEW (stuff->output), "error"); - g_object_set (stuff->error_tag, "foreground", "#C00000", NULL); + g_object_set (stuff->error_tag, "foreground", "#C00000", nullptr); stuff->message_tag = moo_text_view_lookup_tag (MOO_TEXT_VIEW (stuff->output), "message"); @@ -255,7 +255,7 @@ find_plugin_init (FindPlugin *plugin) "default-accel", MOO_EDIT_ACCEL_FIND_IN_FILES, "stock-id", MOO_STOCK_FIND_IN_FILES, "closure-callback", find_in_files_cb, - NULL); + nullptr); #ifndef __WIN32__ moo_window_class_new_action (klass, "FindFile", NULL, @@ -264,7 +264,7 @@ find_plugin_init (FindPlugin *plugin) "tooltip", _("Find file"), "stock-id", MOO_STOCK_FIND_FILE, "closure-callback", find_file_cb, - NULL); + nullptr); #endif if (xml) @@ -321,7 +321,7 @@ setup_file_combo (MooHistoryCombo *hist_combo) GtkWidget *entry; MooFileEntryCompletion *completion; - g_object_set (hist_combo, "enable-completion", FALSE, NULL); + g_object_set (hist_combo, "enable-completion", FALSE, nullptr); entry = MOO_COMBO (hist_combo)->entry; completion = MOO_FILE_ENTRY_COMPLETION ( diff --git a/moo/plugins/support/moocmdview.cpp b/moo/plugins/support/moocmdview.cpp index cf6c5432..002723fa 100644 --- a/moo/plugins/support/moocmdview.cpp +++ b/moo/plugins/support/moocmdview.cpp @@ -181,8 +181,8 @@ moo_cmd_view_constructor (GType type, view->priv->stdout_tag = gtk_text_buffer_create_tag (buffer, "stdout", NULL); view->priv->stderr_tag = gtk_text_buffer_create_tag (buffer, "stderr", NULL); - g_object_set (view->priv->error_tag, "foreground", "red", NULL); - g_object_set (view->priv->stderr_tag, "foreground", "red", NULL); + g_object_set (view->priv->error_tag, "foreground", "red", nullptr); + g_object_set (view->priv->stderr_tag, "foreground", "red", nullptr); return object; } diff --git a/moo/plugins/support/moocmdview.h b/moo/plugins/support/moocmdview.h index 2baa4c8e..faa1a5a2 100644 --- a/moo/plugins/support/moocmdview.h +++ b/moo/plugins/support/moocmdview.h @@ -36,13 +36,16 @@ G_BEGIN_DECLS typedef struct _MooCmdViewPrivate MooCmdViewPrivate; -struct MooCmdView : public MooLineView +struct MooCmdView { + MooLineView parent; MooCmdViewPrivate *priv; }; -struct MooCmdViewClass : public MooLineViewClass +struct MooCmdViewClass { + MooLineViewClass parent_class; + void (*job_started) (MooCmdView *view, const char *job_name); void (*job_finished)(MooCmdView *view); diff --git a/moo/plugins/support/moolineview.cpp b/moo/plugins/support/moolineview.cpp index 183ce6a0..5033b407 100644 --- a/moo/plugins/support/moolineview.cpp +++ b/moo/plugins/support/moolineview.cpp @@ -138,7 +138,7 @@ moo_line_view_init (MooLineView *view) "cursor-visible", FALSE, "current-line-color", "grey", "highlight-matching-brackets", FALSE, - NULL); + nullptr); } @@ -527,7 +527,7 @@ check_if_scrolled (MooLineView *view) if (view->priv->hscrollbar && GTK_WIDGET_VISIBLE (view->priv->hscrollbar)) { int space; - gtk_widget_style_get (GTK_WIDGET (view)->parent, "scrollbar-spacing", &space, NULL); + gtk_widget_style_get (GTK_WIDGET (view)->parent, "scrollbar-spacing", &space, nullptr); delta = MAX (delta - 1, space + view->priv->hscrollbar->allocation.height) + 1; } @@ -578,14 +578,14 @@ moo_line_view_write (MooLineView *view, if (g_utf8_validate (text, len, NULL)) { - gtk_text_buffer_insert_with_tags (buffer, &iter, text, len, tag, NULL); + gtk_text_buffer_insert_with_tags (buffer, &iter, text, len, tag, nullptr); } else { char *text_utf8 = g_locale_to_utf8 (text, len, NULL, NULL, NULL); if (text_utf8) - gtk_text_buffer_insert_with_tags (buffer, &iter, text_utf8, -1, tag, NULL); + gtk_text_buffer_insert_with_tags (buffer, &iter, text_utf8, -1, tag, nullptr); else g_warning ("could not convert '%s' to utf8", text); diff --git a/moo/plugins/support/moolineview.h b/moo/plugins/support/moolineview.h index 492bbb66..9a897fd0 100644 --- a/moo/plugins/support/moolineview.h +++ b/moo/plugins/support/moolineview.h @@ -32,13 +32,16 @@ G_BEGIN_DECLS typedef struct _MooLineViewPrivate MooLineViewPrivate; -struct MooLineView : public MooTextView +struct MooLineView { + MooTextView parent; MooLineViewPrivate *priv; }; -struct MooLineViewClass : public MooTextViewClass +struct MooLineViewClass { + MooTextViewClass parent_class; + void (*activate) (MooLineView *view, int line); }; diff --git a/moo/plugins/support/moooutputfilter.cpp b/moo/plugins/support/moooutputfilter.cpp index 5c0066bc..2017a92c 100644 --- a/moo/plugins/support/moooutputfilter.cpp +++ b/moo/plugins/support/moooutputfilter.cpp @@ -368,7 +368,7 @@ find_file_in_dirs (const char *filename, { for ( ; dirs && *dirs; ++dirs) { - char *path = g_build_filename (*dirs, filename, NULL); + char *path = g_build_filename (*dirs, filename, nullptr); if (g_file_test (path, G_FILE_TEST_EXISTS)) return path; g_free (path); diff --git a/moo/plugins/support/moooutputfilter.h b/moo/plugins/support/moooutputfilter.h index d36da188..55fbecc2 100644 --- a/moo/plugins/support/moooutputfilter.h +++ b/moo/plugins/support/moooutputfilter.h @@ -39,13 +39,16 @@ struct _MooFileLineData { int character; }; -struct MooOutputFilter : public GObject +struct MooOutputFilter { + GObject parent; MooOutputFilterPrivate *priv; }; -struct MooOutputFilterClass : public GObjectClass +struct MooOutputFilterClass { + GObjectClass parent_class; + void (*attach) (MooOutputFilter *filter); void (*detach) (MooOutputFilter *filter); diff --git a/moo/plugins/usertools/moocommand-exe.cpp b/moo/plugins/usertools/moocommand-exe.cpp index 3aa09482..9062b115 100644 --- a/moo/plugins/usertools/moocommand-exe.cpp +++ b/moo/plugins/usertools/moocommand-exe.cpp @@ -957,7 +957,7 @@ init_combo (GtkComboBox *combo, cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 0, NULL); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 0, nullptr); store = gtk_list_store_new (1, G_TYPE_STRING); @@ -984,7 +984,7 @@ init_filter_combo (GtkComboBox *combo) cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, - "text", COLUMN_NAME, NULL); + "text", COLUMN_NAME, nullptr); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); diff --git a/moo/plugins/usertools/moocommanddisplay.cpp b/moo/plugins/usertools/moocommanddisplay.cpp index c6e762ff..6d7406d2 100644 --- a/moo/plugins/usertools/moocommanddisplay.cpp +++ b/moo/plugins/usertools/moocommanddisplay.cpp @@ -223,7 +223,7 @@ init_factory_combo (MooCommandDisplay *display, cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (display->factory_combo), cell, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (display->factory_combo), cell, "text", 0, NULL); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (display->factory_combo), cell, "text", 0, nullptr); store = gtk_list_store_new (1, G_TYPE_STRING); diff --git a/moo/plugins/usertools/moooutputfilterregex.cpp b/moo/plugins/usertools/moooutputfilterregex.cpp index fc3e8238..c0982ca6 100644 --- a/moo/plugins/usertools/moooutputfilterregex.cpp +++ b/moo/plugins/usertools/moooutputfilterregex.cpp @@ -184,7 +184,7 @@ find_file_in_dir (const char *file, if (!file || !dir) return NULL; - path = g_build_filename (dir, file, NULL); + path = g_build_filename (dir, file, nullptr); if (g_file_test (path, G_FILE_TEST_EXISTS)) return path; @@ -401,7 +401,7 @@ get_tag (MooLineView *view, _moo_text_style_apply_to_tag (style, tag); else if (type == OUTPUT_STDERR || !strcmp (name, "output-error") || !strcmp (name, "output-stderr")) - g_object_set (tag, "foreground", "red", NULL); + g_object_set (tag, "foreground", "red", nullptr); } return tag; diff --git a/moo/plugins/usertools/moousertools-prefs.cpp b/moo/plugins/usertools/moousertools-prefs.cpp index 4e002517..09ea84e2 100644 --- a/moo/plugins/usertools/moousertools-prefs.cpp +++ b/moo/plugins/usertools/moousertools-prefs.cpp @@ -404,7 +404,7 @@ name_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column, gtk_tree_model_get (model, iter, COLUMN_INFO, &info, -1); g_return_if_fail (info != NULL); - g_object_set (cell, "text", info->name, NULL); + g_object_set (cell, "text", info->name, nullptr); _moo_user_tool_info_unref (info); } @@ -466,7 +466,7 @@ command_page_init (MooPrefsPage *page, (GtkTreeCellDataFunc) name_data_func, NULL, NULL); gtk_tree_view_append_column (gxml->treeview, column); - g_object_set (cell, "editable", TRUE, NULL); + g_object_set (cell, "editable", TRUE, nullptr); g_signal_connect_swapped (cell, "edited", G_CALLBACK (name_cell_edited), page); populate_store (store, type); diff --git a/moo/plugins/usertools/moousertools.cpp b/moo/plugins/usertools/moousertools.cpp index 13a86bd4..9057f191 100644 --- a/moo/plugins/usertools/moousertools.cpp +++ b/moo/plugins/usertools/moousertools.cpp @@ -399,7 +399,7 @@ load_tool (MooUserToolInfo *info) "label", label, "default-accel", info->accel, "command", cmd, - NULL); + nullptr); moo_edit_window_set_action_check (info->id, MOO_ACTION_CHECK_SENSITIVE, check_sensitive_func, @@ -417,7 +417,7 @@ load_tool (MooUserToolInfo *info) "default-accel", info->accel, "command", cmd, "file-filter", info->filter, - NULL); + nullptr); break; } @@ -639,7 +639,7 @@ load_directory (const char *path, { char *filename; - filename = g_build_filename (path, names->pdata[i], NULL); + filename = g_build_filename (path, names->pdata[i], nullptr); load_file (filename, (const char*) names->pdata[i], type, list, ids); g_free (filename); @@ -1321,7 +1321,7 @@ moo_tool_action_check_state (MooEditAction *edit_action) doc = moo_edit_action_get_doc (edit_action); sensitive = moo_command_check_sensitive (action->cmd, doc); - g_object_set (action, "sensitive", sensitive, NULL); + g_object_set (action, "sensitive", sensitive, nullptr); }