diff options
| author | Leandro Pereira <leandro@hardinfo.org> | 2009-04-30 10:30:47 +0000 | 
|---|---|---|
| committer | Leandro Pereira <leandro@hardinfo.org> | 2009-04-30 10:30:47 +0000 | 
| commit | 083768985c5d7f71c98891db7ba3be12e987f4ec (patch) | |
| tree | c4d77d88ce38d7142e22c6e48c6cd378689c5857 | |
| parent | 9db4d58b378d0811a836fee50292ab4a34a19297 (diff) | |
Make module unloading more reliable
| -rw-r--r-- | hardinfo2/shell.c | 20 | ||||
| -rw-r--r-- | hardinfo2/shell.h | 3 | ||||
| -rw-r--r-- | hardinfo2/util.c | 25 | 
3 files changed, 25 insertions, 23 deletions
| diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 3b6cdd59..96ec2010 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -82,6 +82,19 @@ void shell_ui_manager_set_visible(const gchar * path, gboolean setting)  	gtk_widget_hide(widget);  } +void shell_clear_tree_models(Shell *shell) +{ +    gtk_tree_store_clear(GTK_TREE_STORE(shell->tree->model)); +    gtk_tree_store_clear(GTK_TREE_STORE(shell->info->model)); +    gtk_tree_store_clear(GTK_TREE_STORE(shell->moreinfo->model)); +    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), FALSE); +} + +void shell_clear_timeouts(Shell *shell) +{ +    h_hash_table_remove_all(update_tbl); +} +  void shell_action_set_property(const gchar * action_name,  			       const gchar * property, gboolean setting)  { @@ -346,6 +359,11 @@ static ShellNote *note_new(void)      return note;  } +void shell_reset_title(Shell *shell) +{ +    gtk_window_set_title(GTK_WINDOW(shell->window), "System Information"); +} +  static void create_window(void)  {      GtkWidget *vbox, *hbox; @@ -355,7 +373,7 @@ static void create_window(void)      shell->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);      gtk_window_set_icon(GTK_WINDOW(shell->window),  			icon_cache_get_pixbuf("logo.png")); -    gtk_window_set_title(GTK_WINDOW(shell->window), "System Information"); +    shell_reset_title(shell);      gtk_window_set_default_size(GTK_WINDOW(shell->window), 800, 600);      g_signal_connect(G_OBJECT(shell->window), "destroy", destroy_me, NULL); diff --git a/hardinfo2/shell.h b/hardinfo2/shell.h index 2d7c4043..0f3af78c 100644 --- a/hardinfo2/shell.h +++ b/hardinfo2/shell.h @@ -186,4 +186,7 @@ void		shell_status_set_enabled(gboolean setting);  void		shell_view_set_enabled(gboolean setting); +void		shell_clear_timeouts(Shell *shell); +void		shell_clear_tree_models(Shell *shell); +void		shell_reset_title(Shell *shell);  #endif				/* __SHELL_H__ */ diff --git a/hardinfo2/util.c b/hardinfo2/util.c index a8bb8b8c..d1c7a9ca 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -626,16 +626,10 @@ void module_unload_all(void)  			         GPOINTER_TO_INT(merge_id->data));      } -    gtk_tree_store_clear(GTK_TREE_STORE(shell->tree->model));      sync_manager_clear_entries(); -     -    /* TODO FIXME clear shell::update_tbl */ -     -    gtk_tree_store_clear(GTK_TREE_STORE(shell->tree->model)); -    gtk_tree_store_clear(GTK_TREE_STORE(shell->info->model)); -    gtk_tree_store_clear(GTK_TREE_STORE(shell->moreinfo->model)); -     -    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), FALSE); +    shell_clear_timeouts(shell); +    shell_clear_tree_models(shell); +    shell_reset_title(shell);      g_slist_free(shell->tree->modules);      g_slist_free(shell->merge_ids); @@ -771,19 +765,6 @@ static void module_entry_free(gpointer data, gpointer user_data)      }  } -void module_free(ShellModule * module) -{ -    g_free(module->name); -    g_object_unref(module->icon); -    g_module_close(module->dll); - -    DEBUG("module_free: module->entries, %p\n", module->entries); -    g_slist_foreach(module->entries, (GFunc) module_entry_free, NULL); -    g_slist_free(module->entries); - -    g_free(module); -} -  ModuleAbout *module_get_about(ShellModule * module)  {      ModuleAbout *(*get_about) (void); | 
