static void mpl_application_view_init (MplApplicationView *self) { MplApplicationViewPrivate *priv; ClutterActor *actor = CLUTTER_ACTOR (self); priv = self->priv = APPLICATION_VIEW_PRIVATE (self); /* tile */ clutter_actor_set_reactive (actor, TRUE); mx_stylable_set_style_class (MX_STYLABLE (actor), "switcherTile"); clutter_actor_set_size (actor, TILE_WIDTH, TILE_HEIGHT); g_signal_connect (self, "button-release-event", G_CALLBACK (activate_clicked), NULL); priv->title_box = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); clutter_actor_set_parent (priv->title_box, actor); /* title */ priv->title = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->title), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->title), "appTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->title, 0); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->title, TRUE); /* subtitle */ priv->subtitle = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->subtitle), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->subtitle), "appSubTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, 1); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, FALSE); /* close button */ priv->close_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->close_button), "appCloseButton"); clutter_actor_set_parent (priv->close_button, actor); g_signal_connect (priv->close_button, "clicked", G_CALLBACK (close_btn_clicked), self); /* frame */ priv->app_frame = mx_frame_new (); clutter_actor_set_size (priv->app_frame, 250, 100); mx_stylable_set_style_class (MX_STYLABLE (priv->app_frame), "appBackground"); clutter_actor_set_parent (priv->app_frame, actor); /* shadow */ priv->shadow = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->shadow), "appShadow"); mx_bin_set_child (MX_BIN (priv->app_frame), priv->shadow); mx_bin_set_fill (MX_BIN (priv->app_frame), FALSE, FALSE); clutter_actor_show_all (actor); }
static void mpl_content_pane_init (MplContentPane *self) { MplContentPanePrivate *priv = GET_PRIVATE (self); mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), 6); priv->header = (MxBoxLayout *) mx_box_layout_new (); mx_box_layout_set_spacing (priv->header, 12); mx_stylable_set_style_class (MX_STYLABLE (priv->header), "header"); clutter_actor_set_height ((ClutterActor *) priv->header, 36); mx_box_layout_insert_actor (MX_BOX_LAYOUT (self), CLUTTER_ACTOR (priv->header), 0); clutter_container_child_set (CLUTTER_CONTAINER (self), (ClutterActor *) priv->header, "expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, NULL); priv->title = (MxLabel *) mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->title), "title"); mx_box_layout_insert_actor (priv->header, (ClutterActor *) priv->title, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->header), (ClutterActor *) priv->title, "expand", TRUE, "x-fill", TRUE, "y-fill", FALSE, NULL); }
static void add_float_prop_base (ClutterActor *table, const char *name, FloatProp *prop, float value) { int table_y = mx_table_get_row_count (MX_TABLE (table)); ClutterActor *label; ClutterActor *slider; label = mx_label_new_with_text (name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); slider = mx_slider_new (); mx_table_add_actor (MX_TABLE (table), slider, table_y, 1); prop->label = mx_label_new (); mx_table_add_actor (MX_TABLE (table), prop->label, table_y, 2); mx_slider_set_value (MX_SLIDER (slider), (value - prop->min) / (prop->max - prop->min)); update_float_prop_label (prop, value); g_signal_connect_data (slider, "notify::value", G_CALLBACK (float_prop_value_cb), prop, (GClosureNotify) float_prop_free, 0); }
static void mpd_disk_tile_init (MpdDiskTile *self) { MpdDiskTilePrivate *priv = GET_PRIVATE (self); mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), 5); priv->label = mx_label_new (); clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->label); clutter_text_set_ellipsize (CLUTTER_TEXT (mx_label_get_clutter_text ( MX_LABEL (priv->label))), PANGO_ELLIPSIZE_NONE); priv->meter = mx_progress_bar_new (); clutter_actor_set_height (priv->meter, 12); clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->meter); /* Display size of the volume $HOME is on. */ priv->storage = mpd_storage_device_new (g_get_home_dir ()); g_signal_connect (priv->storage, "notify::size", G_CALLBACK (_storage_size_notify_cb), self); g_signal_connect (priv->storage, "notify::available-size", G_CALLBACK (_storage_size_notify_cb), self); update (self); }
static void dawati_bt_device_init (DawatiBtDevice *device) { ClutterActor *button; DawatiBtDevicePrivate *priv = GET_PRIVATE (device); mx_stylable_set_style_class (MX_STYLABLE (device), "BtDevice"); priv->label = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->label), "BtTitle"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (device), priv->label, -1, "expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (button), "BtCloseButton"); mx_bin_set_child (MX_BIN (button), mx_icon_new ()); g_signal_connect (button, "clicked", G_CALLBACK (_disconnect_clicked_cb), device); mx_box_layout_insert_actor (MX_BOX_LAYOUT (device), button, -1); }
static void mex_clock_bin_init (MexClockBin *self) { MexClockBinPrivate *priv = self->priv = CLOCK_BIN_PRIVATE (self); priv->clock_hbox = mx_box_layout_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->clock_hbox), "MexClockBin"); clutter_actor_set_parent (priv->clock_hbox, CLUTTER_ACTOR (self)); priv->time_label = mx_label_new (); priv->icon = mx_icon_new (); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->clock_hbox), priv->time_label, 0, "x-align", MX_ALIGN_START, "expand", TRUE, NULL); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->clock_hbox), priv->icon, 1, NULL); g_signal_connect (self, "actor-added", G_CALLBACK (mex_clock_bin_actor_added), NULL); g_signal_connect (self, "actor-removed", G_CALLBACK (mex_clock_bin_actor_removed), NULL); mex_clock_update_cb (self); }
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 mex_column_view_init (MexColumnView *self) { MexColumnViewPrivate *priv = self->priv = COLUMN_VIEW_PRIVATE (self); /* Begin private children */ clutter_actor_push_internal (CLUTTER_ACTOR (self)); /* Create the header */ priv->header = mx_box_layout_new (); mx_box_layout_set_orientation ((MxBoxLayout *) priv->header, MX_ORIENTATION_HORIZONTAL); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->header, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); priv->button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->button), "Header"); priv->label = mx_label_new (); g_object_set (priv->label, "clip-to-allocation", TRUE, "fade-out", TRUE, NULL); clutter_actor_add_child (CLUTTER_ACTOR (priv->button), priv->label); clutter_actor_add_child (priv->header, priv->button); clutter_container_child_set (CLUTTER_CONTAINER (priv->header), priv->button, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, "y-fill", TRUE, NULL); g_signal_connect (priv->button, "clicked", G_CALLBACK (mex_column_header_clicked_cb), self); priv->scroll = mex_scroll_view_new (); mx_kinetic_scroll_view_set_scroll_policy (MX_KINETIC_SCROLL_VIEW (priv->scroll), MX_SCROLL_POLICY_VERTICAL); mex_scroll_view_set_indicators_hidden (MEX_SCROLL_VIEW (priv->scroll), TRUE); clutter_actor_set_parent (priv->scroll, CLUTTER_ACTOR (self)); priv->column = mex_column_new (); clutter_actor_add_child (CLUTTER_ACTOR (priv->scroll), priv->column); g_signal_connect (priv->column, "notify::opened", G_CALLBACK (mex_column_view_opened_cb), self); /* End of private children */ clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* Set the column as reactive and enable collapsing */ clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); }
static void mnb_launcher_button_init (MnbLauncherButton *self) { ClutterActor *label; self->priv = MNB_LAUNCHER_BUTTON_GET_PRIVATE (self); g_signal_connect (self, "leave-event", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "key-focus-out", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "enter-event", G_CALLBACK (_enter_event_cb), NULL); self->priv->icon = NULL; mx_stylable_set_style_class (MX_STYLABLE (self), "contentTile"); /* "app" label */ self->priv->title = (MxLabel *) mx_label_new (); mx_label_set_x_align (MX_LABEL (self->priv->title), MX_ALIGN_MIDDLE); clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->title), FALSE); mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (self->priv->title), 1, 0, "x-align", MX_ALIGN_MIDDLE, "x-expand", TRUE, "x-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, "y-expand", TRUE, "y-fill", TRUE, NULL); label = mx_label_get_clutter_text (self->priv->title); clutter_text_set_ellipsize (CLUTTER_TEXT (label), PANGO_ELLIPSIZE_END); clutter_text_set_line_alignment (CLUTTER_TEXT (label), PANGO_ALIGN_CENTER); clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (label), PANGO_WRAP_WORD_CHAR); /* "fav app" toggle */ self->priv->fav_toggle = g_object_ref_sink (CLUTTER_ACTOR (mx_button_new ())); mx_button_set_is_toggle (MX_BUTTON (self->priv->fav_toggle), TRUE); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fav_toggle), "mnb-launcher-button-fav-toggle"); clutter_actor_set_size (self->priv->fav_toggle, FAV_TOGGLE_SIZE, FAV_TOGGLE_SIZE); mx_table_insert_actor (MX_TABLE (self), CLUTTER_ACTOR (self->priv->fav_toggle), 0, 0); g_signal_connect (self->priv->fav_toggle, "notify::toggled", G_CALLBACK (fav_button_notify_toggled_cb), self); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); }
static void add_color_prop_base (ClutterActor *table, const char *name, ColorProp *prop, const ClutterColor *value) { int table_y = mx_table_get_row_count (MX_TABLE (table)); ClutterActor *label; static const char *color_names[] = { "red", "green", "blue" }; int i; label = mx_label_new_with_text (name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); prop->rect = clutter_rectangle_new (); clutter_rectangle_set_color (CLUTTER_RECTANGLE (prop->rect), value); clutter_actor_set_size (prop->rect, 20, 0); mx_table_add_actor (MX_TABLE (table), prop->rect, table_y++, 1); for (i = 0; i < G_N_ELEMENTS (color_names); i++) { ClutterActor *slider; char *label_name = g_strconcat (name, " ", color_names[i], NULL); ColorPropComp *prop_comp = g_slice_new (ColorPropComp); label = mx_label_new_with_text (label_name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); g_free (label_name); slider = mx_slider_new (); mx_table_add_actor (MX_TABLE (table), slider, table_y, 1); mx_slider_set_value (MX_SLIDER (slider), ((guint8 *) value)[i] / 255.0f); prop_comp->comp_num = i; prop_comp->prop = prop; prop_comp->label = mx_label_new (); mx_table_add_actor (MX_TABLE (table), prop_comp->label, table_y, 2); update_prop_comp_label (prop_comp, ((guint8 *) value)[i]); g_signal_connect_data (slider, "notify::value", G_CALLBACK (color_prop_value_cb), prop_comp, (GClosureNotify) color_prop_comp_free, 0); table_y++; } }
static void ntf_tray_constructed (GObject *object) { NtfTray *self = (NtfTray*) object; ClutterActor *actor = (ClutterActor*) self; NtfTrayPrivate *priv = self->priv; ClutterActor *button; if (G_OBJECT_CLASS (ntf_tray_parent_class)->constructed) G_OBJECT_CLASS (ntf_tray_parent_class)->constructed (object); priv->notifiers = clutter_actor_new (); clutter_actor_add_child(actor, priv->notifiers); /* 'Overflow' control */ priv->control = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->control), "notification-control"); #if 0 button = mx_button_new (); mx_button_set_label (MX_BUTTON (button), _("Dismiss All")); mx_table_add_actor (MX_TABLE (priv->control), button, 0, 1); g_signal_connect (button, "clicked", G_CALLBACK (ntf_tray_dismiss_all_cb), self); #endif //DV priv->control_text = mx_label_new (); mx_table_add_actor (MX_TABLE (priv->control), CLUTTER_ACTOR (priv->control_text), 0, 0); clutter_actor_set_width (priv->control, CLUSTER_WIDTH); clutter_actor_add_child(actor, priv->control); clutter_actor_hide (priv->control); clutter_actor_set_reactive (priv->notifiers, TRUE); clutter_actor_set_reactive (actor, TRUE); mnb_input_manager_push_actor (actor, MNB_INPUT_LAYER_TOP); }
static void mpd_folder_button_init (MpdFolderButton *self) { MpdFolderButtonPrivate *priv = GET_PRIVATE (self); ClutterActor *vbox; ClutterText *text; /* Box */ vbox = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL); mx_bin_set_child (MX_BIN (self), vbox); /* Icon */ priv->icon = clutter_texture_new (); clutter_texture_set_sync_size (CLUTTER_TEXTURE (priv->icon), true); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->icon, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", false, "y-align", MX_ALIGN_START, "y-fill", false, NULL); /* Label */ priv->label = mx_label_new (); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label)); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD_CHAR); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->label); clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->label, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", false, "y-align", MX_ALIGN_START, "y-fill", false, NULL); }
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"); }
static void mex_column_init (MexColumn *self) { ClutterActor *box; MexColumnPrivate *priv = self->priv = GET_PRIVATE (self); /* Begin private children */ clutter_actor_push_internal (CLUTTER_ACTOR (self)); /* Create the header */ priv->header = mx_box_layout_new (); mx_box_layout_set_orientation ((MxBoxLayout *) priv->header, MX_ORIENTATION_HORIZONTAL); mx_stylable_set_style_class (MX_STYLABLE (priv->header), "Header"); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->header, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); priv->button = mx_button_new (); priv->icon = mx_icon_new (); priv->label = mx_label_new (); g_object_set (priv->label, "clip-to-allocation", TRUE, "fade-out", TRUE, NULL); box = mx_box_layout_new (); mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 8); clutter_container_add (CLUTTER_CONTAINER (box), priv->icon, priv->label, NULL); clutter_container_child_set (CLUTTER_CONTAINER (box), priv->icon, "expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (box), priv->label, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, NULL); clutter_container_add_actor (CLUTTER_CONTAINER (priv->button), box); mx_bin_set_fill (MX_BIN (priv->button), TRUE, FALSE); clutter_container_add_actor (CLUTTER_CONTAINER (priv->header), priv->button); clutter_container_child_set (CLUTTER_CONTAINER (priv->header), priv->button, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, "y-fill", TRUE, NULL); g_signal_connect (priv->button, "clicked", G_CALLBACK (mex_column_header_clicked_cb), self); /* End of private children */ clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* Set the column as reactive and enable collapsing */ clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); priv->collapse = TRUE; }
static void penge_interesting_tile_init (PengeInterestingTile *self) { PengeInterestingTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *icon; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); priv->primary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->primary_text), "PengeInterestingTilePrimaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->primary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->primary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->secondary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->secondary_text), "PengeInterestingTileSecondaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->secondary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->secondary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, 28, 28); clutter_actor_hide (priv->icon); /* This gets added to ourself table after our body because of ordering */ priv->details_overlay = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->details_overlay), "PengeInterestingTileDetails"); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->details_overlay, 1, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), (ClutterActor *)priv->details_overlay, "x-expand", TRUE, "y-expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_END, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->primary_text, 0, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->primary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->secondary_text, 1, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->secondary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->icon, 0, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->icon, "row-span", 2, "y-expand", FALSE, "x-expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, NULL); priv->remove_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button), "PengeInterestingTileRemoveButton"); icon = (ClutterActor *)mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "PengeInterestingTileIcon"); mx_bin_set_child (MX_BIN (priv->remove_button), (ClutterActor *)icon); mx_table_add_actor_with_properties (MX_TABLE (priv->details_overlay), priv->remove_button, 0, 2, "row-span", 2, "x-expand", TRUE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect (priv->remove_button, "clicked", (GCallback)_remove_button_clicked, self); mx_table_set_column_spacing (MX_TABLE (priv->details_overlay), 4); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); clutter_actor_hide (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 0, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 0, NULL); }
static void mnb_people_panel_init (MnbPeoplePanel *self) { MnbPeoplePanelPrivate *priv = GET_PRIVATE (self); ClutterActor *label; ClutterActor *bin; ClutterActor *table; ClutterActor *scroll_view; ClutterActor *left_side; ClutterActor *right_side; AnerleyFeed *active_feed; priv->am = tp_account_manager_dup (); priv->aggregator = folks_individual_aggregator_new (); /* Populate top level table */ label = mx_label_new_with_text (_("IM")); mx_stylable_set_style_class (MX_STYLABLE (label), "titleBar"); mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (label), 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, NULL); table = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (table), "contentPane"); mx_table_set_column_spacing (MX_TABLE (table), 23); mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (table), 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); left_side = mx_table_new (); clutter_actor_set_width (left_side, 300); mx_table_set_row_spacing (MX_TABLE (left_side), 10); mx_table_insert_actor_with_properties (MX_TABLE (table), CLUTTER_ACTOR (left_side), 0, 0, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", TRUE, NULL); right_side = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (right_side), 10); mx_table_insert_actor_with_properties (MX_TABLE (table), CLUTTER_ACTOR (right_side), 0, 1, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); /* Populate left side */ table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 10); clutter_actor_set_name (table, "people-panel-me-table"); mx_table_insert_actor_with_properties (MX_TABLE (left_side), CLUTTER_ACTOR (table), 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, NULL); bin = mx_frame_new (); clutter_actor_set_name (bin, "people-panel-me-avatar-frame"); clutter_actor_set_size (bin, 84, 85); priv->avatar = anerley_tp_user_avatar_new (); clutter_actor_set_size (priv->avatar, 64, 64); mx_bin_set_child (MX_BIN (bin), priv->avatar); mx_table_insert_actor_with_properties (MX_TABLE (table), bin, 0, 0, "row-span", 3, "x-expand", FALSE, "y-expand", FALSE, "x-fill", FALSE, "y-fill", FALSE, NULL); label = mx_label_new_with_text (_("Me")); clutter_actor_set_name (label, "people-panel-me-label"); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 1, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); priv->presence_message = mx_label_new (); clutter_actor_set_name (label, "people-panel-me-presence-message"); mx_table_insert_actor_with_properties (MX_TABLE (table), priv->presence_message, 1, 1, "x-expand", FALSE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, NULL); priv->presence_chooser = anerley_presence_chooser_new (); clutter_actor_set_height (priv->presence_chooser, 40); mx_table_insert_actor_with_properties (MX_TABLE (table), priv->presence_chooser, 2, 1, "x-expand", FALSE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_END, NULL); label = mx_label_new_with_text (_("You are chatting with:")); mx_stylable_set_style_class (MX_STYLABLE (label), "sectionHeader"); mx_table_insert_actor_with_properties (MX_TABLE (left_side), label, 1, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, NULL); scroll_view = mx_scroll_view_new (); mx_table_insert_actor_with_properties (MX_TABLE (left_side), scroll_view, 2, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); active_feed = anerley_tp_monitor_feed_new (priv->aggregator, "DawatiPanelPeople"); priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed); priv->active_list_view = anerley_compact_tile_view_new (priv->active_model); clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view), priv->active_list_view); /* Populate right side */ table = mx_table_new (); clutter_actor_set_name (table, "people-panel-actions-box"); mx_table_set_column_spacing (MX_TABLE (table), 10); mx_table_insert_actor_with_properties (MX_TABLE (right_side), CLUTTER_ACTOR (table), 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, NULL); create_sort_by_chooser (self); clutter_actor_set_size (priv->sort_by_chooser, 160, 40); mx_table_insert_actor_with_properties (MX_TABLE (table), priv->sort_by_chooser, 0, 0, "x-expand", FALSE, "y-expand", FALSE, "x-fill", FALSE, "y-fill", TRUE, NULL); create_new_chooser (self); clutter_actor_set_size (priv->new_chooser, 126, 40); mx_table_insert_actor_with_properties (MX_TABLE (table), priv->new_chooser, 0, 1, "x-expand", FALSE, "y-expand", FALSE, "x-fill", FALSE, "y-fill", TRUE, NULL); create_search_entry (self); //clutter_actor_set_height (priv->search_entry, 30); mx_stylable_set_style_class (MX_STYLABLE (priv->search_entry), "searchBox"); mx_table_insert_actor_with_properties (MX_TABLE (table), priv->search_entry, 0, 2, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, NULL); priv->content_table = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->content_table), "contentPanel"); mx_table_insert_actor_with_properties (MX_TABLE (right_side), priv->content_table, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); priv->tp_feed = ANERLEY_FEED (anerley_tp_feed_new (priv->aggregator)); priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed); priv->tile_view = anerley_tile_view_new (priv->model); priv->main_scroll_view = mx_scroll_view_new (); clutter_container_add_actor (CLUTTER_CONTAINER (priv->main_scroll_view), priv->tile_view); mx_table_insert_actor (MX_TABLE (priv->content_table), priv->main_scroll_view, 0, 0); /* No people && no accounts enabled */ priv->no_people_tile = _make_empty_people_tile (self); clutter_actor_hide (priv->no_people_tile); mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table), priv->no_people_tile, 1, 0, "x-fill", TRUE, "x-expand", TRUE, "y-expand", TRUE, "y-fill", TRUE, NULL); /* No people && acounts are online */ priv->everybody_offline_tile = _make_everybody_offline_tile (self); clutter_actor_hide (priv->everybody_offline_tile); mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table), priv->everybody_offline_tile, 2, 0, "x-fill", TRUE, "x-expand", TRUE, "y-expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_START, "row-span", 1, NULL); priv->offline_banner = _make_offline_banner (self, clutter_actor_get_width (priv->main_scroll_view)); clutter_actor_hide (priv->offline_banner); mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table), priv->offline_banner, 3, 0, "x-fill", TRUE, "x-expand", TRUE, "y-expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_START, "row-span", 1, NULL); g_signal_connect (priv->tile_view, "item-activated", (GCallback)_tile_view_item_activated_cb, self); g_signal_connect (priv->active_list_view, "item-activated", (GCallback)_tile_view_item_activated_cb, self); g_signal_connect (priv->model, "bulk-change-end", (GCallback)_model_bulk_changed_end_cb, self); g_signal_connect (priv->active_model, "bulk-change-end", (GCallback)_active_model_bulk_change_end_cb, self); clutter_actor_hide ((ClutterActor *)priv->main_scroll_view); /* Placeholder changes based on onlineness or not */ _update_placeholder_state (self); sw_online_add_notify (_online_notify_cb, self); _update_online_state (self, sw_is_online ()); tp_proxy_prepare_async (priv->am, NULL, am_prepared_cb, self); }
static ClutterActor * create_track_info (RBShell *shell) { RBShellPlayer *player; RhythmDB *db; ClutterActor *box; ClutterActor *box2; ClutterActor *widget; ClutterActor *frame; RhythmDBEntry *entry; GValue *value; guint elapsed; g_object_get (shell, "shell-player", &player, "db", &db, NULL); entry = rb_shell_player_get_playing_entry (player); box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL); mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 16); mx_stylable_set_style_class (MX_STYLABLE (box), "TrackInfoBox"); mx_stylable_set_style (MX_STYLABLE (box), style); /* XXX rtl? */ /* image container */ frame = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (frame), "TrackInfoImage"); mx_stylable_set_style (MX_STYLABLE (frame), style); mx_box_layout_add_actor (MX_BOX_LAYOUT (box), frame, 0); clutter_container_child_set (CLUTTER_CONTAINER (box), frame, "expand", FALSE, NULL); set_blank_image (MX_FRAME (frame)); clutter_actor_show_all (CLUTTER_ACTOR (frame)); g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (cover_art_entry_changed_cb), frame, 0); request_cover_art (MX_FRAME (frame), entry); box2 = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box2), MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing (MX_BOX_LAYOUT (box2), 16); mx_stylable_set_style (MX_STYLABLE (box2), style); mx_box_layout_add_actor (MX_BOX_LAYOUT (box), box2, 1); clutter_container_child_set (CLUTTER_CONTAINER (box), box2, "expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, NULL); /* track info */ widget = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackInfoText"); mx_stylable_set_style (MX_STYLABLE (widget), style); mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 1); clutter_container_child_set (CLUTTER_CONTAINER (box2), widget, "expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (playing_song_changed_cb), widget, 0); g_signal_connect_object (db, "entry-changed", G_CALLBACK (entry_changed_cb), widget, 0); g_signal_connect_object (db, "entry-extra-metadata-notify::" RHYTHMDB_PROP_STREAM_SONG_TITLE, G_CALLBACK (streaming_title_notify_cb), widget, 0); value = rhythmdb_entry_request_extra_metadata (db, entry, RHYTHMDB_PROP_STREAM_SONG_TITLE); if (value != NULL) { update_track_info (MX_LABEL (widget), db, entry, g_value_get_string (value)); g_value_unset (value); g_free (value); } else { update_track_info (MX_LABEL (widget), db, entry, NULL); } /* elapsed/duration */ widget = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackTimeText"); mx_stylable_set_style (MX_STYLABLE (widget), style); mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 2); clutter_container_child_set (CLUTTER_CONTAINER (box2), widget, "expand", FALSE, "x-fill", TRUE, "y-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect_object (player, "elapsed-changed", G_CALLBACK (elapsed_changed_cb), widget, 0); if (rb_shell_player_get_playing_time (player, &elapsed, NULL)) { update_elapsed (widget, player, elapsed); } rhythmdb_entry_unref (entry); g_object_unref (player); g_object_unref (db); return box; }
static void penge_event_tile_init (PengeEventTile *self) { PengeEventTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *indicator_container, *indicator_overlay; GError *error = NULL; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), (ClutterActor *)priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); indicator_container = mx_stack_new (); clutter_actor_set_size (indicator_container, 20, 20); priv->calendar_indicator = clutter_cairo_texture_new (20, 20); clutter_actor_set_size (priv->calendar_indicator, 20, 20); indicator_overlay = clutter_texture_new_from_file (CALENDAR_INDICATOR_OVERLAY_MASK, &error); if (error != NULL) { g_critical (G_STRLOC ": Loading calendar colour overlay failed: %s", error->message); g_clear_error (&error); indicator_overlay = NULL; } else { clutter_actor_set_size (indicator_overlay, 20, 20); } clutter_container_add (CLUTTER_CONTAINER (indicator_container), priv->calendar_indicator, indicator_overlay, NULL); priv->time_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->time_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); mx_stylable_set_style_class (MX_STYLABLE (priv->time_label), "PengeEventTimeLabel"); priv->summary_label = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->summary_label), "PengeEventSummary"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->summary_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); /* Populate the table */ mx_table_add_actor (MX_TABLE (priv->inner_table), indicator_container, 0, 0); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->time_label, 0, 1); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->summary_label, 0, 2); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), indicator_container, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->time_label, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->summary_label, "x-expand", TRUE, "x-fill", TRUE, "y-expand", FALSE, "y-fill", FALSE, NULL); /* Setup spacing and padding */ mx_table_set_column_spacing (MX_TABLE (priv->inner_table), 6); g_signal_connect (self, "clicked", (GCallback)_button_clicked_cb, self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); }
static void penge_count_tile_init (PengeCountTile *self) { ClutterActor *tmp_text; PengeCountTilePrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->table = mx_table_new (); g_object_ref (priv->table); priv->count_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->count_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); g_object_set (G_OBJECT (priv->count_label), "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_MIDDLE, NULL); penge_count_tile_set_count (self, 0); clutter_actor_show (priv->count_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->count_label, 0, 0, "row-span", 2, "x-expand", FALSE, NULL); priv->message_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->message_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->message_label), "PengeCountMessageLabel"); clutter_actor_show (priv->message_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->message_label, 0, 1, "x-expand", TRUE, NULL); priv->account_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->account_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->account_label), "PengeCountAccountLabel"); clutter_actor_show (priv->account_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->account_label, 1, 1, "x-expand", TRUE, NULL); mx_table_set_column_spacing (MX_TABLE (priv->table), 12); clutter_actor_show (priv->table); clutter_actor_add_child ((self), priv->table); //mx_bin_set_fill ((self), TRUE, FALSE); }
static void add_pictures (ClutterActor *box) { GList *files = get_pictures (); while (files) { gint w, h, i; ClutterActor *drawer, *drawer2, *tile, *texture, *menu, *description; gchar *file = files->data; /* Create texture */ texture = clutter_texture_new_from_file (file, NULL); clutter_texture_get_base_size (CLUTTER_TEXTURE (texture), &w, &h); clutter_actor_set_size (texture, 300, 300.0/w * h); /* Create menu */ menu = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (menu), MX_ORIENTATION_VERTICAL); for (i = 0; i < 4; i++) { ClutterActor *button, *layout, *icon, *label; button = mx_button_new (); layout = mx_box_layout_new (); icon = mx_icon_new (); label = mx_label_new (); mx_box_layout_set_spacing (MX_BOX_LAYOUT (layout), 8); mx_icon_set_icon_size (MX_ICON (icon), 16); clutter_actor_set_size (icon, 16, 16); clutter_container_add (CLUTTER_CONTAINER (layout), icon, label, NULL); mx_bin_set_child (MX_BIN (button), layout); mx_bin_set_alignment (MX_BIN (button), MX_ALIGN_START, MX_ALIGN_MIDDLE); clutter_container_add_actor (CLUTTER_CONTAINER (menu), button); mx_box_layout_child_set_x_fill (MX_BOX_LAYOUT (menu), button, TRUE); switch (i) { case 0: mx_icon_set_icon_name (MX_ICON (icon), "dialog-information"); mx_label_set_text (MX_LABEL (label), "This"); break; case 1: mx_icon_set_icon_name (MX_ICON (icon), "dialog-question"); mx_label_set_text (MX_LABEL (label), "is"); break; case 2: mx_icon_set_icon_name (MX_ICON (icon), "dialog-warning"); mx_label_set_text (MX_LABEL (label), "a"); break; case 3: mx_icon_set_icon_name (MX_ICON (icon), "dialog-error"); mx_label_set_text (MX_LABEL (label), "menu"); break; } } /* Create description */ description = mx_label_new_with_text ("Here you could put a very " "long description of whatever " "is above it. Or you could put " "another focusable widget here " "and it'd be navigable, like " "the menu on the right. Whoo!"); clutter_text_set_line_wrap ((ClutterText *)mx_label_get_clutter_text ( MX_LABEL (description)), TRUE); drawer = mex_expander_box_new (); mex_expander_box_set_important_on_focus (MEX_EXPANDER_BOX (drawer), TRUE); drawer2 = mex_expander_box_new (); mex_expander_box_set_grow_direction (MEX_EXPANDER_BOX (drawer2), MEX_EXPANDER_BOX_RIGHT); mex_expander_box_set_important (MEX_EXPANDER_BOX (drawer2), TRUE); tile = mex_tile_new_with_label (file); mex_tile_set_important (MEX_TILE (tile), TRUE); mx_bin_set_child (MX_BIN (tile), texture); clutter_container_add (CLUTTER_CONTAINER (drawer2), tile, menu, NULL); clutter_container_add (CLUTTER_CONTAINER (drawer), drawer2, description, NULL); g_signal_connect (drawer, "notify::open", G_CALLBACK (sync_drawer2_cb), drawer2); clutter_container_add_actor (CLUTTER_CONTAINER (box), drawer); clutter_actor_set_reactive (texture, TRUE); g_signal_connect (texture, "enter-event", G_CALLBACK (texture_enter_cb), drawer); g_signal_connect (texture, "leave-event", G_CALLBACK (texture_leave_cb), drawer); g_signal_connect (texture, "button-press-event", G_CALLBACK (texture_clicked_cb), drawer); g_free (file); files = g_list_delete_link (files, files); } }
static void mtp_bin_constructed (GObject *self) { MtpBinPrivate *priv = MTP_BIN (self)->priv; MtpToolbar *toolbar = (MtpToolbar*) mtp_toolbar_new (); ClutterActor *box = (ClutterActor *)self; ClutterActor *jar = mtp_jar_new (); GConfClient *client; priv->toolbar = (ClutterActor*)toolbar; priv->jar = jar; clutter_actor_set_name (jar, "jar"); clutter_actor_set_height ((ClutterActor*)toolbar, TOOLBAR_HEIGHT); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 10); clutter_container_add (CLUTTER_CONTAINER (box), (ClutterActor*)toolbar, NULL); { ClutterActor *dummy = mx_label_new (); ClutterActor *hbox = mx_box_layout_new (); ClutterActor *button = mx_button_new_with_label (_("Save toolbar")); clutter_actor_set_name (hbox, "message-box"); clutter_actor_set_name (button, "save-button"); priv->err_msg = _("Sorry, you'll have to remove a panel before you can " "add a new one."); priv->normal_msg = _("You can add, remove, and reorder many of the panels " "in your toolbar."); priv->message = mx_label_new_with_text (priv->normal_msg); clutter_actor_set_name (priv->message, "error-message"); clutter_container_add (CLUTTER_CONTAINER (box), hbox, NULL); clutter_container_add (CLUTTER_CONTAINER (hbox), priv->message, dummy, button, NULL); clutter_container_child_set (CLUTTER_CONTAINER (hbox), dummy, "expand", TRUE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (hbox), button, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (hbox), priv->message, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect (button, "clicked", G_CALLBACK (mtp_bin_save_button_clicked_cb), self); g_signal_connect (toolbar, "notify::free-space", G_CALLBACK (mtp_bin_toolbar_free_space_cb), self); } clutter_container_add (CLUTTER_CONTAINER (box), jar, NULL); clutter_container_child_set (CLUTTER_CONTAINER (box), jar, "expand", TRUE, NULL); client = priv->client = gconf_client_get_default (); gconf_client_add_dir (client, KEY_DIR, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); }
static ClutterActor * mex_menu_item_new (MexMenu *self, MxAction *action, MexMenuActionType type) { ClutterActor *button, *layout, *icon, *vbox, *label, *arrow = NULL; button = mx_button_new (); mx_button_set_is_toggle (MX_BUTTON (button), TRUE); mx_stylable_set_style_class (MX_STYLABLE (button), "Item"); layout = mx_box_layout_new (); mx_bin_set_child (MX_BIN (button), layout); mx_bin_set_fill (MX_BIN (button), TRUE, FALSE); if (type == MEX_MENU_LEFT) { arrow = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (arrow), "Left"); clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow); } vbox = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL); label = mx_label_new (); mx_label_set_fade_out (MX_LABEL (label), TRUE); mx_stylable_set_style_class (MX_STYLABLE (label), "Action"); g_object_bind_property (action, "display-name", label, "text", G_BINDING_SYNC_CREATE); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label); label = mx_label_new (); mx_label_set_fade_out (MX_LABEL (label), TRUE); mx_stylable_set_style_class (MX_STYLABLE (label), "Detail"); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label); clutter_actor_hide (label); g_object_set_data (G_OBJECT (button), "detail-label", label); clutter_container_add_actor (CLUTTER_CONTAINER (layout), vbox); clutter_container_child_set (CLUTTER_CONTAINER (layout), vbox, "expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, "y-fill", FALSE, NULL); icon = mx_icon_new (); g_object_bind_property (action, "icon", icon, "icon-name", G_BINDING_SYNC_CREATE); clutter_container_add_actor (CLUTTER_CONTAINER (layout), icon); if (type == MEX_MENU_RIGHT) { arrow = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (arrow), "Right"); clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow); } else if (type == MEX_MENU_TOGGLE) { ClutterActor *toggle = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (toggle), "Toggle"); clutter_container_add_actor (CLUTTER_CONTAINER (layout), toggle); g_object_set_data (G_OBJECT (button), "toggle-icon", toggle); } if (arrow) clutter_container_child_set (CLUTTER_CONTAINER (layout), arrow, "expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); g_signal_connect (button, "clicked", G_CALLBACK (mex_menu_item_clicked_cb), action); g_object_weak_ref (G_OBJECT (button), (GWeakNotify)mex_menu_item_destroyed_cb, self); /* Set the item qdata on the button to mark that we created it */ g_object_set_qdata (G_OBJECT (button), mex_menu_item_quark, GINT_TO_POINTER (TRUE)); return button; }
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 mex_grid_view_init (MexGridView *self) { MexGridViewPrivate *priv = self->priv = GRID_VIEW_PRIVATE (self); ClutterActor *scroll_view; priv->state = STATE_CLOSED; /* Create the menu */ priv->menu_layout = mex_menu_new (); mex_resizing_hbox_set_max_depth (MEX_RESIZING_HBOX (priv->menu_layout), 1); /* Add a title/icon */ priv->menu_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->menu_title), "Header"); clutter_actor_set_name (priv->menu_title, "menu-header"); priv->menu = (ClutterActor*) mex_menu_get_layout (MEX_MENU (priv->menu_layout)); clutter_actor_set_width (priv->menu, MENU_MIN_WIDTH); clutter_actor_insert_child_at_index (priv->menu, priv->menu_title, 0); /* Add the grid */ priv->grid_layout = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->grid_layout), MX_ORIENTATION_VERTICAL); /* header */ priv->grid_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->grid_title), "Header"); clutter_actor_add_child (priv->grid_layout, priv->grid_title); /* scroll view */ scroll_view = mex_scroll_view_new (); mx_kinetic_scroll_view_set_scroll_policy (MX_KINETIC_SCROLL_VIEW (scroll_view), MX_SCROLL_POLICY_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (scroll_view), "Grid"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->grid_layout), scroll_view, 1, "expand", TRUE, NULL); /* grid */ priv->grid = mex_grid_new (); mx_bin_set_child (MX_BIN (scroll_view), priv->grid); clutter_actor_set_opacity (priv->grid, 0); /* Name actors so we can style */ clutter_actor_set_name (CLUTTER_ACTOR (self), "grid-page"); clutter_actor_set_name (priv->grid_layout, "content"); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->menu_layout, CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->grid_layout, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* timeline for animations */ priv->timeline = clutter_timeline_new (ANIMATION_DURATION); priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_IN_OUT_CUBIC); g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (mex_grid_view_timeline_cb), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (mex_grid_view_timeline_complete_cb), self); }
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); }