summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--endless/Makefile.am2
-rw-r--r--endless/eosactionmenu-private.h68
-rw-r--r--endless/eosactionmenu.c274
-rw-r--r--overrides/Endless.js12
-rw-r--r--test/endless/Makefile.am.inc1
-rw-r--r--test/endless/run-tests.c1
-rw-r--r--test/endless/test-action-menu.c217
-rw-r--r--test/smoke-tests/action-buttons.js126
8 files changed, 0 insertions, 701 deletions
diff --git a/endless/Makefile.am b/endless/Makefile.am
index d6fe209..f26b8e4 100644
--- a/endless/Makefile.am
+++ b/endless/Makefile.am
@@ -34,7 +34,6 @@ endless_private_installed_headers = \
endless/eospagemanager.h \
endless/eostypes.h \
endless/eoswindow.h \
- endless/eosactionmenu-private.h \
endless/eosflexygrid.h
endless_library_sources = \
@@ -46,7 +45,6 @@ endless_library_sources = \
endless/eosresource.c endless/eosresource-private.h \
endless/eostopbar.c endless/eostopbar-private.h \
endless/eosactionbutton.c \
- endless/eosactionmenu.c \
endless/eoswindow.c \
endless/eosflexygrid.c endless/eosflexygridcell.c endless/eosflexygrid-private.h
diff --git a/endless/eosactionmenu-private.h b/endless/eosactionmenu-private.h
deleted file mode 100644
index f6e84d0..0000000
--- a/endless/eosactionmenu-private.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#ifndef EOS_ACTION_MENU_H
-#define EOS_ACTION_MENU_H
-
-#include "eostypes.h"
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EOS_TYPE_ACTION_MENU eos_action_menu_get_type()
-
-#define EOS_ACTION_MENU(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- EOS_TYPE_ACTION_MENU, EosActionMenu))
-
-#define EOS_ACTION_MENU_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- EOS_TYPE_ACTION_MENU, EosActionMenuClass))
-
-#define EOS_IS_ACTION_MENU(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- EOS_TYPE_ACTION_MENU))
-
-#define EOS_IS_ACTION_MENU_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- EOS_TYPE_ACTION_MENU))
-
-#define EOS_ACTION_MENU_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- EOS_TYPE_ACTION_MENU, EosActionMenuClass))
-
-typedef struct _EosActionMenu EosActionMenu;
-typedef struct _EosActionMenuClass EosActionMenuClass;
-
-struct _EosActionMenu
-{
- GtkFrame parent;
-};
-
-struct _EosActionMenuClass
-{
- GtkFrameClass parent_class;
-};
-
-GType eos_action_menu_get_type (void) G_GNUC_CONST;
-
-GtkWidget *eos_action_menu_new ();
-
-void eos_action_menu_add_action (EosActionMenu *menu,
- GtkAction *action);
-
-GtkAction *eos_action_menu_get_action (EosActionMenu *menu,
- const gchar *name);
-
-GList *eos_action_menu_list_actions (EosActionMenu *menu);
-
-
-void eos_action_menu_remove_action (EosActionMenu *menu,
- GtkAction *action);
-
-void eos_action_menu_remove_action_by_name (EosActionMenu *menu,
- const gchar *name);
-
-G_END_DECLS
-
-#endif /* EOS_ACTION_MENU_H */
diff --git a/endless/eosactionmenu.c b/endless/eosactionmenu.c
deleted file mode 100644
index e27cbc2..0000000
--- a/endless/eosactionmenu.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#include "config.h"
-#include "eosactionmenu-private.h"
-
-#include "eosactionbutton.h"
-#include <glib-object.h>
-#include <gtk/gtk.h>
-#include <math.h>
-
-#define _EOS_STYLE_CLASS_ACTION_MENU "action-menu"
-
-/*
- * SECTION:action-menu
- * @short_description: Adding actions to the page
- * @title: Action Menu
- */
-
-
-typedef struct {
- GtkWidget *overlay;
- GtkWidget *center_grid;
- GtkWidget *bottom_grid;
-
- GtkActionGroup *action_group;
-} EosActionMenuPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (EosActionMenu, eos_action_menu, GTK_TYPE_FRAME)
-
-static void
-eos_action_menu_dispose (GObject *object);
-
-static void
-eos_action_menu_finalize (GObject *object);
-
-/* ******* INIT ******* */
-
-static void
-eos_action_menu_class_init (EosActionMenuClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = eos_action_menu_dispose;
- object_class->finalize = eos_action_menu_finalize;
-}
-
-static void
-eos_action_menu_init (EosActionMenu *self)
-{
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (self);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
- gtk_style_context_add_class (context, _EOS_STYLE_CLASS_ACTION_MENU);
-
- priv->overlay = gtk_overlay_new ();
- g_object_set (G_OBJECT (priv->overlay),
- "halign", GTK_ALIGN_FILL,
- "valign", GTK_ALIGN_FILL,
- "hexpand", TRUE,
- "vexpand", TRUE,
- NULL);
-
- priv->center_grid = gtk_grid_new ();
- g_object_set (G_OBJECT (priv->center_grid),
- "orientation", GTK_ORIENTATION_VERTICAL,
- "halign", GTK_ALIGN_CENTER,
- "valign", GTK_ALIGN_CENTER,
- NULL);
-
- priv->bottom_grid = gtk_grid_new ();
- g_object_set (G_OBJECT (priv->bottom_grid),
- "orientation", GTK_ORIENTATION_VERTICAL,
- "halign", GTK_ALIGN_CENTER,
- "valign", GTK_ALIGN_END,
- NULL);
-
- // this is ugly, but needed so the overlay takes all the available space
- GtkWidget* placeholder = gtk_event_box_new();
- gtk_widget_set_hexpand (placeholder, TRUE);
- gtk_widget_set_vexpand (placeholder, TRUE);
- gtk_container_add (GTK_CONTAINER (priv->overlay), placeholder);
-
- gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->center_grid);
- gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->bottom_grid);
-
- gtk_container_add (GTK_CONTAINER (self), priv->overlay);
-
- // TODO : name?
- priv->action_group = gtk_action_group_new ("EosActionMenu");
-
- gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE);
- gtk_widget_set_vexpand (GTK_WIDGET (self), TRUE);
-}
-
-/* ******* LIFECYCLE ******* */
-
-/*
- * eos_action_menu_new:
- *
- * Returns: a new instance
- */
-GtkWidget *
-eos_action_menu_new ()
-{
- return g_object_new (EOS_TYPE_ACTION_MENU, NULL);
-}
-
-static void
-eos_action_menu_dispose (GObject *object)
-{
- G_OBJECT_CLASS (eos_action_menu_parent_class)->dispose (object);
-}
-
-static void
-eos_action_menu_finalize (GObject *object)
-{
- G_OBJECT_CLASS (eos_action_menu_parent_class)->finalize (object);
-}
-
-/* ******* ACTION GROUP MGMT ******* */
-
-/*
- * eos_action_menu_add_action:
- * @menu: a #EosActionMenu
- * @action: a #GtkAction: name, label, icon-name, is-important.
- *
- * Adds an action to the #EosActionMenu, using its #GtkAction:name,
- * #GtkAction:label, #GtkAction:icon-name, #GtkAction:is-important and
- * #GtkAction:stock-id properties.
- *
- * Cancel, close and delete actions are placed at the bottom of the menu. To
- * indicate this, set the #GtkAction:stock-id property to one of
- * #GTK_STOCK_CANCEL, #GTK_STOCK_CLOSE or #GTK_STOCK_DELETE. All other values of
- * this property will be ignored.
- *
- */
-void
-eos_action_menu_add_action (EosActionMenu *menu,
- GtkAction *action)
-{
- g_return_if_fail (EOS_IS_ACTION_MENU (menu));
-
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
- if (action)
- {
- gtk_action_group_add_action (priv->action_group, action);
-
- EosActionButtonSize size = gtk_action_get_is_important (action) ?
- EOS_ACTION_BUTTON_SIZE_PRIMARY :
- EOS_ACTION_BUTTON_SIZE_SECONDARY;
-
- GtkWidget *action_button = eos_action_button_new (size,
- gtk_action_get_label (action),
- gtk_action_get_icon_name (action));
-
- gtk_activatable_set_related_action (GTK_ACTIVATABLE (action_button), action);
-
- if (g_strcmp0 (gtk_action_get_stock_id (action), GTK_STOCK_CANCEL) == 0 ||
- g_strcmp0 (gtk_action_get_stock_id (action), GTK_STOCK_CLOSE) == 0 ||
- g_strcmp0 (gtk_action_get_stock_id (action), GTK_STOCK_DELETE) == 0)
- {
- gtk_container_add (GTK_CONTAINER (priv->bottom_grid), action_button);
- }
- else
- {
- gtk_container_add (GTK_CONTAINER (priv->center_grid), action_button);
- }
- }
-}
-
-/*
- * eos_action_menu_get_action:
- * @menu: an #EosActionMenu
- * @name: the name of the action to retrieve
- *
- * Retrieves an action.
- *
- * Returns: (transfer none): the #GtkAction
- */
-GtkAction *
-eos_action_menu_get_action (EosActionMenu *menu,
- const gchar *name)
-{
- g_return_val_if_fail (EOS_IS_ACTION_MENU (menu), NULL);
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
-
- return gtk_action_group_get_action (priv->action_group, name);
-}
-
-/*
- * eos_action_menu_list_actions:
- * @menu: an #EosActionMenu
- *
- * Returns: (element-type GList) (transfer container): an allocated list of the action objects in the action group
- */
-GList *
-eos_action_menu_list_actions (EosActionMenu *menu)
-{
- g_return_val_if_fail (EOS_IS_ACTION_MENU (menu), NULL);
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
-
- return gtk_action_group_list_actions (priv->action_group);
-}
-
-/*
- * eos_action_menu_remove_action:
- * @menu: an #EosActionMenu
- * @action: the action to remove
- *
- * Removes an action
- */
-void
-eos_action_menu_remove_action (EosActionMenu *menu,
- GtkAction *action)
-{
- g_return_if_fail (EOS_IS_ACTION_MENU (menu));
- g_return_if_fail (GTK_IS_ACTION (action));
-
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
- GList *children, *i;
- GtkWidget *target_child = NULL;
-
- gtk_action_group_remove_action(priv->action_group, action);
-
- children = gtk_container_get_children (GTK_CONTAINER (priv->center_grid));
-
- children = g_list_concat (children,
- gtk_container_get_children (GTK_CONTAINER (priv->bottom_grid)));
-
- for (i = children; i != NULL; i = i->next)
- {
- GtkWidget *child = i->data;
- GtkAction *childs_action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (child));
-
- if (childs_action != NULL &&
- g_strcmp0 (gtk_action_get_name (childs_action), gtk_action_get_name (action)) == 0)
- {
- target_child = child;
- break;
- }
- }
-
- if (target_child != NULL)
- {
- gtk_widget_destroy (target_child);
- }
-}
-
-/*
- * eos_action_menu_remove_action_by_name:
- * @menu: an #EosActionMenu
- * @name: the name of the action to remove
- *
- * Removes the action with the given name
- */
-void
-eos_action_menu_remove_action_by_name (EosActionMenu *menu,
- const gchar *name)
-{
- g_return_if_fail (EOS_IS_ACTION_MENU (menu));
-
- GtkAction *action;
- EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
-
- action = gtk_action_group_get_action (priv->action_group, name);
- if (action)
- {
- eos_action_menu_remove_action (menu, action);
- }
-}
-
-/* ******* LAYOUT AND VISUALS ******* */
-
diff --git a/overrides/Endless.js b/overrides/Endless.js
index 02eed50..1ed3312 100644
--- a/overrides/Endless.js
+++ b/overrides/Endless.js
@@ -42,16 +42,4 @@ function _init() {
}
}
}
-
- // Override Endless.ActionMenu.add_action() so that we hide the use of
- // GtkAction from the developer, as that will be deprecated in the future.
- Endless.ActionMenu.prototype._add_action_real = Endless.ActionMenu.prototype.add_action;
- Endless.ActionMenu.prototype.add_action = function(dict, callback) {
- let action = new Gtk.Action(dict);
- this._add_action_real(action);
-
- if (typeof callback === "function") {
- action.connect('activate', callback);
- }
- }
}
diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc
index 76a29ec..87a1db6 100644
--- a/test/endless/Makefile.am.inc
+++ b/test/endless/Makefile.am.inc
@@ -8,7 +8,6 @@ test_endless_run_tests_SOURCES = \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-application.c \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-page-manager.c \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-window.c \
- $(ENDLESS_TESTS_DIRECTORY)/endless/test-action-menu.c \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-action-button.c \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-flexy-grid.c \
$(ENDLESS_TESTS_DIRECTORY)/endless/test-custom-container.c \
diff --git a/test/endless/run-tests.c b/test/endless/run-tests.c
index 506224b..81823ad 100644
--- a/test/endless/run-tests.c
+++ b/test/endless/run-tests.c
@@ -107,7 +107,6 @@ main (int argc,
add_application_tests ();
add_window_tests ();
add_page_manager_tests ();
- add_action_menu_tests ();
add_action_button_tests ();
add_flexy_grid_test ();
add_custom_container_tests ();
diff --git a/test/endless/test-action-menu.c b/test/endless/test-action-menu.c
deleted file mode 100644
index 0450f6c..0000000
--- a/test/endless/test-action-menu.c
+++ /dev/null
@@ -1,217 +0,0 @@
-#include <gtk/gtk.h>
-#include <endless/endless.h>
-
-#include <endless/eosactionmenu-private.h>
-
-#include "run-tests.h"
-
-#include "endless/eosactionmenu.c"
-
-#define ADD_ACTION_MENU_TEST(path, test_func) \
- g_test_add ((path), ActionMenuFixture, NULL, \
- am_fixture_setup, (test_func), am_fixture_teardown)
-
-typedef struct
-{
- EosActionMenu *action_menu;
- GtkAction *action1;
- GtkAction *action2;
- GtkAction *action3;
-} ActionMenuFixture;
-
-static void
-am_fixture_setup (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- fixture->action_menu = EOS_ACTION_MENU (eos_action_menu_new ());
- fixture->action1 = gtk_action_new ("1", "1", "1", "1");
- fixture->action2 = gtk_action_new ("2", "2", "2", "2");
- fixture->action3 = gtk_action_new ("3", "3", "3", "3");
-
- g_object_ref (fixture->action1);
- g_object_ref (fixture->action2);
- g_object_ref (fixture->action3);
-}
-
-static void
-am_fixture_teardown (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- gtk_widget_destroy (GTK_WIDGET (fixture->action_menu));
- g_object_unref (fixture->action1);
- g_object_unref (fixture->action2);
- g_object_unref (fixture->action3);
-}
-
-/* TESTS */
-
-static void
-test_am_add_action (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- gint size;
- gchar *label, *icon_id;
-
- gtk_action_set_is_important (fixture->action1, TRUE);
- gtk_action_set_icon_name (fixture->action1, "object-select-symbolic");
-
- eos_action_menu_add_action (fixture->action_menu, fixture->action1);
-
- EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (fixture->action_menu);
- GtkWidget *button = gtk_grid_get_child_at (GTK_GRID (action_menu_priv->center_grid), 0, 0);
-
- g_assert (EOS_IS_ACTION_BUTTON (button));
-
- g_object_get (button,
- "size", &size,
- "label", &label,
- "icon-id", &icon_id,
- NULL);
-
- g_assert ( size == EOS_ACTION_BUTTON_SIZE_PRIMARY);
- g_assert ( g_strcmp0 (label, gtk_action_get_label (fixture->action1)) == 0);
- g_assert ( g_strcmp0 (icon_id, gtk_action_get_icon_name (fixture->action1)) == 0);
-
- g_free (label);
- g_free (icon_id);
-}
-
-static void
-test_am_get_action (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- eos_action_menu_add_action (fixture->action_menu, fixture->action1);
-
- GtkAction *retrieved = eos_action_menu_get_action (fixture->action_menu, "1");
-
- g_assert (retrieved == fixture->action1);
-}
-
-static void
-test_am_list_actions (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- GList *list = eos_action_menu_list_actions (fixture->action_menu);
-
- g_assert (list == NULL);
-
- eos_action_menu_add_action (fixture->action_menu, fixture->action1);
- eos_action_menu_add_action (fixture->action_menu, fixture->action2);
-
- list = eos_action_menu_list_actions (fixture->action_menu);
-
- g_assert (g_list_find (list, fixture->action1) != NULL);
- g_assert (g_list_find (list, fixture->action2) != NULL);
-
- g_assert (g_list_find (list, fixture->action3) == NULL);
-}
-
-static gboolean
-menu_contains_button_with_label (EosActionMenu *menu, const gchar* button_label)
-{
- GList* children;
- gboolean found = FALSE;
-
- EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (menu);
- children = gtk_container_get_children (GTK_CONTAINER (action_menu_priv->center_grid));
-
- children = g_list_concat (children,
- gtk_container_get_children (GTK_CONTAINER (action_menu_priv->bottom_grid)));
-
- for (GList *i = children; i != NULL ; i = i->next)
- {
- if (EOS_IS_ACTION_BUTTON (i->data))
- {
- if (g_strcmp0 (eos_action_button_get_label (EOS_ACTION_BUTTON (i->data)),
- button_label) == 0)
- {
- found = TRUE;
- break;
- }
- }
- }
-
- g_list_free (children);
-
- return found;
-}
-
-static void
-test_am_remove_action (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- GList *list;
-
- eos_action_menu_add_action (fixture->action_menu, fixture->action1);
- eos_action_menu_add_action (fixture->action_menu, fixture->action2);
- eos_action_menu_add_action (fixture->action_menu, fixture->action3);
-
- eos_action_menu_remove_action (fixture->action_menu, fixture->action2);
-
- list = eos_action_menu_list_actions (fixture->action_menu);
-
- g_assert (g_list_find (list, fixture->action1) != NULL);
- g_assert (g_list_find (list, fixture->action2) == NULL);
- g_assert (g_list_find (list, fixture->action3) != NULL);
-
- // the buttons have been removed as well
- g_assert (menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action1)));
- g_assert (!menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action2)));
- g_assert (menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action3)));
-
- eos_action_menu_remove_action (fixture->action_menu, fixture->action1);
- eos_action_menu_remove_action (fixture->action_menu, fixture->action3);
-
- list = eos_action_menu_list_actions (fixture->action_menu);
-
- g_assert (g_list_find (list, fixture->action1) == NULL);
- g_assert (g_list_find (list, fixture->action2) == NULL);
- g_assert (g_list_find (list, fixture->action3) == NULL);
-
- // the container is empty
- EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (fixture->action_menu);
- g_assert (gtk_container_get_children (GTK_CONTAINER (action_menu_priv->center_grid)) == NULL);
- g_assert (gtk_container_get_children (GTK_CONTAINER (action_menu_priv->bottom_grid)) == NULL);
-}
-
-static void
-test_am_remove_action_by_name (ActionMenuFixture *fixture,
- gconstpointer unused)
-{
- eos_action_menu_add_action (fixture->action_menu, fixture->action1);
- eos_action_menu_add_action (fixture->action_menu, fixture->action2);
- eos_action_menu_add_action (fixture->action_menu, fixture->action3);
-
- eos_action_menu_remove_action_by_name (fixture->action_menu, "2");
-
- GList *list = eos_action_menu_list_actions (fixture->action_menu);
-
- g_assert (g_list_find (list, fixture->action1) != NULL);
- g_assert (g_list_find (list, fixture->action2) == NULL);
- g_assert (g_list_find (list, fixture->action3) != NULL);
-
- g_assert (menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action1)));
- g_assert (!menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action2)));
- g_assert (menu_contains_button_with_label (fixture->action_menu,
- gtk_action_get_label (fixture->action3)));
-}
-
-void
-add_action_menu_tests (void)
-{
- ADD_ACTION_MENU_TEST ("/action-menu/add-action",
- test_am_add_action);
- ADD_ACTION_MENU_TEST ("/action-menu/get-action",
- test_am_get_action);
- ADD_ACTION_MENU_TEST ("/action-menu/list-actions",
- test_am_list_actions);
- ADD_ACTION_MENU_TEST ("/action-menu/remove-action",
- test_am_remove_action);
- ADD_ACTION_MENU_TEST ("/action-menu/remove-action-by-name",
- test_am_remove_action_by_name);
-}
diff --git a/test/smoke-tests/action-buttons.js b/test/smoke-tests/action-buttons.js
deleted file mode 100644
index 476912a..0000000
--- a/test/smoke-tests/action-buttons.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2013 Endless Mobile, Inc.
-
-const Lang = imports.lang;
-const Endless = imports.gi.Endless;
-const Gtk = imports.gi.Gtk;
-
-const TEST_APPLICATION_ID = 'com.endlessm.example.test-action-buttons';
-
-const TestApplication = new Lang.Class ({
- Name: 'TestApplication',
- Extends: Endless.Application,
-
- vfunc_startup: function() {
- this.parent();
-
- this._page = new Gtk.Grid ();
-
- this._content = new Gtk.Grid ({
- hexpand: true,
- halign: Gtk.Align.CENTER,
- vexpand: true,
- valign: Gtk.Align.CENTER});
-
- this._darkSwitch = new Gtk.Switch ({active: false});
- this._darkSwitch.connect ('notify::active', Lang.bind (this, function (active) {
- if (this._darkSwitch.get_active()) {
- this._menu.get_style_context().add_class('dark');
- } else {
- this._menu.get_style_context().remove_class('dark');
- }
- }));
- this._content.attach(new Gtk.Label ({label: 'Dark action menu'}), 0, 0, 1, 1);
- this._content.attach(this._darkSwitch, 1, 0, 1, 1);
-
- this._content.attach (new Endless.ActionButton({
- name: 'LEFT',
- 'icon-id': 'object-select-symbolic',
- label: 'LEFT',
- 'label-position': Gtk.PositionType.LEFT
- }), 0, 1, 1, 1);
- this._content.attach (new Endless.ActionButton({
- name: 'TOP',
- 'icon-id': 'object-select-symbolic',
- label: 'TOP',
- 'label-position': Gtk.PositionType.TOP
- }), 1, 1, 1, 1);
- this._content.attach (new Endless.ActionButton({
- name: 'BOTTOM',
- 'icon-id': 'object-select-symbolic',
- label: 'BOTTOM',
- 'label-position': Gtk.PositionType.BOTTOM
- }), 0, 2, 1, 1);
- this._content.attach (new Endless.ActionButton({
- name: 'RIGHT',
- 'icon-id': 'object-select-symbolic',
- label: 'RIGHT',
- 'label-position': Gtk.PositionType.RIGHT
- }), 1, 2, 1, 1);
-
- this._menu = new Endless.ActionMenu ({name: 'menu'});
-
- // the ActionMenu takes 1/6 of the width
- this._page.set_column_homogeneous (true);
- this._page.attach (this._content, 0, 0, 5, 1);
- this._page.attach (this._menu, 5, 0, 1, 1);
-
- this._menu.add_action ({
- name: 'select',
- 'icon-name': 'object-select-symbolic',
- label: 'SELECT',
- 'is-important': true },
- Lang.bind(this, function () {
- var md = new Gtk.MessageDialog({modal:true, title:"Information",
- message_type:Gtk.MessageType.INFO,
- buttons:Gtk.ButtonsType.OK, text:"Select button pressed!"});
- md.run();
- md.destroy();
- }));
-
- this._menu.add_action ({
- name: 'delete',
- 'icon-name': 'edit-delete-symbolic',
- label: 'DELETE',
- 'is-important': false,
- 'stock-id': Gtk.STOCK_DELETE });
-
- this._menu.add_action ({
- name: 'smile',
- 'icon-name': 'face-smile-symbolic',
- label: 'SMILE',
- 'is-important': false });
-
- this._menu.add_action ({
- name: 'sadface',
- 'icon-name': 'face-sad-symbolic',
- label: 'SAD FACE',
- 'is-important': false });
-
- this._pm = new Endless.PageManager();
- this._pm.add(this._page, { name: "page" });
-
- let provider = new Gtk.CssProvider ();
- provider.load_from_path ('./test/smoke-tests/eosactionbutton.css');
-
- this._window = new Endless.Window({
- application: this,
- border_width: 1,
- page_manager: this._pm
- });
-
- let context = new Gtk.StyleContext();
- context.add_provider_for_screen(this._window.get_screen(),
- provider,
- Gtk.STYLE_PROVIDER_PRIORITY_USER);
-
- this._window.show_all();
- },
-
- _onButtonClicked: function () {
- this._window.destroy();
- },
-});
-
-let app = new TestApplication({ application_id: TEST_APPLICATION_ID,
- flags: 0 });
-app.run(ARGV);