[totem/wip/hadess/no-properties: 5/6] main: Add API to track the current "main page"



commit 7d6ce5fccffffe47e8e6b4719782347b50ea7dcb
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 14 04:13:00 2019 +0100

    main: Add API to track the current "main page"
    
    The "main page" is either "grilo" when browsing for content, or "player"
    when playing something back. This property might be of interest to
    plugins that only want to work in one of those 2 views.

 src/totem-object.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index bee93c46b..fdf7c57c1 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -110,7 +110,8 @@ enum {
        PROP_CURRENT_TIME,
        PROP_CURRENT_MRL,
        PROP_CURRENT_CONTENT_TYPE,
-       PROP_CURRENT_DISPLAY_NAME
+       PROP_CURRENT_DISPLAY_NAME,
+       PROP_MAIN_PAGE
 };
 
 enum {
@@ -381,6 +382,17 @@ totem_object_class_init (TotemObjectClass *klass)
                                                              "Current stream's display name.",
                                                              NULL, G_PARAM_READABLE));
 
+       /**
+        * TotemObject:main-page:
+        *
+        * The name of the current main page (usually "grilo", or "player").
+        **/
+       g_object_class_install_property (object_class, PROP_MAIN_PAGE,
+                                        g_param_spec_string ("main-page",
+                                                             "Current main page",
+                                                             "Current main page.",
+                                                             NULL, G_PARAM_READABLE));
+
        /**
         * TotemObject::file-opened:
         * @totem: the #TotemObject which received the signal
@@ -556,6 +568,9 @@ totem_object_get_property (GObject *object,
        case PROP_CURRENT_DISPLAY_NAME:
                g_value_take_string (value, totem_playlist_get_current_title (totem->playlist));
                break;
+       case PROP_MAIN_PAGE:
+               g_value_set_string (value, totem_object_get_main_page (totem));
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
        }
@@ -1032,6 +1047,8 @@ totem_object_set_main_page (TotemObject *totem,
                        gtk_widget_show (totem->add_button);
                totem_grilo_start (TOTEM_GRILO (totem->grilo));
        }
+
+       g_object_notify (G_OBJECT (totem), "main-page");
 }
 
 /**


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