From f15d42c979ca1f705f5deab408816379965488ea Mon Sep 17 00:00:00 2001 From: Jasper Huijsmans Date: Fri, 23 Apr 2004 12:19:56 +0000 Subject: [PATCH] Update plugin list (remove uninstalled and add newly installed ones) when opening the add item dialog. Based on the idea of Scott Barron . (Old svn revision: 4016) --- TODO | 39 +++++++++++++--------- panel/controls.c | 83 +++++++++++++++++++++++++++++++++++++---------- po/ca.gmo | Bin 6297 -> 6408 bytes 3 files changed, 89 insertions(+), 33 deletions(-) diff --git a/TODO b/TODO index 79e1c1db..39b7b838 100644 --- a/TODO +++ b/TODO @@ -1,30 +1,39 @@ TODO ---- -* gtk widgets (panel, controls) - - include move handles (steal code form GtkHandlebox) - - use properties and signals for settings - - perhaps use interfaces or derived widgets for controls -* unload unused plugins +* [DONE] unload unused plugins * plugin library - with API docs * smarter resize/move - - popup arrow direction - - keep panel on same x/y alignment + - [DONE] popup arrow direction + - [DONE] keep panel on same x/y alignment + - save 'centered' state to better keep the panel aligned? +* [DONE] use icon theme spec +* [DONE] Move the exec_cmd stuff to libxfce4util/libxfcegui4 +* [DONE] Move to glib xml parsing. More work, but more speed / + reduced memory usage * multiple panels - Most settings should become per panel -* use icon theme spec -* drag to add/remove -* drag to move -* taskbar == panel instance? -* Move the exec_cmd stuff to libxfce4util/libxfcegui4 + - multiscreen + - taskbar == panel instance? +* beter DND support + - add/remove + - move +* gtk widgets (panel, controls) + - include move handles (steal code form GtkHandlebox) + - use properties and signals for settings + - perhaps use interfaces or derived widgets for controls Ideas ----- * plugins: - dockapps support - iconbox / task list -* Move to glib xml parsing. More work, but more speed / - reduced memory usage * 2 plugins side by side (like systembuttons) - +* change icon themes to use a mapping between categories and icon names that + can be looked up using the icon theme spec? + e.g.: + [Xfce panel icon theme] + network=gnome-network + file1=xdg:folder + ... diff --git a/panel/controls.c b/panel/controls.c index afe3ad0a..fb4cd24c 100644 --- a/panel/controls.c +++ b/panel/controls.c @@ -91,6 +91,17 @@ static int unloading = 0; /* not static, must be available in panel.c for handle menu */ Control *popup_control = NULL; +/* convenience function */ +static void +wait_for_unloading (void) +{ + while (unloading) + { + DBG ("unloading in progress"); + g_usleep (200*1000); + } + +} /* ControlClass and ControlClassInfo * --------------------------------- @@ -189,12 +200,8 @@ control_class_info_create_control (ControlClassInfo *info, Control *control) return TRUE; } - while (unloading) - { - DBG ("unloading in progress"); - g_usleep (200*1000); - } - + wait_for_unloading(); + if (info->class->id == PLUGIN && info->refcount == 0 && info->class->gmodule == NULL) { @@ -269,17 +276,13 @@ load_plugin (gchar * path) if (g_slist_find_custom (control_class_info_list, cc->name, compare_class_info_by_name)) { - DBG ("\talready loaded"); - control_class_free (cc); control_class_info_free (info); } else { - DBG ("\tok"); - control_class_info_list = - g_slist_prepend (control_class_info_list, info); + g_slist_append (control_class_info_list, info); cc->filename = g_path_get_basename (path); info->path = g_strdup (path); @@ -332,14 +335,52 @@ add_plugin_classes (void) { char **dirs, **d; + wait_for_unloading (); + unloading++; + dirs = get_plugin_dirs (); for (d = dirs; *d; d++) load_plugin_dir (*d); + unloading--; g_strfreev (dirs); } +static void +clean_plugin_classes (void) +{ + GSList *li, *prev; + + prev = control_class_info_list; + + for (li = control_class_info_list->next; li; li = li->next) + { + ControlClassInfo *info = li->data; + + if (g_file_test (info->path, G_FILE_TEST_EXISTS) + || info->refcount > 0) + { + DBG ("plugin %s exists, %d in use", info->caption, info->refcount); + prev = li; + } + else + { + GSList *tmp; + + DBG ("plugin %s (%s) was removed", info->name, info->path); + + tmp = li; + li = prev; + li->next = tmp->next; + g_slist_free_1 (tmp); + + control_class_free (info->class); + control_class_info_free (info); + } + } +} + /* builtin launcher class */ static void @@ -356,7 +397,7 @@ add_launcher_class (void) info->name = g_strdup (cc->name); info->caption = g_strdup (cc->caption); - control_class_info_list = g_slist_append (control_class_info_list, info); + control_class_info_list = g_slist_append (NULL, info); } /* module unloading timeout */ @@ -404,9 +445,6 @@ control_class_list_init (void) add_launcher_class (); add_plugin_classes (); - /* reverse to get correct order */ - control_class_info_list = g_slist_reverse (control_class_info_list); - unload_id = g_timeout_add (UNLOAD_TIMEOUT, (GSourceFunc) unload_modules, NULL); } @@ -421,6 +459,7 @@ control_class_list_cleanup (void) if (unload_id) { g_source_remove (unload_id); + unload_id = 0; } for (li = control_class_info_list; li; li = li->next) @@ -497,13 +536,21 @@ control_class_unref (ControlClass *cclass) GSList * get_control_info_list (void) { - GSList *li; - GSList *infolist = NULL; + GSList *li, *infolist = NULL; + /* good place to remove plugins that are not in use and were + * uninstalled after the panel was started */ + clean_plugin_classes (); + + /* update module list */ + add_plugin_classes (); + for (li = control_class_info_list; li; li = li->next) { ControlClassInfo *info = li->data; - ControlInfo *ci = g_new0 (ControlInfo, 1); + ControlInfo *ci; + + ci = g_new0 (ControlInfo, 1); ci->name = g_strdup (info->name); ci->caption = g_strdup (info->caption); diff --git a/po/ca.gmo b/po/ca.gmo index 12f3cf325caa837b1e34d459248eef28c58ff56c..39b9adfb53445761f1fd2410dfafe2b430fe2a6c 100644 GIT binary patch delta 2592 zcmZA2e@xVM9LMnwg2)kY2U=i2p5md_p>hz4#xH*$nH3&sK&Bmd;Nf{RIjt${YG!k_ zm} z?=^Jd5lq8l$j1zF$uTBo&QO^`$3^Q1PNsbYLpY9_xGnvf-Kd3ok&oHKfV2U#Mg=;4jpZIJvkmAB)h7>Tl#yfg4ay5=U+PRn+)5Z2LX* z(msw_cmz{$43&wis0U2tshq5DGN@?60_0;nT-b~8S*vV+19GofhngUOnz$1+aTqy0 z(`&zf5;gBLsB!zPFQUdD#F$dmPelt3pw8?=)Xq<%Zajxta0oSS81>{oqQ;Hc{&D1E zl9`0FH7?YKi%<(LKy9c7wQfTu`PW2#I&@`%nuXu-_j-J;+h(anyr;j=S+R@-eXn4(etqt*D6}weG?~+D}{iP(QDa zQ5zdVE%3c{)cPB09zDJmNJnk70B=Pvmg6d9Xw3B5j{T@7KY=>iQ>Z8X2KD5lxD>CV z#`#E>tVAXtgN3*bJ*W-r##kPer>H1puORoDBi2t*6AoD~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