static void mex_telepathy_channel_create_busy_box (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; ClutterActor *calling_padding; ClutterActor *calling_box; ClutterActor *spinner; ClutterActor *stack; priv->busy_label = mx_label_new(); mx_label_set_y_align (MX_LABEL (priv->busy_label), MX_ALIGN_MIDDLE); mx_label_set_x_align (MX_LABEL (priv->busy_label), MX_ALIGN_MIDDLE); spinner = mx_spinner_new (); calling_box = mx_box_layout_new (); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (calling_box), priv->busy_label, 0, "expand", TRUE, "x-align", MX_ALIGN_START, "x-fill", TRUE, NULL); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (calling_box), spinner, 1, "expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); priv->busy_box = mx_frame_new (); clutter_actor_set_width (CLUTTER_ACTOR (priv->busy_box), 475); mx_stylable_set_style_class (MX_STYLABLE (priv->busy_box), "CallingFrameBorder"); calling_padding = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (calling_padding), "CallingFrame"); mx_bin_set_child (MX_BIN (priv->busy_box), calling_padding); mx_bin_set_fill (MX_BIN (priv->busy_box), TRUE, TRUE); mx_bin_set_child (MX_BIN (calling_padding), calling_box); mx_bin_set_fill (MX_BIN (calling_padding), TRUE, TRUE); stack = mx_window_get_child (mex_get_main_window ()); clutter_container_add (CLUTTER_CONTAINER (stack), priv->busy_box, NULL); mx_stack_child_set_x_fill (MX_STACK (stack), priv->busy_box, FALSE); mx_stack_child_set_y_fill (MX_STACK (stack), priv->busy_box, FALSE); }
static void mpd_volume_tile_init (MpdVolumeTile *self) { MpdVolumeTilePrivate *priv = GET_PRIVATE (self); ClutterActor *icon; /* Layout */ mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), MPD_TILE_ICON_SPACING); icon = mx_icon_new (); clutter_actor_set_name (icon, "volume-off"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), icon, -1, "y-fill", FALSE, NULL); priv->volume_slider = mx_slider_new (); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->volume_slider, -1, "expand", TRUE, NULL); g_signal_connect (priv->volume_slider, "notify::value", G_CALLBACK (_volume_slider_value_notify_cb), self); icon = mx_icon_new (); clutter_actor_set_name (icon, "volume-on"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), icon, -1, "y-fill", FALSE, NULL); /* Control */ priv->control = gvc_mixer_control_new (MIXER_CONTROL_NAME); g_signal_connect (priv->control, "default-sink-changed", G_CALLBACK (_mixer_control_default_sink_changed_cb), self); g_signal_connect (priv->control, "ready", G_CALLBACK (_mixer_control_ready_cb), self); gvc_mixer_control_open (priv->control); }
void mpd_storage_device_tile_show_message_full (MpdStorageDeviceTile *self, char const *message, bool replace_buttons, unsigned int timeout_s, GSourceFunc function, void *data) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); g_return_if_fail (MPD_IS_STORAGE_DEVICE_TILE (self)); if (priv->message == NULL) { ClutterText *text; priv->message = mx_label_new_with_text (message); mx_stylable_set_style_class (MX_STYLABLE (priv->message), "message"); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->message)); clutter_text_set_line_wrap (text, true); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD); clutter_text_set_single_line_mode (text, false); clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_NONE); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->message, 2, "x-align", MX_ALIGN_MIDDLE, NULL); } if (replace_buttons) { mx_widget_set_disabled (MX_WIDGET (priv->open), true); mx_widget_set_disabled (MX_WIDGET (priv->eject), true); clutter_container_remove_actor (CLUTTER_CONTAINER (self), priv->import); } mx_label_set_text (MX_LABEL (priv->message), message); if (timeout_s) { g_timeout_add_seconds (timeout_s, function, data); } }
static void mex_telepathy_channel_create_toolbar (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; gchar *static_image_path; ClutterActor *toolbar; MxAction *end_action; MxAction *camera_action; MxAction *mute_action; GError *error = NULL; // Create the user label priv->avatar_image = mx_image_new (); static_image_path = g_build_filename (mex_get_data_dir (), "style", "thumb-call-avatar-small.png", NULL); mx_image_set_from_file (MX_IMAGE (priv->avatar_image), static_image_path, &error); if (error) { g_warning ("Error loading texture %s", error->message); g_clear_error (&error); } if (static_image_path) g_free (static_image_path); priv->title_label = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->title_label), MX_ALIGN_MIDDLE); mx_label_set_x_align (MX_LABEL (priv->title_label), MX_ALIGN_MIDDLE); end_action = mx_action_new_full ("End", "Hang Up", G_CALLBACK (mex_telepathy_channel_on_hangup), self); priv->end_button = mex_action_button_new (end_action); mx_stylable_set_style_class (MX_STYLABLE (priv->end_button), "EndCall"); camera_action = mx_action_new_full("Camera", "Camera Off", G_CALLBACK (mex_telepathy_channel_toggle_camera), self); priv->camera_button = mex_action_button_new (camera_action); /* off by default */ mex_telepathy_channel_set_camera_state (self, FALSE); mute_action = mx_action_new_full("Mute", "Mic Off", G_CALLBACK (mex_telepathy_channel_toggle_mute), self); priv->mute_button = mex_action_button_new (mute_action); mx_stylable_set_style_class (MX_STYLABLE (priv->mute_button), "MediaMute"); toolbar = mx_box_layout_new (); clutter_actor_set_width (toolbar, 980); clutter_actor_set_height (toolbar, 48); mx_stylable_set_style_class (MX_STYLABLE (toolbar), "MexCallControlsTitle"); // Put the buttons in the toolbar mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar), priv->avatar_image, 0, "expand", FALSE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar), priv->title_label, 1, "expand", TRUE, NULL); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar), priv->camera_button, 2, "expand", TRUE, NULL); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar), priv->mute_button, 3, "expand", TRUE, NULL); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar), priv->end_button, 4, "expand", TRUE, NULL); priv->toolbar_area = mx_frame_new (); mx_bin_set_child (MX_BIN (priv->toolbar_area), toolbar); mx_stylable_set_style_class (MX_STYLABLE (priv->toolbar_area), "ToolbarArea"); }
int main (int argc, char **argv) { ClutterActor *stage; MxBoxLayout *vbox; MxBoxLayout *hbox; ClutterActor *button; ClutterActor *label; ObjectStoreTest app = { 0, }; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 320.0, 240.0); vbox = (MxBoxLayout *) mx_box_layout_new (); clutter_actor_set_size (CLUTTER_ACTOR (vbox), 320.0, 240.0); mx_box_layout_set_orientation (vbox, MX_ORIENTATION_VERTICAL); clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (vbox)); /* Create model */ app.store = foo_object_store_new (2, FOO_TYPE_TEST_OBJECT, "foo", /* column #0 */ G_TYPE_STRING, "text"); /* column #1 */ /* * Create view */ app.view = mx_list_view_new (); /* Use MxButton to render the model's items */ mx_list_view_set_item_type (MX_LIST_VIEW (app.view), MX_TYPE_BUTTON); /* Map column #1 to attribute "label" of view's GtkButton */ mx_list_view_add_attribute (MX_LIST_VIEW (app.view), "label", 1); /* Connect to model */ mx_list_view_set_model (MX_LIST_VIEW (app.view), app.store); mx_box_layout_add_actor_with_properties (vbox, app.view, -1, "expand", true, "x-fill", true, "y-fill", true, NULL); hbox = (MxBoxLayout *) mx_box_layout_new (); mx_box_layout_set_orientation (hbox, MX_ORIENTATION_HORIZONTAL); mx_box_layout_add_actor_with_properties (vbox, CLUTTER_ACTOR (hbox), -1, "expand", false, "x-fill", true, NULL); app.entry = (MxEntry *) mx_entry_new (); mx_box_layout_add_actor_with_properties (hbox, CLUTTER_ACTOR (app.entry), -1, "expand", true, "x-fill", true, NULL); button = mx_button_new_with_label ("Update"); g_signal_connect (button, "clicked", G_CALLBACK (_update_clicked), &app); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); button = mx_button_new_with_label ("Dump"); g_signal_connect (button, "clicked", G_CALLBACK (_dump_clicked), &app); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); label = mx_label_new_with_text ("Enter text and update to add item\n" "Enter <number>:<text> to change item <number>\n" "Enter -<number> to delete item <number>"); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label); clutter_actor_show_all (stage); clutter_main (); return EXIT_SUCCESS; }
static void dawati_bt_request_init (DawatiBtRequest *request) { ClutterActor *title_box, *close_btn, *btn_box; DawatiBtRequestPrivate *priv = GET_PRIVATE (request); mx_box_layout_set_orientation (MX_BOX_LAYOUT (request), MX_ORIENTATION_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (request), "BtRequest"); priv->request = DAWATI_BT_REQUEST_TYPE_PIN; /* FIXME: this should maybe not be instance-specific */ priv->uuid_strings = _new_uiid_strings (); title_box = mx_box_layout_new (); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), title_box, -1, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); priv->title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->title), "BtTitle"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (title_box), priv->title, -1, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); close_btn = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (close_btn), "BtCloseButton"); mx_bin_set_child (MX_BIN (close_btn), mx_icon_new ()); mx_box_layout_add_actor (MX_BOX_LAYOUT (title_box), close_btn, -1); g_signal_connect (close_btn, "clicked", G_CALLBACK (_close_clicked_cb), request); priv->request_label = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->request_label), "BtLabel"); mx_label_set_line_wrap (MX_LABEL (priv->request_label), TRUE); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), priv->request_label, -1, "expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); btn_box = mx_box_layout_new (); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), btn_box, -1, "expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_END, NULL); priv->request_entry = mx_entry_new (); mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_entry, -1); priv->request_always_btn = mx_button_new (); /* TRANSLATORS: request button label */ mx_button_set_label (MX_BUTTON (priv->request_always_btn), _("Always grant")); mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_always_btn, -1); g_signal_connect (priv->request_always_btn, "clicked", G_CALLBACK (_always_clicked_cb), request); priv->request_yes_btn = mx_button_new (); mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_yes_btn, -1); g_signal_connect (priv->request_yes_btn, "clicked", G_CALLBACK (_yes_clicked_cb), request); }
static void mpd_storage_device_tile_init (MpdStorageDeviceTile *self) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); ClutterText *text; ClutterActor *separator; mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (self), true); priv->table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->table), 5); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->table, -1, "x-fill", true, NULL); /* 0 1 2 +--------------------------+ Table 0 | | Text | Open | 1 | Icon | Progress | Eject | +------+-----------+-------+ Vbox 2 | <message> .. Import data | +--------------------------+ 3 | ======================== | +--------------------------+ */ /* * Column 0: icon */ priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, MPD_STORAGE_DEVICE_TILE_ICON_SIZE, MPD_STORAGE_DEVICE_TILE_ICON_SIZE); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->icon, 0, 0, "row-span", 2, "column-span", 1, "x-align", MX_ALIGN_START, "x-expand", false, "x-fill", false, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 1 */ /* Text */ priv->label = mx_label_new (); clutter_actor_set_width (priv->label, 200.0); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label)); clutter_text_set_line_wrap (text, true); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD); clutter_text_set_single_line_mode (text, false); clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_END); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->label, 0, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* Progress */ priv->meter = mx_progress_bar_new (); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->meter, 1, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 2: buttons */ /* Open button */ priv->open = mx_button_new_with_label (_("Open")); g_signal_connect (priv->open, "clicked", G_CALLBACK (_open_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->open, 0, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_END, "y-expand", false, "y-fill", false, NULL); /* Eject button */ priv->eject = mx_button_new_with_label (_("Eject")); g_signal_connect (priv->eject, "clicked", G_CALLBACK (_eject_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->eject, 1, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Row 2 */ /* Import button */ priv->import = mx_button_new (); clutter_actor_set_name (priv->import, "import"); g_signal_connect (priv->import, "clicked", G_CALLBACK (_import_clicked_cb), self); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->import, -1, "expand", false, "x-align", MX_ALIGN_END, "x-fill", false, NULL); /* * 4th row: separator */ /* Separator */ separator = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (separator), "separator"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), separator, -1, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", true, "y-align", MX_ALIGN_START, "y-fill", false, NULL); }