Skip to content
Browse files

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...
1 parent 3fbaa8a commit f7f09422f87139e29a94a14089ec5569a8cf062b @eht16 eht16 committed Jan 17, 2010
Showing with 26 additions and 24 deletions.
  1. +7 −0 addons/ChangeLog
  2. +9 −1 addons/src/addons.c
  3. +9 −23 addons/src/ao_tasks.c
  4. +1 −0 addons/src/ao_tasks.h
View
7 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>
* AUTHORS, README, src/ao_blanklines.c, src/ao_blanklines.h,
View
10 addons/src/addons.c
@@ -39,7 +39,7 @@ GeanyData *geany_data;
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(165)
+PLUGIN_VERSION_CHECK(170)
PLUGIN_SET_INFO(_("Addons"), _("Various small addons for Geany."), VERSION,
"Enrico Tröger, Bert Vermeulen, Eugene Arshinov")
@@ -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_before_save_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,
SCNotification *nt, gpointer data);
@@ -103,11 +104,18 @@ PluginCallback plugin_callbacks[] =
{ "document-close", (GCallback) &ao_document_close_cb, TRUE, NULL },
{ "document-activate", (GCallback) &ao_document_activate_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 }
};
+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)
{
ao_bookmark_list_activate(ao_info->bookmarklist);
View
32 addons/src/ao_tasks.c
@@ -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)
{
GtkCellRenderer *text_renderer;
@@ -489,13 +473,6 @@ static void ao_tasks_show(AoTasks *t)
gtk_label_new(_("Tasks")));
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
}
@@ -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)
{
AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
View
1 addons/src/ao_tasks.h
@@ -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_remove (AoTasks *t, GeanyDocument *cur_doc);
void ao_tasks_activate (AoTasks *t);
+void ao_tasks_set_active (AoTasks *t);
G_END_DECLS

0 comments on commit f7f0942

Please sign in to comment.
Something went wrong with that request. Please try again.