Skip to content

Commit

Permalink
Use DOC_VALID macro across the Addons plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
eht16 committed Aug 1, 2023
1 parent d975ce3 commit b1ba03c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions addons/src/addons.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ static gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor,
static void ao_update_editor_menu_cb(GObject *obj, const gchar *word, gint pos,
GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_open_uri_update_menu(ao_info->openuri, doc, pos);
}


static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_bookmark_list_update(ao_info->bookmarklist, doc);
ao_tasks_update_single(ao_info->tasks, doc);
Expand All @@ -154,7 +154,7 @@ static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer d

static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_mark_document_new(ao_info->markword, doc);
ao_color_tip_document_new(ao_info->colortip, doc);
Expand All @@ -163,7 +163,7 @@ static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data)

static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_tasks_update(ao_info->tasks, doc);
ao_mark_document_open(ao_info->markword, doc);
Expand All @@ -173,7 +173,7 @@ static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data)

static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_tasks_remove(ao_info->tasks, doc);
ao_mark_document_close(ao_info->markword, doc);
Expand All @@ -183,23 +183,23 @@ static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data

static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_tasks_update(ao_info->tasks, doc);
}


static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_blanklines_on_document_before_save(obj, doc, data);
}


static void ao_document_reload_cb(GObject *obj, GeanyDocument *doc, gpointer data)
{
g_return_if_fail(doc != NULL && doc->is_valid);
g_return_if_fail(DOC_VALID(doc));

ao_tasks_update(ao_info->tasks, doc);
}
Expand Down
4 changes: 2 additions & 2 deletions addons/src/ao_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static gboolean update_tasks_for_doc_idle_cb(gpointer data)
priv = AO_TASKS_GET_PRIVATE(arguments->t);
doc = arguments->doc;

if (doc->is_valid && priv->active && priv->enable_tasks)
if (DOC_VALID(doc) && priv->active && priv->enable_tasks)
{
if (arguments->clear)
ao_tasks_remove(arguments->t, doc);
Expand Down Expand Up @@ -641,7 +641,7 @@ static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc, gboolean clear)
arguments->doc = doc;
arguments->clear = clear;

if (!doc->is_valid)
if (!DOC_VALID(doc))
return;

/* Check for task tokens in an idle callback to wait until Geany applied Scintilla highlighting
Expand Down

0 comments on commit b1ba03c

Please sign in to comment.