[gnome-video-arcade] Clean up how the initial view is set.



commit 09ba84b5da8709ac1a4c0c3bcc74121f42bf1aae
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Mar 14 20:49:53 2010 -0400

    Clean up how the initial view is set.
    
    Remove the hack for forcing a tree view update in start().

 src/gva-tree-view.c |    6 +++++-
 src/gva-ui.c        |   12 +++++++++++-
 src/main.c          |    7 -------
 3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/gva-tree-view.c b/src/gva-tree-view.c
index 62a834f..2ca3c1c 100644
--- a/src/gva-tree-view.c
+++ b/src/gva-tree-view.c
@@ -438,7 +438,11 @@ gva_tree_view_update_status_bar (void)
                         break;
 
                 default:
-                        g_return_if_reached ();
+                        /* We hit this at startup before the initial
+                         * view is determined.  Do not emit a warning. */
+                        count = 0;
+                        units = "";
+                        break;
         }
 
         if (mame_version != NULL)
diff --git a/src/gva-ui.c b/src/gva-ui.c
index 62ad3d7..d0f6053 100644
--- a/src/gva-ui.c
+++ b/src/gva-ui.c
@@ -889,6 +889,16 @@ static GtkToggleActionEntry toggle_entries[] =
 
 static GtkRadioActionEntry view_radio_entries[] =
 {
+        /* This is a bogus view that we switch away from on startup.
+         * It ensures that restoring the previous session's view from
+         * GConf always triggers a GtkRadioAction::changed emission. */
+        { "view-initial",
+          NULL,
+          NULL,
+          NULL,
+          NULL,
+          -1 },
+
         { "view-available",
           NULL,
           N_("_Available Games"),
@@ -957,7 +967,7 @@ ui_init (void)
         gtk_action_group_add_radio_actions (
                 action_group, view_radio_entries,
                 G_N_ELEMENTS (view_radio_entries),
-                0, G_CALLBACK (action_view_changed_cb), NULL);
+                -1, G_CALLBACK (action_view_changed_cb), NULL);
 
         filename = gva_find_data_file (PACKAGE ".builder");
         if (filename != NULL && error == NULL)
diff --git a/src/main.c b/src/main.c
index caa67d2..22105a7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -177,13 +177,6 @@ start (void)
                 gconf_bridge_get (), GVA_GCONF_SELECTED_VIEW_KEY,
                 G_OBJECT (GVA_ACTION_VIEW_AVAILABLE), "current-value");
 
-        /* Force a tree view update. */
-        if (gva_tree_view_get_selected_view () == 0)
-        {
-                gva_tree_view_update (&error);
-                gva_error_handle (&error);
-        }
-
         /* Present a helpful dialog if no ROMs were found. */
         warn_if_no_roms ();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]