[gnome-video-arcade] Detect changes to ROM directories.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-video-arcade] Detect changes to ROM directories.
- Date: Sun, 16 May 2010 03:11:28 +0000 (UTC)
commit 98715fee46953caa7e26f19012aa1a5dde1112f1
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat May 15 23:02:50 2010 -0400
Detect changes to ROM directories.
Create a GFileMonitor for each directory in the "rompath" configuration
setting. When a change notification is received, present the user with
a dialog offering to reanalyze the ROM files in order to update the game
list without having to restart GNOME Video Arcade.
NEWS | 12 ++
docs/reference/gnome-video-arcade-sections.txt | 2 +
docs/reference/tmpl/gva-audit.sgml | 6 +
docs/reference/tmpl/gva-categories.sgml | 3 +
docs/reference/tmpl/gva-cell-renderer-pixbuf.sgml | 4 +
docs/reference/tmpl/gva-column-manager.sgml | 3 +
docs/reference/tmpl/gva-columns.sgml | 3 +
docs/reference/tmpl/gva-db.sgml | 5 +
docs/reference/tmpl/gva-dbus.sgml | 3 +
docs/reference/tmpl/gva-error.sgml | 3 +
docs/reference/tmpl/gva-favorites.sgml | 4 +
docs/reference/tmpl/gva-game-store.sgml | 4 +
docs/reference/tmpl/gva-history.sgml | 3 +
docs/reference/tmpl/gva-input-file.sgml | 3 +
docs/reference/tmpl/gva-main.sgml | 11 ++
docs/reference/tmpl/gva-mame-common.sgml | 3 +
docs/reference/tmpl/gva-mame-process.sgml | 3 +
docs/reference/tmpl/gva-mame.sgml | 4 +
docs/reference/tmpl/gva-music-button.sgml | 4 +
docs/reference/tmpl/gva-mute-button.sgml | 4 +
docs/reference/tmpl/gva-nplayers.sgml | 3 +
docs/reference/tmpl/gva-play-back.sgml | 4 +
docs/reference/tmpl/gva-preferences.sgml | 8 +
docs/reference/tmpl/gva-process.sgml | 4 +
docs/reference/tmpl/gva-properties.sgml | 4 +
docs/reference/tmpl/gva-time.sgml | 3 +
docs/reference/tmpl/gva-tree-view.sgml | 9 +
docs/reference/tmpl/gva-ui.sgml | 19 ++
docs/reference/tmpl/gva-util.sgml | 7 +
docs/reference/tmpl/gva-wnck.sgml | 3 +
src/gva-main.c | 15 +-
src/gva-ui.c | 191 +++++++++++++--------
src/gva-ui.h | 2 +
src/main.c | 129 ++++++++++++--
34 files changed, 397 insertions(+), 91 deletions(-)
---
diff --git a/NEWS b/NEWS
index 98c8e4a..3e2dedc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+GNOME Video Arcade 0.7.1
+========================
+
+ Released ????, 2010
+
+ What's New
+ ----------
+ * GNOME Video Arcade now detects changes to your ROMs directory,
+ such as adding or removing games, while its running and offers
+ to rescan your ROM files in order to present an updated game
+ list without having to restart the application.
+
GNOME Video Arcade 0.7.0
========================
diff --git a/docs/reference/gnome-video-arcade-sections.txt b/docs/reference/gnome-video-arcade-sections.txt
index 0c35ca6..c0936bb 100644
--- a/docs/reference/gnome-video-arcade-sections.txt
+++ b/docs/reference/gnome-video-arcade-sections.txt
@@ -424,6 +424,8 @@ gva_ui_get_action
gva_ui_get_widget
gva_ui_get_managed_widget
gva_ui_add_column_actions
+gva_ui_lock
+gva_ui_unlock
<SUBSECTION Private>
GVA_WIDGET_AUDIT_SAVE_BUTTON
GVA_WIDGET_AUDIT_TREE_VIEW
diff --git a/docs/reference/tmpl/gva-audit.sgml b/docs/reference/tmpl/gva-audit.sgml
index e501a9e..149e003 100644
--- a/docs/reference/tmpl/gva-audit.sgml
+++ b/docs/reference/tmpl/gva-audit.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_audit_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_audit_roms ##### -->
@@ -47,6 +51,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_audit_detect_changes ##### -->
@@ -54,6 +59,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-categories.sgml b/docs/reference/tmpl/gva-categories.sgml
index 977e9cf..fb5d60d 100644
--- a/docs/reference/tmpl/gva-categories.sgml
+++ b/docs/reference/tmpl/gva-categories.sgml
@@ -17,6 +17,9 @@ gva-categories
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_categories_init ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-cell-renderer-pixbuf.sgml b/docs/reference/tmpl/gva-cell-renderer-pixbuf.sgml
index 89ed3b0..a761f9f 100644
--- a/docs/reference/tmpl/gva-cell-renderer-pixbuf.sgml
+++ b/docs/reference/tmpl/gva-cell-renderer-pixbuf.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaCellRendererPixbuf ##### -->
<para>
@@ -36,6 +39,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-column-manager.sgml b/docs/reference/tmpl/gva-column-manager.sgml
index b50ba07..c13331f 100644
--- a/docs/reference/tmpl/gva-column-manager.sgml
+++ b/docs/reference/tmpl/gva-column-manager.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaColumnManager ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-columns.sgml b/docs/reference/tmpl/gva-columns.sgml
index d2f2494..e908986 100644
--- a/docs/reference/tmpl/gva-columns.sgml
+++ b/docs/reference/tmpl/gva-columns.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_columns_new_from_id ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-db.sgml b/docs/reference/tmpl/gva-db.sgml
index 9cdd1da..04fb761 100644
--- a/docs/reference/tmpl/gva-db.sgml
+++ b/docs/reference/tmpl/gva-db.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_db_init ##### -->
<para>
@@ -120,6 +123,7 @@
</para>
+ void:
@Returns:
@@ -137,6 +141,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-dbus.sgml b/docs/reference/tmpl/gva-dbus.sgml
index 85bc7b8..9321dcc 100644
--- a/docs/reference/tmpl/gva-dbus.sgml
+++ b/docs/reference/tmpl/gva-dbus.sgml
@@ -17,6 +17,9 @@ gva-dbus
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_dbus_init ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-error.sgml b/docs/reference/tmpl/gva-error.sgml
index c8b7d03..3d4f3e7 100644
--- a/docs/reference/tmpl/gva-error.sgml
+++ b/docs/reference/tmpl/gva-error.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### MACRO GVA_ERROR ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-favorites.sgml b/docs/reference/tmpl/gva-favorites.sgml
index 80aba48..dee7c61 100644
--- a/docs/reference/tmpl/gva-favorites.sgml
+++ b/docs/reference/tmpl/gva-favorites.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_favorites_copy ##### -->
<para>
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-game-store.sgml b/docs/reference/tmpl/gva-game-store.sgml
index e3337cd..d56af80 100644
--- a/docs/reference/tmpl/gva-game-store.sgml
+++ b/docs/reference/tmpl/gva-game-store.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaGameStore ##### -->
<para>
@@ -72,6 +75,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-history.sgml b/docs/reference/tmpl/gva-history.sgml
index 0e2839c..c92d8b8 100644
--- a/docs/reference/tmpl/gva-history.sgml
+++ b/docs/reference/tmpl/gva-history.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_history_init ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-input-file.sgml b/docs/reference/tmpl/gva-input-file.sgml
index f5db168..5549468 100644
--- a/docs/reference/tmpl/gva-input-file.sgml
+++ b/docs/reference/tmpl/gva-input-file.sgml
@@ -17,6 +17,9 @@ GvaInputFile
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaInputFile ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-main.sgml b/docs/reference/tmpl/gva-main.sgml
index e727a48..0320b26 100644
--- a/docs/reference/tmpl/gva-main.sgml
+++ b/docs/reference/tmpl/gva-main.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_main_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_main_build_database ##### -->
@@ -66,6 +70,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_cursor_normal ##### -->
@@ -73,6 +78,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_progress_bar_show ##### -->
@@ -80,6 +86,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_progress_bar_hide ##### -->
@@ -87,6 +94,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_progress_bar_set_fraction ##### -->
@@ -139,6 +147,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_execute_search ##### -->
@@ -146,6 +155,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_main_get_last_search_text ##### -->
@@ -153,6 +163,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-mame-common.sgml b/docs/reference/tmpl/gva-mame-common.sgml
index 255cdbe..2f842b1 100644
--- a/docs/reference/tmpl/gva-mame-common.sgml
+++ b/docs/reference/tmpl/gva-mame-common.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaMameAsyncData ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-mame-process.sgml b/docs/reference/tmpl/gva-mame-process.sgml
index 8ccd3a2..9ce8e45 100644
--- a/docs/reference/tmpl/gva-mame-process.sgml
+++ b/docs/reference/tmpl/gva-mame-process.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaMameProcess ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-mame.sgml b/docs/reference/tmpl/gva-mame.sgml
index ef28748..4d7783b 100644
--- a/docs/reference/tmpl/gva-mame.sgml
+++ b/docs/reference/tmpl/gva-mame.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### USER_FUNCTION GvaMameCallback ##### -->
<para>
@@ -32,6 +35,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-music-button.sgml b/docs/reference/tmpl/gva-music-button.sgml
index bfad33c..396edf2 100644
--- a/docs/reference/tmpl/gva-music-button.sgml
+++ b/docs/reference/tmpl/gva-music-button.sgml
@@ -17,6 +17,9 @@ GvaMusicButton
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaMusicButton ##### -->
<para>
@@ -52,6 +55,7 @@ GvaMusicButton
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-mute-button.sgml b/docs/reference/tmpl/gva-mute-button.sgml
index 4d1bcb0..2f390f0 100644
--- a/docs/reference/tmpl/gva-mute-button.sgml
+++ b/docs/reference/tmpl/gva-mute-button.sgml
@@ -17,6 +17,9 @@ GvaMuteButton
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaMuteButton ##### -->
<para>
@@ -33,6 +36,7 @@ GvaMuteButton
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-nplayers.sgml b/docs/reference/tmpl/gva-nplayers.sgml
index 0bc4241..d634fd9 100644
--- a/docs/reference/tmpl/gva-nplayers.sgml
+++ b/docs/reference/tmpl/gva-nplayers.sgml
@@ -17,6 +17,9 @@ gva-nplayers
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_nplayers_init ##### -->
<para>
diff --git a/docs/reference/tmpl/gva-play-back.sgml b/docs/reference/tmpl/gva-play-back.sgml
index f713cf1..b9af404 100644
--- a/docs/reference/tmpl/gva-play-back.sgml
+++ b/docs/reference/tmpl/gva-play-back.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_play_back_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_play_back_show ##### -->
diff --git a/docs/reference/tmpl/gva-preferences.sgml b/docs/reference/tmpl/gva-preferences.sgml
index 9a0c0d2..624482b 100644
--- a/docs/reference/tmpl/gva-preferences.sgml
+++ b/docs/reference/tmpl/gva-preferences.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_preferences_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_preferences_get_auto_play ##### -->
@@ -29,6 +33,7 @@
</para>
+ void:
@Returns:
@@ -45,6 +50,7 @@
</para>
+ void:
@Returns:
@@ -61,6 +67,7 @@
</para>
+ void:
@Returns:
@@ -77,6 +84,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-process.sgml b/docs/reference/tmpl/gva-process.sgml
index b54af41..966c555 100644
--- a/docs/reference/tmpl/gva-process.sgml
+++ b/docs/reference/tmpl/gva-process.sgml
@@ -17,6 +17,9 @@ GvaProcess
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### STRUCT GvaProcess ##### -->
<para>
@@ -223,6 +226,7 @@ GvaProcess
</para>
+ void:
<!-- ##### FUNCTION gva_process_get_time_elapsed ##### -->
diff --git a/docs/reference/tmpl/gva-properties.sgml b/docs/reference/tmpl/gva-properties.sgml
index b356e69..1a17e26 100644
--- a/docs/reference/tmpl/gva-properties.sgml
+++ b/docs/reference/tmpl/gva-properties.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_properties_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_properties_show_game ##### -->
diff --git a/docs/reference/tmpl/gva-time.sgml b/docs/reference/tmpl/gva-time.sgml
index 3dfc4b2..67397ef 100644
--- a/docs/reference/tmpl/gva-time.sgml
+++ b/docs/reference/tmpl/gva-time.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### MACRO GVA_TYPE_TIME ##### -->
<para>
</para>
diff --git a/docs/reference/tmpl/gva-tree-view.sgml b/docs/reference/tmpl/gva-tree-view.sgml
index de593f8..d0a45aa 100644
--- a/docs/reference/tmpl/gva-tree-view.sgml
+++ b/docs/reference/tmpl/gva-tree-view.sgml
@@ -17,11 +17,15 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_tree_view_init ##### -->
<para>
</para>
+ void:
<!-- ##### FUNCTION gva_tree_view_lookup ##### -->
@@ -57,6 +61,7 @@
</para>
+ void:
@Returns:
@@ -65,6 +70,7 @@
</para>
+ void:
<!-- ##### FUNCTION gva_tree_view_get_selected_game ##### -->
@@ -72,6 +78,7 @@
</para>
+ void:
@Returns:
@@ -88,6 +95,7 @@
</para>
+ void:
@Returns:
@@ -104,6 +112,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-ui.sgml b/docs/reference/tmpl/gva-ui.sgml
index 35a3be4..49a6df6 100644
--- a/docs/reference/tmpl/gva-ui.sgml
+++ b/docs/reference/tmpl/gva-ui.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### MACRO GVA_ACTION_ABOUT ##### -->
<para>
@@ -213,3 +216,19 @@
@view:
+<!-- ##### FUNCTION gva_ui_lock ##### -->
+<para>
+
+</para>
+
+ void:
+
+
+<!-- ##### FUNCTION gva_ui_unlock ##### -->
+<para>
+
+</para>
+
+ void:
+
+
diff --git a/docs/reference/tmpl/gva-util.sgml b/docs/reference/tmpl/gva-util.sgml
index a7d447d..8357d39 100644
--- a/docs/reference/tmpl/gva-util.sgml
+++ b/docs/reference/tmpl/gva-util.sgml
@@ -17,6 +17,9 @@
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_choose_inpname ##### -->
<para>
@@ -40,6 +43,7 @@
</para>
+ void:
@Returns:
@@ -60,6 +64,7 @@
</para>
+ void:
@Returns:
@@ -68,6 +73,7 @@
</para>
+ void:
@Returns:
@@ -85,6 +91,7 @@
</para>
+ void:
@Returns:
diff --git a/docs/reference/tmpl/gva-wnck.sgml b/docs/reference/tmpl/gva-wnck.sgml
index 4123dd2..ef7a668 100644
--- a/docs/reference/tmpl/gva-wnck.sgml
+++ b/docs/reference/tmpl/gva-wnck.sgml
@@ -17,6 +17,9 @@ gva-wnck
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### SECTION Image ##### -->
+
+
<!-- ##### FUNCTION gva_wnck_listen_for_new_window ##### -->
<para>
diff --git a/src/gva-main.c b/src/gva-main.c
index bf3777f..39602f3 100644
--- a/src/gva-main.c
+++ b/src/gva-main.c
@@ -192,14 +192,7 @@ gva_main_init (void)
gtk_entry_set_text (GTK_ENTRY (GVA_WIDGET_MAIN_SEARCH_ENTRY), text);
g_free (text);
- gtk_action_set_sensitive (GVA_ACTION_PROPERTIES, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_RECORD, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_SEARCH, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_SHOW_CLONES, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_START, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_AVAILABLE, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_FAVORITES, FALSE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_RESULTS, FALSE);
+ gva_ui_lock ();
gtk_action_set_visible (GVA_ACTION_INSERT_FAVORITE, FALSE);
gtk_action_set_visible (GVA_ACTION_REMOVE_FAVORITE, FALSE);
@@ -237,6 +230,8 @@ gva_main_build_database (GError **error)
if (process == NULL)
goto exit;
+ gva_main_progress_bar_show ();
+ gva_main_progress_bar_set_fraction (0.0);
gva_main_statusbar_push (context_id, _("Building game database..."));
g_signal_connect (
@@ -253,6 +248,7 @@ gva_main_build_database (GError **error)
success = TRUE;
gva_main_statusbar_pop (context_id);
+ gva_main_progress_bar_hide ();
exit:
if (process != NULL)
@@ -295,6 +291,8 @@ gva_main_analyze_roms (GError **error)
if (process2 == NULL)
goto exit;
+ gva_main_progress_bar_show ();
+ gva_main_progress_bar_set_fraction (0.0);
gva_main_statusbar_push (context_id, _("Analyzing ROM files..."));
g_signal_connect (
@@ -317,6 +315,7 @@ gva_main_analyze_roms (GError **error)
success = TRUE;
gva_main_statusbar_pop (context_id);
+ gva_main_progress_bar_hide ();
exit:
if (process != NULL)
diff --git a/src/gva-ui.c b/src/gva-ui.c
index d0f6053..ba2309d 100644
--- a/src/gva-ui.c
+++ b/src/gva-ui.c
@@ -47,7 +47,8 @@
static GtkBuilder *builder = NULL;
static GtkUIManager *manager = NULL;
-static GtkActionGroup *action_group = NULL;
+static GtkActionGroup *standard_actions = NULL;
+static GtkActionGroup *lockable_actions = NULL;
static gboolean initialized = FALSE;
/* About Dialog Information */
@@ -702,7 +703,7 @@ action_view_changed_cb (GtkRadioAction *action,
gva_error_handle (&error);
}
-static GtkActionEntry entries[] =
+static GtkActionEntry standard_entries[] =
{
{ "about",
GTK_STOCK_ABOUT,
@@ -718,6 +719,58 @@ static GtkActionEntry entries[] =
N_("Open the help documentation"),
G_CALLBACK (action_contents_cb) },
+ { "preferences",
+ GTK_STOCK_PREFERENCES,
+ N_("_Preferences"),
+ NULL,
+ N_("Configure the application"),
+ G_CALLBACK (action_preferences_cb) },
+
+ { "quit",
+ GTK_STOCK_QUIT,
+ N_("_Quit"),
+ NULL,
+ N_("Quit the application"),
+ G_CALLBACK (action_quit_cb) },
+
+ { "add-column-menu",
+ NULL,
+ N_("_Add Column"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "edit-menu",
+ NULL,
+ N_("_Edit"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "game-menu",
+ NULL,
+ N_("_Game"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "help-menu",
+ NULL,
+ N_("_Help"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "view-menu",
+ NULL,
+ N_("_View"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static GtkActionEntry lockable_entries[] =
+{
{ "insert-favorite",
GTK_STOCK_ADD,
N_("Add to _Favorites"),
@@ -739,13 +792,6 @@ static GtkActionEntry entries[] =
N_("Play back the selected game recording"),
G_CALLBACK (action_play_back_cb) },
- { "preferences",
- GTK_STOCK_PREFERENCES,
- N_("_Preferences"),
- NULL,
- N_("Configure the application"),
- G_CALLBACK (action_preferences_cb) },
-
{ "previous-game",
GTK_STOCK_GO_BACK,
NULL,
@@ -760,13 +806,6 @@ static GtkActionEntry entries[] =
N_("Show information about the selected game"),
G_CALLBACK (action_properties_cb) },
- { "quit",
- GTK_STOCK_QUIT,
- N_("_Quit"),
- NULL,
- N_("Quit the application"),
- G_CALLBACK (action_quit_cb) },
-
{ "record",
GTK_STOCK_MEDIA_RECORD,
N_("_Record"),
@@ -814,45 +853,10 @@ static GtkActionEntry entries[] =
N_("_Start"),
"<Control>s",
N_("Start the selected game"),
- G_CALLBACK (action_start_cb) },
-
- { "add-column-menu",
- NULL,
- N_("_Add Column"),
- NULL,
- NULL,
- NULL },
-
- { "edit-menu",
- NULL,
- N_("_Edit"),
- NULL,
- NULL,
- NULL },
-
- { "game-menu",
- NULL,
- N_("_Game"),
- NULL,
- NULL,
- NULL },
-
- { "help-menu",
- NULL,
- N_("_Help"),
- NULL,
- NULL,
- NULL },
-
- { "view-menu",
- NULL,
- N_("_View"),
- NULL,
- NULL,
- NULL }
+ G_CALLBACK (action_start_cb) }
};
-static GtkToggleActionEntry toggle_entries[] =
+static GtkToggleActionEntry standard_toggle_entries[] =
{
{ "auto-play",
NULL,
@@ -876,8 +880,11 @@ static GtkToggleActionEntry toggle_entries[] =
NULL,
NULL,
NULL, /* GConfBridge monitors the state */
- FALSE }, /* GConf overrides this */
+ FALSE } /* GConf overrides this */
+};
+static GtkToggleActionEntry lockable_toggle_entries[] =
+{
{ "show-clones",
NULL,
N_("Show _alternate versions of original games"),
@@ -955,20 +962,35 @@ ui_init (void)
* when we use the GVA_WIDGET_MAIN_WINDOW macro below. */
initialized = TRUE;
- action_group = gtk_action_group_new ("main");
+ standard_actions = gtk_action_group_new ("standard");
gtk_action_group_set_translation_domain (
- action_group, GETTEXT_PACKAGE);
+ standard_actions, GETTEXT_PACKAGE);
gtk_action_group_add_actions (
- action_group, entries,
- G_N_ELEMENTS (entries), NULL);
+ standard_actions, standard_entries,
+ G_N_ELEMENTS (standard_entries), NULL);
gtk_action_group_add_toggle_actions (
- action_group, toggle_entries,
- G_N_ELEMENTS (toggle_entries), NULL);
+ standard_actions, standard_toggle_entries,
+ G_N_ELEMENTS (standard_toggle_entries), NULL);
+
+ lockable_actions = gtk_action_group_new ("lockable");
+ gtk_action_group_set_translation_domain (
+ lockable_actions, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ lockable_actions, lockable_entries,
+ G_N_ELEMENTS (lockable_entries), NULL);
+ gtk_action_group_add_toggle_actions (
+ lockable_actions, lockable_toggle_entries,
+ G_N_ELEMENTS (lockable_toggle_entries), NULL);
gtk_action_group_add_radio_actions (
- action_group, view_radio_entries,
+ lockable_actions, view_radio_entries,
G_N_ELEMENTS (view_radio_entries),
-1, G_CALLBACK (action_view_changed_cb), NULL);
+ manager = gtk_ui_manager_new ();
+
+ gtk_ui_manager_insert_action_group (manager, standard_actions, 0);
+ gtk_ui_manager_insert_action_group (manager, lockable_actions, 0);
+
filename = gva_find_data_file (PACKAGE ".builder");
if (filename != NULL && error == NULL)
{
@@ -981,9 +1003,6 @@ ui_init (void)
filename = gva_find_data_file (PACKAGE ".ui");
if (filename != NULL && error == NULL)
{
- manager = gtk_ui_manager_new ();
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
-
gtk_window_add_accel_group (
GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW),
gtk_ui_manager_get_accel_group (manager));
@@ -1024,9 +1043,15 @@ gva_ui_get_action (const gchar *action_name)
if (G_UNLIKELY (!initialized))
ui_init ();
- action = gtk_action_group_get_action (action_group, action_name);
- g_assert (action != NULL);
- return action;
+ action = gtk_action_group_get_action (standard_actions, action_name);
+ if (action != NULL)
+ return action;
+
+ action = gtk_action_group_get_action (lockable_actions, action_name);
+ if (action != NULL)
+ return action;
+
+ g_error ("No action named '%s'", action_name);
}
/**
@@ -1125,7 +1150,7 @@ gva_ui_add_column_actions (GtkTreeView *view)
action = gtk_action_new (
action_name, action_label, action_tooltip, NULL);
- gtk_action_group_add_action (action_group, action);
+ gtk_action_group_add_action (standard_actions, action);
visible = gtk_tree_view_column_get_visible (column);
gtk_action_set_visible (action, !visible);
@@ -1150,3 +1175,33 @@ gva_ui_add_column_actions (GtkTreeView *view)
list = g_list_delete_link (list, list);
}
}
+
+/**
+ * gva_ui_lock:
+ *
+ * Locks down the user interface to prevent the user from interfereing
+ * with a long-running task. Once the long-running task has completed,
+ * call gva_ui_unlock() to restore full interactivity.
+ **/
+void
+gva_ui_lock (void)
+{
+ /* Hide secondary windows that may interfere. */
+ gtk_widget_hide (GVA_WIDGET_PLAY_BACK_WINDOW);
+ gtk_widget_hide (GVA_WIDGET_PROPERTIES_WINDOW);
+
+ gtk_action_group_set_sensitive (lockable_actions, FALSE);
+ gtk_widget_set_sensitive (GVA_WIDGET_MAIN_TREE_VIEW, FALSE);
+}
+
+/**
+ * gva_ui_unlock:
+ *
+ * Undoes the effects of gva_ui_lock().
+ **/
+void
+gva_ui_unlock (void)
+{
+ gtk_action_group_set_sensitive (lockable_actions, TRUE);
+ gtk_widget_set_sensitive (GVA_WIDGET_MAIN_TREE_VIEW, TRUE);
+}
diff --git a/src/gva-ui.h b/src/gva-ui.h
index 2789be3..016166b 100644
--- a/src/gva-ui.h
+++ b/src/gva-ui.h
@@ -188,6 +188,8 @@ GtkAction * gva_ui_get_action (const gchar *action_name);
GtkWidget * gva_ui_get_widget (const gchar *widget_name);
GtkWidget * gva_ui_get_managed_widget (const gchar *widget_path);
void gva_ui_add_column_actions (GtkTreeView *view);
+void gva_ui_lock (void);
+void gva_ui_unlock (void);
G_END_DECLS
diff --git a/src/main.c b/src/main.c
index 22105a7..ffaf7e0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -129,35 +129,25 @@ start (void)
if (gva_db_needs_rebuilt ())
{
- gva_main_progress_bar_show ();
-
if (!gva_main_build_database (&error))
{
gva_error_handle (&error);
return;
}
- gva_main_progress_bar_set_fraction (0.0);
-
if (!gva_main_analyze_roms (&error))
{
gva_error_handle (&error);
return;
}
-
- gva_main_progress_bar_hide ();
}
else if (gva_audit_detect_changes ())
{
- gva_main_progress_bar_show ();
-
if (!gva_main_analyze_roms (&error))
{
gva_error_handle (&error);
return;
}
-
- gva_main_progress_bar_hide ();
}
/* Do this after ROMs are analyzed. */
@@ -167,11 +157,7 @@ start (void)
return;
}
- gtk_action_set_sensitive (GVA_ACTION_SEARCH, TRUE);
- gtk_action_set_sensitive (GVA_ACTION_SHOW_CLONES, TRUE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_AVAILABLE, TRUE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_FAVORITES, TRUE);
- gtk_action_set_sensitive (GVA_ACTION_VIEW_RESULTS, TRUE);
+ gva_ui_unlock ();
gconf_bridge_bind_property (
gconf_bridge_get (), GVA_GCONF_SELECTED_VIEW_KEY,
@@ -181,6 +167,118 @@ start (void)
warn_if_no_roms ();
}
+static void
+rompath_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type)
+{
+ static GtkWidget *dialog = NULL;
+ gint response;
+
+ if (dialog != NULL)
+ return;
+
+ /* Filter out events we don't care about. */
+ switch (event_type)
+ {
+ case G_FILE_MONITOR_EVENT_CHANGED:
+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
+ case G_FILE_MONITOR_EVENT_DELETED:
+ case G_FILE_MONITOR_EVENT_CREATED:
+ break;
+ default:
+ return;
+ }
+
+ dialog = gtk_message_dialog_new_with_markup (
+ GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+ "<big><b>%s</b></big>",
+ _("Changes detected in ROM files"));
+
+ gtk_message_dialog_format_secondary_text (
+ GTK_MESSAGE_DIALOG (dialog),
+ _("GNOME Video Arcade has detected changes in your "
+ "ROM files and will need to audit them in order to "
+ "update the game list. However the audit may take "
+ "several minutes to complete. Wold you like to "
+ "perform the audit now?\n\nIf you skip the audit now, "
+ "it will be performed automatically the next time you "
+ "start GNOME Video Arcade."));
+
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ _("_Skip Audit"), GTK_RESPONSE_NO,
+ _("_Audit ROM Files"), GTK_RESPONSE_YES,
+ NULL);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* Don't destroy the dialog just yet. If the file monitor
+ * trips again while we're analyzing ROMs, we want the NULL
+ * check at the top of the function to evaluate TRUE so we
+ * return immediately. */
+ gtk_widget_hide (dialog);
+
+ if (response == GTK_RESPONSE_YES)
+ {
+ GError *error = NULL;
+
+ gva_ui_lock ();
+
+ gva_main_analyze_roms (&error);
+ gva_error_handle (&error);
+
+ gva_tree_view_update (&error);
+ gva_error_handle (&error);
+
+ gva_ui_unlock ();
+
+ /* Present a helpful dialog if no ROMs were found. */
+ warn_if_no_roms ();
+ }
+
+ gtk_widget_destroy (dialog);
+ dialog = NULL;
+}
+
+static void
+setup_file_monitors (void)
+{
+ gchar **search_paths;
+ guint length, ii;
+
+ /* We don't care about errors while setting up file monitors
+ * since it's just a "nice to have" feature. */
+
+ search_paths = gva_mame_get_search_paths ("rompath", NULL);
+ length = (search_paths != NULL) ? g_strv_length (search_paths) : 0;
+
+ for (ii = 0; ii < length; ii++)
+ {
+ GFileMonitor *monitor;
+ GFile *file;
+
+ file = g_file_new_for_path (search_paths[ii]);
+ monitor = g_file_monitor (file, 0, NULL, NULL);
+ g_object_unref (file);
+
+ if (monitor == NULL)
+ continue;
+
+ g_signal_connect (
+ monitor, "changed",
+ G_CALLBACK (rompath_changed_cb), NULL);
+
+ /* We leak the file monitor reference, but the
+ * monitor lives for the entire session anyway. */
+ }
+
+ g_strfreev (search_paths);
+}
+
gint
main (gint argc, gchar **argv)
{
@@ -272,6 +370,7 @@ main (gint argc, gchar **argv)
#endif
gtk_init_add ((GtkFunction) start, NULL);
+ gtk_init_add ((GtkFunction) setup_file_monitors, NULL);
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]