/* Config: */
#define PROGRESS_UPDATE_USEC 200000
+/* Although proper GTK+ locking is provided below there are some
+ * bugs with compatibility of GTK+/Gnome-VFS/GConf.
+ * The main thread executes gtk_main()->g_main_loop_run()
+ * while the working thread initializes Gnome-VFS by GConf and
+ * executes also g_main_loop_run() while sharing some poll() fds.
+ */
+/* #define UI_GNOME_THREADS 1 */
static GnomeApp *App;
gdk_threads_enter();
- iter=DriversTreeStore_Iter_hash_get_iter(module_available->module->type);
+ iter=DriversTreeStore_Iter_hash_get_iter((const gchar *)module_available->module->type);
gtk_tree_store_set(DriversTreeStore,iter,
DRIVERS_TREE_STORE_COLUMN_TYPE,module_available->module->type,
DRIVERS_TREE_STORE_COLUMN_ID ,module_available->module->id,
-1);
- if (!strcmp(module_available->module->type,"ntoskrnl.exe"))
+ if (!strcmp((const char *)module_available->module->type,"ntoskrnl.exe"))
some_module_ntoskrnl_exe_found=TRUE;
- if (!strcmp(module_available->module->type,"ntfs.sys"))
+ if (!strcmp((const char *)module_available->module->type,"ntfs.sys"))
some_module_ntfs_sys_found=TRUE;
some_modules_found=some_module_ntoskrnl_exe_found && some_module_ntfs_sys_found;
static gboolean ui_gnome_progress(GnomeVFSURI *uri)
{
+gboolean want_gdk_flush=FALSE;
+
/* 'uri' may be NULL */
gdk_threads_enter();
}
if (uri_text) {
- if (want_progress_update(&ProgressEntry_updated_timeval))
+ if (want_progress_update(&ProgressEntry_updated_timeval)) {
gtk_entry_set_text(ProgressEntry,
uri_text+(strncmp(uri_text,"file://",strlen("file://")) ? 0 : strlen("file://")));
+ want_gdk_flush=TRUE;
+ }
}
}
- gdk_flush();
+#ifndef UI_GNOME_THREADS
+ while (g_main_context_pending(NULL))
+ g_main_context_iteration(
+ NULL, /* context */
+ FALSE); /* may_block */
+#endif /* UI_GNOME_THREADS */
+
+ if (want_gdk_flush)
+ gdk_flush();
gdk_threads_leave();
/* Do not: g_thread_yield();
typedef void (*process_t)(void);
+#ifdef UI_GNOME_THREADS
/* 'GThreadFunc' type. */
gpointer execute_process_func(process_t process /* data */)
{
return NULL;
}
+#endif /* UI_GNOME_THREADS */
/* We are called inside gdk_threads_enter(). */
static void execute_process(process_t process)
{
+#ifdef UI_GNOME_THREADS
GThread *gthread;
+#endif /* UI_GNOME_THREADS */
progress_start();
+#ifdef UI_GNOME_THREADS
gthread=g_thread_create_full(
(GThreadFunc)execute_process_func, /* func */
process, /* data */
* locked if the 'process' func did not finish yet.
*/
g_thread_join(gthread);
+#else /* UI_GNOME_THREADS */
+ (*process)();
+#endif /* UI_GNOME_THREADS */
progress_end();
}
/* 'process_t' typed. */
static void process_scan_path(void)
{
- mod_uri_load(process_scan_path_scan_path_uri);
+ mod_uri_load_base_reporting(process_scan_path_scan_path_uri);
}
/* 'process_t' typed. */
(GnomeReplyCallback)on_DruidButtonOK_clicked_dialog_callback,
&reply); /* data */
g_signal_connect((gpointer)dialog,"close",G_CALLBACK(gtk_main_quit),NULL);
+ /* Never call gtk_main() from other thread than the initial one.
+ * We would have to switch GTK+ context (g_main_context()?).
+ */
gtk_main();
/* 'dialog' gets destroyed automatically */
if (reply==0) /* 0 for 'OK', 1 for 'Cancel', left -1 for dialog close. */
gtk_label_set_text_with_mnemonic(GTK_LABEL(widget),label_text_new);
}
+static void PageFinish_set_label_attr(GtkWidget *widget,gpointer callback_data /* unused */)
+{
+ g_return_if_fail(GTK_IS_WIDGET(widget));
+
+ /**/ if (GTK_IS_CONTAINER(widget))
+ gtk_container_foreach(GTK_CONTAINER(widget),
+ (GtkCallback)PageFinish_set_label_attr, /* callback */
+ callback_data); /* callback_data; unused */
+ else if (GTK_IS_LABEL(widget) && gtk_label_get_line_wrap(GTK_LABEL(widget)))
+ gtk_label_set_selectable(GTK_LABEL(widget),TRUE);
+}
+
/* of "ui-gnome-interface.h": */
GtkWidget *create_App(void);
/* of "ui-gnome-support.h": */
GtkCellRenderer *cell;
GtkBox *druid_button_box;
+ gdk_threads_enter();
+
App=GNOME_APP(create_App());
DriversTreeView=GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(App),"DriversTreeView"));
gtk_widget_hide(GTK_WIDGET(Druid->finish));
DruidButtonSkip=GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_REDO));
- gtk_container_foreach(GTK_CONTAINER(DruidButtonSkip),
- (GtkCallback)button_stock_set_label, /* callback */
- _("_Skip")); /* callback_data */
+ button_stock_set_label(
+ GTK_WIDGET(DruidButtonSkip), /* widget */
+ _("_Skip")); /* label_text_new */
gtk_box_pack_end(druid_button_box,GTK_WIDGET(DruidButtonSkip),FALSE,TRUE,0);
gtk_widget_show(GTK_WIDGET(DruidButtonSkip));
g_signal_connect((gpointer)DruidButtonSkip,"clicked",G_CALLBACK(on_DruidButtonSkip_clicked),NULL);
gtk_widget_show(GTK_WIDGET(DruidButtonOK));
g_signal_connect((gpointer)DruidButtonOK,"clicked",G_CALLBACK(on_DruidButtonOK_clicked),NULL);
+ PageFinish_set_label_attr(
+ GTK_WIDGET(PageFinish), /* widget */
+ NULL); /* callback_data; unused */
+
state_changed();
+
+ gdk_threads_leave();
}
static void ui_gnome_g_log_handler(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
static void ui_gnome_interactive(void)
{
- gtk_widget_show_all(GTK_WIDGET(App));
+ gdk_threads_enter();
- if (!g_thread_supported())
- g_thread_init(NULL);
- if (!gdk_threads_mutex)
- gdk_threads_init();
+ /* Postpone gtk_widget_show_all() from App_init() here
+ * to have already passed all ui_gnome_module_available_notify().
+ */
+ gnome_druid_set_page(Druid,MicrosoftComPage);
+ gtk_widget_show_all(GTK_WIDGET(App));
+#if 0
+ /* gnome_druid_set_page(Druid,PageStart); */
+ gnome_druid_set_page(Druid,ScanDiskPage);
+ gnome_druid_set_page(Druid,ScanPathPage);
+ /* gnome_druid_set_page(Druid,MicrosoftComPage); */
+ gnome_druid_set_page(Druid,PageFinish);
+#endif
+ gnome_druid_set_page(Druid,PageStart);
- gdk_threads_enter();
gtk_main();
+
gdk_threads_leave();
+
exit(EXIT_SUCCESS);
}
ui_interactive=ui_gnome_interactive;
captivemodid_module_best_priority_notify=ui_gnome_module_best_priority_notify;
+#ifdef UI_GNOME_THREADS
+ /* gdk_threads_init() must be called before gtk_init()!
+ * gtk_init() gets called by create_App() here.
+ */
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+ if (!gdk_threads_mutex)
+ gdk_threads_init();
+#endif /* UI_GNOME_THREADS */
+
/* Graphic widgets will all be hidden yet. */
App_init();
/* ui_gnome_g_log_handler() needs 'App'. */