diff options
-rw-r--r-- | docs/reference/endless/endless-sections.txt | 4 | ||||
-rw-r--r-- | endless/eospagemanager.c | 43 | ||||
-rw-r--r-- | endless/eospagemanager.h | 4 | ||||
-rw-r--r-- | endless/eoswindow.c | 8 | ||||
-rw-r--r-- | test/smoke-tests/app-window.js | 4 | ||||
-rw-r--r-- | test/test-page-manager.c | 39 |
6 files changed, 55 insertions, 47 deletions
diff --git a/docs/reference/endless/endless-sections.txt b/docs/reference/endless/endless-sections.txt index 1ae685d..b3227a2 100644 --- a/docs/reference/endless/endless-sections.txt +++ b/docs/reference/endless/endless-sections.txt @@ -55,8 +55,8 @@ eos_page_manager_get_page_actions eos_page_manager_set_page_actions eos_page_manager_get_page_custom_toolbox_widget eos_page_manager_set_page_custom_toolbox_widget -eos_page_manager_get_page_background -eos_page_manager_set_page_background +eos_page_manager_get_page_background_uri +eos_page_manager_set_page_background_uri eos_page_manager_remove_page_by_name <SUBSECTION Standard> EOS_IS_PAGE_MANAGER diff --git a/endless/eospagemanager.c b/endless/eospagemanager.c index b8d7c1e..d719fc7 100644 --- a/endless/eospagemanager.c +++ b/endless/eospagemanager.c @@ -57,14 +57,14 @@ * |[ * gtk_container_add_with_properties (GTK_CONTAINER (page_manager), page, * "name", "front-page", - * "background", "image.jpg", + * "background_uri", "image.jpg", * NULL); * ]| * In Javascript, this has been simplified to use JSON: * |[ * page_manager.add(page, { * name: 'front-page', - * background: 'image.jpg' + * background_uri: 'image.jpg' * }); * ]| * To remove a page, use gtk_container_remove() or @@ -122,7 +122,7 @@ enum CHILD_PROP_NAME, CHILD_PROP_PAGE_ACTIONS, CHILD_PROP_CUSTOM_TOOLBOX_WIDGET, - CHILD_PROP_BACKGROUND, + CHILD_PROP_BACKGROUND_URI, NCHILDPROPS }; @@ -471,9 +471,10 @@ eos_page_manager_get_child_property (GtkContainer *container, g_value_set_string (value, eos_page_manager_get_page_name (self, child)); break; - case CHILD_PROP_BACKGROUND: + case CHILD_PROP_BACKGROUND_URI: g_value_set_string (value, - eos_page_manager_get_page_background (self, child)); + eos_page_manager_get_page_background_uri (self, + child)); break; case CHILD_PROP_PAGE_ACTIONS: @@ -508,9 +509,9 @@ eos_page_manager_set_child_property (GtkContainer *container, eos_page_manager_set_page_name (self, child, g_value_get_string (value)); break; - case CHILD_PROP_BACKGROUND: - eos_page_manager_set_page_background (self, child, - g_value_get_string (value)); + case CHILD_PROP_BACKGROUND_URI: + eos_page_manager_set_page_background_uri (self, child, + g_value_get_string (value)); break; case CHILD_PROP_PAGE_ACTIONS: @@ -635,13 +636,13 @@ eos_page_manager_class_init (EosPageManagerClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** - * EosPageManager:background: + * EosPageManager:background-uri: * * The URI for the image file for the background of this page. Setting this to * %NULL indicates that the window's default background should be used. */ - eos_page_manager_child_props[CHILD_PROP_BACKGROUND] = - g_param_spec_string ("background", "Background", + eos_page_manager_child_props[CHILD_PROP_BACKGROUND_URI] = + g_param_spec_string ("background-uri", "Background URI", "URI for background of the page", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); @@ -998,20 +999,20 @@ eos_page_manager_set_page_custom_toolbox_widget (EosPageManager *self, } /** - * eos_page_manager_get_page_background: + * eos_page_manager_get_page_background_uri: * @self: the page manager * @page: the page to be queried * * Gets the URI for the background image of @page, which must previously have * been added to the page manager. - * See #EosPageManager:background for more information. + * See #EosPageManager:background-uri for more information. * * Returns: the background of @page, or the %NULL if @page does not have a * background. */ const gchar * -eos_page_manager_get_page_background (EosPageManager *self, - GtkWidget *page) +eos_page_manager_get_page_background_uri (EosPageManager *self, + GtkWidget *page) { g_return_val_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self), NULL); g_return_val_if_fail (page != NULL && GTK_IS_WIDGET (page), NULL); @@ -1023,7 +1024,7 @@ eos_page_manager_get_page_background (EosPageManager *self, } /** - * eos_page_manager_set_page_background: + * eos_page_manager_set_page_background_uri: * @self: the page manager * @page: the page to be modified * @background: (allow-none): the URI for the background image of this page. @@ -1031,12 +1032,12 @@ eos_page_manager_get_page_background (EosPageManager *self, * Changes the background of @page, which must previously have been added to the * page manager. * Setting %NULL removes the background, using the window's default background. - * See #EosPageManager:background for more information. + * See #EosPageManager:background-uri for more information. */ void -eos_page_manager_set_page_background (EosPageManager *self, - GtkWidget *page, - const gchar *background) +eos_page_manager_set_page_background_uri (EosPageManager *self, + GtkWidget *page, + const gchar *background) { g_return_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self)); g_return_if_fail (page != NULL && GTK_IS_WIDGET (page)); @@ -1048,7 +1049,7 @@ eos_page_manager_set_page_background (EosPageManager *self, return; info->background_uri = g_strdup (background); - gtk_container_child_notify (GTK_CONTAINER (self), page, "background"); + gtk_container_child_notify (GTK_CONTAINER (self), page, "background-uri"); } /** diff --git a/endless/eospagemanager.h b/endless/eospagemanager.h index 73ac28f..a05800a 100644 --- a/endless/eospagemanager.h +++ b/endless/eospagemanager.h @@ -107,11 +107,11 @@ void eos_page_manager_set_page_custom_toolbox_widget (EosPageManager *se GtkWidget *custom_toolbox_widget); EOS_SDK_ALL_API_VERSIONS -const gchar *eos_page_manager_get_page_background (EosPageManager *self, +const gchar *eos_page_manager_get_page_background_uri (EosPageManager *self, GtkWidget *page); EOS_SDK_ALL_API_VERSIONS -void eos_page_manager_set_page_background (EosPageManager *self, +void eos_page_manager_set_page_background_uri (EosPageManager *self, GtkWidget *page, const gchar *background); diff --git a/endless/eoswindow.c b/endless/eoswindow.c index 9fd2486..7804663 100644 --- a/endless/eoswindow.c +++ b/endless/eoswindow.c @@ -149,6 +149,10 @@ remove_page_background (EosWindow *self) /* * update_page_background: + * @self: the window + * + * Ensures that the window's background image is in line with the currently + * showing page and its child properties. */ static void update_page_background (EosWindow *self) @@ -162,7 +166,7 @@ update_page_background (EosWindow *self) return; } - const gchar *background = eos_page_manager_get_page_background (pm, page); + const gchar *background = eos_page_manager_get_page_background_uri (pm, page); if (background == NULL) { remove_page_background (self); @@ -228,7 +232,7 @@ update_page (EosWindow *self) self); self->priv->child_background_handler = g_signal_connect_swapped (self->priv->current_page, - "child-notify::background", + "child-notify::background-uri", G_CALLBACK (update_page_background), self); } diff --git a/test/smoke-tests/app-window.js b/test/smoke-tests/app-window.js index 702e376..8b5dd15 100644 --- a/test/smoke-tests/app-window.js +++ b/test/smoke-tests/app-window.js @@ -100,12 +100,12 @@ const TestApplication = new Lang.Class ({ this._pm = new Endless.PageManager(); this._pm.add(this._page0, { name: "page0", - background: "images/cat_eye.jpg", + background_uri: "./test/smoke-tests/images/cat_eye.jpg", custom_toolbox_widget: this._toolbox }); this._pm.add(this._page1, { name: "page1", - background: "images/dog_eye.jpg", + background_uri: "./test/smoke-tests/images/dog_eye.jpg", custom_toolbox_widget: this._toolbox, page_actions: true }); diff --git a/test/test-page-manager.c b/test/test-page-manager.c index 2bc8dcb..46ac768 100644 --- a/test/test-page-manager.c +++ b/test/test-page-manager.c @@ -45,19 +45,19 @@ pm_fixture_setup (PageManagerFixture *fixture, gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm), fixture->page1, "name", PAGE1_NAME, - "background", PAGE1_BACKGROUND, + "background-uri", PAGE1_BACKGROUND, NULL); gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm), fixture->page2, "name", PAGE2_NAME, "custom-toolbox-widget", fixture->toolbox2, - "background", PAGE2_BACKGROUND, + "background-uri", PAGE2_BACKGROUND, NULL); gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm), fixture->page3, "name", PAGE3_NAME, "page-actions", TRUE, - "background", PAGE3_BACKGROUND, + "background-uri", PAGE3_BACKGROUND, NULL); } @@ -288,25 +288,25 @@ test_pm_child_prop_background (PageManagerFixture *fixture, { gchar *background; gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page1, - "background", &background, + "background-uri", &background, NULL); g_assert_cmpstr (background, ==, PAGE1_BACKGROUND); g_free (background); gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2, - "background", &background, + "background-uri", &background, NULL); g_assert_cmpstr (background, ==, PAGE2_BACKGROUND); g_free (background); gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page3, - "background", &background, + "background-uri", &background, NULL); g_assert_cmpstr (background, ==, PAGE3_BACKGROUND); g_free (background); gtk_container_child_set (GTK_CONTAINER (fixture->pm), fixture->page2, - "background", EXPECTED_CHANGED_NAME, + "background-uri", EXPECTED_CHANGED_NAME, NULL); gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2, - "background", &background, + "background-uri", &background, NULL); g_assert_cmpstr (background, ==, EXPECTED_CHANGED_NAME); g_free (background); @@ -351,10 +351,11 @@ test_pm_page_no_background (PageManagerFixture *fixture, gchar *background_prop; GtkWidget *new_page = gtk_label_new("new"); gtk_container_add (GTK_CONTAINER (fixture->pm), new_page); - background_get = eos_page_manager_get_page_background (EOS_PAGE_MANAGER (fixture->pm), new_page); + background_get = eos_page_manager_get_page_background_uri (EOS_PAGE_MANAGER (fixture->pm), + new_page); g_assert_cmpstr (background_get, ==, NULL); gtk_container_child_get (GTK_CONTAINER (fixture->pm), new_page, - "background", &background_prop, + "background-uri", &background_prop, NULL); g_assert_cmpstr (background_prop, ==, NULL); g_free (background_prop); @@ -369,16 +370,18 @@ test_pm_page_change_background (PageManagerFixture *fixture, const gchar *background_name_2 = "second background name"; GtkWidget *new_page = gtk_label_new("new"); gtk_container_add (GTK_CONTAINER (fixture->pm), new_page); - eos_page_manager_set_page_background (GTK_CONTAINER (fixture->pm), - new_page, - background_name_1); - background_get = eos_page_manager_get_page_background (EOS_PAGE_MANAGER (fixture->pm), new_page); + eos_page_manager_set_page_background_uri (EOS_PAGE_MANAGER (fixture->pm), + new_page, + background_name_1); + background_get = eos_page_manager_get_page_background_uri (EOS_PAGE_MANAGER (fixture->pm), + new_page); g_assert_cmpstr (background_get, ==, background_name_1); - eos_page_manager_set_page_background (GTK_CONTAINER (fixture->pm), - new_page, - background_name_2); - background_get = eos_page_manager_get_page_background (EOS_PAGE_MANAGER (fixture->pm), new_page); + eos_page_manager_set_page_background_uri (EOS_PAGE_MANAGER (fixture->pm), + new_page, + background_name_2); + background_get = eos_page_manager_get_page_background_uri (EOS_PAGE_MANAGER (fixture->pm), + new_page); g_assert_cmpstr (background_get, ==, background_name_2); } |