Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use the new "geany-startup-complete" signal to initially update the t…
…asks list.

git-svn-id: https://geany-plugins.svn.sourceforge.net/svnroot/geany-plugins/trunk/geany-plugins@1131 e8383189-8249-0410-b506-acc975200cbd
  • Loading branch information
eht16 committed Jan 17, 2010
1 parent 3fbaa8a commit f7f0942
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
7 changes: 7 additions & 0 deletions addons/ChangeLog
@@ -1,3 +1,10 @@
2010-01-17 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

* src/addons.c, src/ao_tasks.c, src/ao_tasks.h:
Use the new "geany-startup-complete" signal to initially update
the tasks list.


2010-01-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2010-01-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>


* AUTHORS, README, src/ao_blanklines.c, src/ao_blanklines.h, * AUTHORS, README, src/ao_blanklines.c, src/ao_blanklines.h,
Expand Down
10 changes: 9 additions & 1 deletion addons/src/addons.c
Expand Up @@ -39,7 +39,7 @@ GeanyData *geany_data;
GeanyFunctions *geany_functions; GeanyFunctions *geany_functions;




PLUGIN_VERSION_CHECK(165) PLUGIN_VERSION_CHECK(170)
PLUGIN_SET_INFO(_("Addons"), _("Various small addons for Geany."), VERSION, PLUGIN_SET_INFO(_("Addons"), _("Various small addons for Geany."), VERSION,
"Enrico Tröger, Bert Vermeulen, Eugene Arshinov") "Enrico Tröger, Bert Vermeulen, Eugene Arshinov")


Expand Down Expand Up @@ -89,6 +89,7 @@ static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data)
static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data); static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data);
static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointer data); static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointer data);
static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data); static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data);
static void ao_startup_complete_cb(GObject *obj, gpointer data);
gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor, gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor,
SCNotification *nt, gpointer data); SCNotification *nt, gpointer data);


Expand All @@ -103,11 +104,18 @@ PluginCallback plugin_callbacks[] =
{ "document-close", (GCallback) &ao_document_close_cb, TRUE, NULL }, { "document-close", (GCallback) &ao_document_close_cb, TRUE, NULL },
{ "document-activate", (GCallback) &ao_document_activate_cb, TRUE, NULL }, { "document-activate", (GCallback) &ao_document_activate_cb, TRUE, NULL },
{ "document-before-save", (GCallback) &ao_document_before_save_cb, TRUE, NULL }, { "document-before-save", (GCallback) &ao_document_before_save_cb, TRUE, NULL },
{ "geany-startup-complete", (GCallback) &ao_startup_complete_cb, TRUE, NULL },


{ NULL, NULL, FALSE, NULL } { NULL, NULL, FALSE, NULL }
}; };




static void ao_startup_complete_cb(GObject *obj, gpointer data)
{
ao_tasks_set_active(ao_info->tasks);
}


static void kb_bmlist_activate(guint key_id) static void kb_bmlist_activate(guint key_id)
{ {
ao_bookmark_list_activate(ao_info->bookmarklist); ao_bookmark_list_activate(ao_info->bookmarklist);
Expand Down
32 changes: 9 additions & 23 deletions addons/src/ao_tasks.c
Expand Up @@ -383,22 +383,6 @@ static GtkWidget *create_popup_menu(AoTasks *t)
} }




static gboolean update_list_delay(gpointer t)
{
/* TODO add a signal in Geany when the main window is realised or the startup process
* has been in general */
if (main_is_realized())
{
AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
priv->active = TRUE;
ao_tasks_update(AO_TASKS(t), NULL);
return FALSE;
}
else
return TRUE;
}


static void ao_tasks_show(AoTasks *t) static void ao_tasks_show(AoTasks *t)
{ {
GtkCellRenderer *text_renderer; GtkCellRenderer *text_renderer;
Expand Down Expand Up @@ -489,13 +473,6 @@ static void ao_tasks_show(AoTasks *t)
gtk_label_new(_("Tasks"))); gtk_label_new(_("Tasks")));


priv->popup_menu = create_popup_menu(t); priv->popup_menu = create_popup_menu(t);

/* initial update */
#if GLIB_CHECK_VERSION(2, 14, 0)
g_timeout_add_seconds(3, update_list_delay, t);
#else
g_timeout_add(3, update_list_delay, t);
#endif
} }




Expand Down Expand Up @@ -665,6 +642,15 @@ static gboolean ao_tasks_select_task(GtkTreeModel *model, GtkTreePath *path,
} }




void ao_tasks_set_active(AoTasks *t)
{
AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
priv->active = TRUE;

ao_tasks_update(t, NULL);
}


void ao_tasks_update(AoTasks *t, GeanyDocument *cur_doc) void ao_tasks_update(AoTasks *t, GeanyDocument *cur_doc)
{ {
AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t); AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
Expand Down
1 change: 1 addition & 0 deletions addons/src/ao_tasks.h
Expand Up @@ -43,6 +43,7 @@ void ao_tasks_update (AoTasks *t, GeanyDocument *cur_doc);
void ao_tasks_update_single (AoTasks *t, GeanyDocument *cur_doc); void ao_tasks_update_single (AoTasks *t, GeanyDocument *cur_doc);
void ao_tasks_remove (AoTasks *t, GeanyDocument *cur_doc); void ao_tasks_remove (AoTasks *t, GeanyDocument *cur_doc);
void ao_tasks_activate (AoTasks *t); void ao_tasks_activate (AoTasks *t);
void ao_tasks_set_active (AoTasks *t);


G_END_DECLS G_END_DECLS


Expand Down

0 comments on commit f7f0942

Please sign in to comment.