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 art_cb (RBExtDBKey *key, const char *filename, GValue *data, MxFrame *frame) { ClutterActor *image; GdkPixbuf *pixbuf; if (data == NULL || G_VALUE_HOLDS (data, GDK_TYPE_PIXBUF) == FALSE) { return; } clutter_threads_enter (); image = gtk_clutter_texture_new (); pixbuf = GDK_PIXBUF (g_value_get_object (data)); gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (image), pixbuf, NULL); if (clutter_actor_get_height (image) > MAX_IMAGE_HEIGHT) { clutter_actor_set_height (image, MAX_IMAGE_HEIGHT); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (image), TRUE); } if (clutter_actor_get_width (image) > MAX_IMAGE_HEIGHT) { clutter_actor_set_width (image, MAX_IMAGE_HEIGHT); } mx_bin_set_child (MX_BIN (frame), image); clutter_actor_show_all (CLUTTER_ACTOR (frame)); clutter_threads_leave (); }
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 gboolean _create_power_dialog (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; ClutterActor *dialog, *dialog_label; MxAction *cancel_action, *shutdown_action; dialog = mx_dialog_new (); mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog"); dialog_label = mx_label_new_with_text (_("Close Media Explorer?")); mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader"); mx_bin_set_child (MX_BIN (dialog), dialog_label); shutdown_action = mx_action_new_full ("yes", _("Yes"), G_CALLBACK (_close_request_cb), self); cancel_action = mx_action_new_full ("no", _("No"), G_CALLBACK (_close_dialog_cb), self); mx_dialog_add_action (MX_DIALOG (dialog), shutdown_action); mx_dialog_add_action (MX_DIALOG (dialog), cancel_action); priv->power_dialog = g_object_ref (dialog); clutter_actor_show (dialog); return TRUE; }
static void mex_telepathy_channel_create_preview (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; ClutterActor *video_preview_area; priv->video_outgoing = clutter_texture_new (); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->video_outgoing), TRUE); priv->outgoing_sink = clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->video_outgoing)); video_preview_area = mx_stack_new (); clutter_container_add (CLUTTER_CONTAINER (video_preview_area), mex_telepathy_channel_create_static_image(), priv->video_outgoing, NULL); mx_stylable_set_style_class (MX_STYLABLE (video_preview_area), "PreviewStack"); clutter_actor_set_height (video_preview_area, 150.0); clutter_actor_add_effect (video_preview_area, CLUTTER_EFFECT ( mex_telepathy_channel_create_shadow ())); priv->preview_area = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->preview_area), "PreviewPadding"); mx_bin_set_child (MX_BIN (priv->preview_area), video_preview_area); }
static void mex_queue_button_init (MexQueueButton *self) { ClutterActor *temp_text; self->priv = QUEUE_BUTTON_PRIVATE (self); self->priv->inner_box = mx_box_layout_new (); self->priv->icon = mx_icon_new (); self->priv->label = mx_label_new_with_text ("Unknown queue state"); self->priv->spinner = mx_spinner_new (); self->priv->queue_model = mex_queue_model_dup_singleton (); g_signal_connect (self->priv->spinner, "looped", (GCallback)_spinner_looped_cb, self); clutter_container_add (CLUTTER_CONTAINER (self->priv->inner_box), self->priv->label, self->priv->icon, self->priv->spinner, NULL); clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box), self->priv->label, "expand", TRUE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box), self->priv->icon, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, "x-align", MX_ALIGN_END, NULL); clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box), self->priv->spinner, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, "x-align", MX_ALIGN_END, NULL); clutter_actor_hide (self->priv->spinner); mx_bin_set_child (MX_BIN (self), self->priv->inner_box); mx_bin_set_fill (MX_BIN (self), TRUE, FALSE); temp_text = mx_label_get_clutter_text (MX_LABEL (self->priv->label)); clutter_text_set_ellipsize (CLUTTER_TEXT (temp_text), PANGO_ELLIPSIZE_NONE); g_signal_connect (self, "notify::toggled", (GCallback)_queue_button_notify_toggled_cb, self); mx_button_set_is_toggle (MX_BUTTON (self), TRUE); }
static void mex_volume_control_init (MexVolumeControl *self) { MexVolumeControlPrivate *priv = self->priv = VOLUME_CONTROL_PRIVATE (self); gchar *new_style_class; MexPlayer *player; MexMusicPlayer *music; player = mex_player_get_default (); priv->media = mex_player_get_clutter_media (player); music = mex_music_player_get_default (); priv->music = mex_music_player_get_clutter_media (music); priv->volume = mx_button_new (); mx_widget_set_disabled (MX_WIDGET (priv->volume), TRUE); priv->vol_value = clutter_media_get_audio_volume (priv->media); /* The media sound can also be changed from another process changint the * stream audio with pulse audio, adjust the volume on those changes */ g_signal_connect (priv->media, "notify::audio-volume", G_CALLBACK (on_audio_volume_changed), self); g_signal_connect (priv->music, "notify::audio-volume", G_CALLBACK (on_audio_volume_changed), self); new_style_class = g_strdup_printf ("volume-%.0f", priv->vol_value * 10); mx_stylable_set_style_class (MX_STYLABLE (priv->volume), new_style_class); g_free (new_style_class); mx_bin_set_child (MX_BIN (self), priv->volume); }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *info_panel, *align; MxApplication *app; MxWindow *window; MexFeed *feed; MexProgram *program; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-info-panel-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *) mx_window_get_clutter_stage (window); clutter_stage_set_color ((ClutterStage *) stage, &grey); align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); mx_window_set_child (window, align); info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_FULL); mx_bin_set_child (MX_BIN (align), info_panel); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 1024, 768); feed = mex_feed_new ("source", "title"); program = mex_program_new (feed); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_MIMETYPE, "video/mp4"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_TITLE, "The cats on the moon"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_SYNOPSIS, "An original title where cats are sent to the moon to catch all the mice which are naturally attracted there due to the large consistency of cheese, this results in a space race between NASA and CATSA, leading to war on the moon over territory claimed by cats"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_STILL, "http://farm5.static.flickr.com/4013/4305303148_5cbc986a44_m.jpg"); mex_content_view_set_content (MEX_CONTENT_VIEW (info_panel), MEX_CONTENT (program)); clutter_actor_show (stage); clutter_main (); return 0; }
static void mx_bin_remove (ClutterContainer *container, ClutterActor *actor) { MxBinPrivate *priv = MX_BIN (container)->priv; if (priv->child == actor) mx_bin_set_child (MX_BIN (container), NULL); }
static void cheese_widget_init (CheeseWidget *widget) { CheeseWidgetPrivate *priv = CHEESE_WIDGET_GET_PRIVATE (widget); GtkWidget *box; ClutterActor *stage, *frame; ClutterConstraint *constraint; ClutterColor black = { 0x00, 0x00, 0x00, 0xff }; priv->state = CHEESE_WIDGET_STATE_NONE; priv->error = NULL; /* XXX * remove this line if you want to debug */ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE); /* Spinner page */ priv->spinner = gtk_spinner_new (); box = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (box), priv->spinner); cheese_widget_spinner_invert (priv->spinner, box); gtk_widget_show_all (box); gtk_notebook_append_page (GTK_NOTEBOOK (widget), box, gtk_label_new ("spinner")); /* Webcam page */ priv->screen = gtk_clutter_embed_new (); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->screen)); clutter_stage_set_color (CLUTTER_STAGE (stage), &black); frame = cheese_aspect_frame_new (); priv->texture = clutter_texture_new (); clutter_actor_set_size (priv->texture, 400, 300); mx_bin_set_child (MX_BIN (frame), priv->texture); clutter_container_add_actor (CLUTTER_CONTAINER (stage), frame); constraint = clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0); clutter_actor_add_constraint_with_name (frame, "size", constraint); gtk_widget_show (priv->screen); clutter_actor_show (priv->texture); gtk_notebook_append_page (GTK_NOTEBOOK (widget), priv->screen, gtk_label_new ("webcam")); /* Problem page */ priv->problem = gtk_drawing_area_new (); gtk_widget_show (priv->problem); gtk_notebook_append_page (GTK_NOTEBOOK (widget), priv->problem, gtk_label_new ("got problems")); priv->settings = g_settings_new ("org.gnome.Cheese"); }
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); }
/* use a 'missing image' image instead? */ static void set_blank_image (MxFrame *frame) { ClutterActor *blank; ClutterColor nothing = { 0, 0, 0, 0 }; blank = clutter_rectangle_new_with_color (¬hing); clutter_actor_set_height (blank, MAX_IMAGE_HEIGHT); clutter_actor_set_width (blank, MAX_IMAGE_HEIGHT); mx_bin_set_child (MX_BIN (frame), blank); }
static ClutterActor * _make_messenger_launcher_tile (MnbPeoplePanel *panel) { ClutterActor *table; ClutterActor *icon_tex; ClutterActor *button; GAppInfo *app_info; gchar *button_str; ClutterActor *bin; bin = mx_frame_new (); clutter_actor_set_name (bin, "people-panel-messenger-launcher-tile"); table = mx_table_new (); mx_bin_set_child (MX_BIN (bin), table); mx_table_set_column_spacing (MX_TABLE (table), 16); app_info = (GAppInfo *)g_desktop_app_info_new ("empathy.desktop"); icon_tex = g_object_new (MX_TYPE_ICON, "icon-name", "netbook-empathy", NULL); mx_table_add_actor_with_properties (MX_TABLE (table), icon_tex, 0, 0, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); button_str = g_strdup_printf (_("Open %s"), g_app_info_get_name (app_info)); button = mx_button_new_with_label (button_str); g_free (button_str); g_signal_connect (button, "clicked", (GCallback)_messenger_launcher_button_clicked_cb, panel); mx_table_add_actor_with_properties (MX_TABLE (table), button, 0, 1, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); g_object_unref (app_info); return bin; }
static void create_header (MexEpgGrid *grid) { MexEpgGridPrivate *priv = grid->priv; GTimeSpan diff; GDateTime *time_, *old_time; gint n_headers, i; gchar *time_str; diff = g_date_time_difference (priv->last_date, priv->first_date); n_headers = (diff * 1e-6 / 60. / 30) + 1; /* number of 30mins slices */ if (MEX_DEBUG_ENABLED (EPG)) { gchar *first_str, *last_str; first_str = mex_date_to_string (priv->first_date); last_str = mex_date_to_string (priv->last_date); MEX_NOTE (EPG, "Creating header between %s and %s (%d columns)", first_str, last_str, n_headers); g_free (first_str); g_free (last_str); } g_ptr_array_set_size (priv->header, n_headers); time_ = g_date_time_ref (priv->first_date); for (i = 0; i < n_headers; i++) { ClutterActor *frame, *label; /* a Frame for 30 mins, each frame has a label in it */ frame = mx_frame_new (); clutter_actor_set_parent (frame, CLUTTER_ACTOR (grid)); mx_stylable_set_style_class (MX_STYLABLE (frame), "EpgHeader"); clutter_actor_set_size (frame, 6 * priv->pixels_for_5_mins, HEADER_HEIGHT); time_str = g_date_time_format (time_, "%H:%M"); label = mx_label_new_with_text (time_str); mx_bin_set_child (MX_BIN (frame), label); mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE); g_ptr_array_index (priv->header, i) = frame; g_free (time_str); old_time = time_; time_ = g_date_time_add_minutes (time_, 30); g_date_time_unref (old_time); } g_date_time_unref (time_); }
static void penge_app_tile_init (PengeAppTile *self) { PengeAppTilePrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->tex = clutter_texture_new (); clutter_actor_set_size (priv->tex, ICON_SIZE, ICON_SIZE); mx_bin_set_child (MX_BIN (self), priv->tex); g_signal_connect (self, "clicked", (GCallback)_button_clicked_cb, self); }
static void mx_button_init (MxButton *button) { MxButtonPrivate *priv; priv = button->priv = MX_BUTTON_GET_PRIVATE (button); clutter_actor_set_reactive ((ClutterActor *) button, TRUE); g_signal_connect (button, "style-changed", G_CALLBACK (mx_button_style_changed), NULL); priv->icon_visible = TRUE; priv->label_visible = TRUE; priv->icon_position = MX_POSITION_LEFT; /* take an extra reference to the hbox */ priv->hbox = g_object_ref (mx_box_layout_new ()); mx_bin_set_child (MX_BIN (button), priv->hbox); priv->icon = mx_icon_new (); priv->label = g_object_new (CLUTTER_TYPE_TEXT, "line-alignment", PANGO_ALIGN_CENTER, "ellipsize", PANGO_ELLIPSIZE_END, NULL); clutter_actor_add_child (priv->hbox, priv->icon); clutter_actor_add_child (priv->hbox, priv->label); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->hbox), priv->label, TRUE); mx_box_layout_child_set_y_fill (MX_BOX_LAYOUT (priv->hbox), priv->label, FALSE); mx_box_layout_child_set_x_fill (MX_BOX_LAYOUT (priv->hbox), priv->label, FALSE); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->hbox), priv->icon, TRUE); mx_box_layout_child_set_y_fill (MX_BOX_LAYOUT (priv->hbox), priv->icon, FALSE); mx_box_layout_child_set_x_fill (MX_BOX_LAYOUT (priv->hbox), priv->icon, FALSE); mx_button_update_contents (button); }
static void mex_content_tile_init (MexContentTile *self) { MexContentTilePrivate *priv; self->priv = priv = CONTENT_TILE_PRIVATE (self); priv->thumb_width = -1; priv->thumb_height = -1; priv->image = mx_image_new (); mx_image_set_load_async (MX_IMAGE (priv->image), TRUE); mx_image_set_scale_width_threshold (MX_IMAGE (priv->image), 128); mx_image_set_scale_height_threshold (MX_IMAGE (priv->image), 128); mx_image_set_scale_mode (MX_IMAGE (priv->image), MX_IMAGE_SCALE_CROP); mx_bin_set_child (MX_BIN (self), priv->image); }
static ClutterActor * _make_offline_banner (MnbPeoplePanel *pane, gint width) { ClutterActor *tile; ClutterActor *tmp_text; ClutterActor *label, *bin; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_width (tile, width); clutter_actor_set_name (tile, "people-pane-you-offline-banner"); label = mx_label_new_with_text (_("To see your IM contacts, " "you need to go online.")); clutter_actor_set_name (label, "people-pane-you-offline-label"); tmp_text = mx_label_get_clutter_text (MX_LABEL (label)); clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text), PANGO_WRAP_WORD_CHAR); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); bin = mx_frame_new (); mx_bin_set_child (MX_BIN (bin), (label)); mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE); mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE); clutter_actor_set_name (bin, "people-pane-you-offline-bin"); mx_table_insert_actor_with_properties (MX_TABLE (tile), (ClutterActor *)bin, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); return tile; }
static ClutterActor * create_button (const char *button_style, const char *icon_style, const char *icon_name) { ClutterActor *widget; ClutterActor *icon; icon = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), icon_style); mx_stylable_set_style (MX_STYLABLE (icon), style); mx_icon_set_icon_name (MX_ICON (icon), icon_name); mx_icon_set_icon_size (MX_ICON (icon), 64); widget = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (widget), button_style); mx_stylable_set_style (MX_STYLABLE (widget), style); mx_bin_set_child (MX_BIN (widget), icon); return widget; }
static void mx_bin_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { MxBin *bin = MX_BIN (gobject); switch (prop_id) { case PROP_CHILD: mx_bin_set_child (bin, g_value_get_object (value)); break; case PROP_X_ALIGN: mx_bin_set_alignment (bin, g_value_get_enum (value), bin->priv->y_align); break; case PROP_Y_ALIGN: mx_bin_set_alignment (bin, bin->priv->x_align, g_value_get_enum (value)); break; case PROP_X_FILL: mx_bin_set_fill (bin, g_value_get_boolean (value), bin->priv->y_fill); break; case PROP_Y_FILL: mx_bin_set_fill (bin, bin->priv->x_fill, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); } }
static ClutterActor * _make_everybody_offline_tile (MnbPeoplePanel *pane) { ClutterActor *tile; ClutterActor *label, *bin; ClutterActor *tmp_text; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_name ((ClutterActor *)tile, "people-pane-everybody-offline-tile"); label = mx_label_new_with_text (_("Sorry, we can't find any people. " \ "It looks like they are all offline.")); clutter_actor_set_name ((ClutterActor *)label, "people-pane-everybody-offline-label"); tmp_text = mx_label_get_clutter_text (MX_LABEL (label)); clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text), PANGO_WRAP_WORD_CHAR); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); bin = mx_frame_new (); mx_bin_set_child (MX_BIN (bin), label); mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE); mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE); clutter_actor_set_name (bin, "people-pane-everybody-offline-bin"); mx_table_insert_actor_with_properties (MX_TABLE (tile), (ClutterActor *)bin, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); return tile; }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *controls, *align; MxApplication *app; MxWindow *window; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-media-controls-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *) mx_window_get_clutter_stage (window); clutter_stage_set_color ((ClutterStage *) stage, &grey); align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); mx_window_set_child (window, align); controls = mex_media_controls_new (); mx_bin_set_child (MX_BIN (align), controls); g_signal_connect_swapped (controls, "stopped", G_CALLBACK (printf), "Stopped signal received\n"); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 1024, 768); clutter_actor_show (stage); clutter_main (); return 0; }
static void create_network_row (MpdComputerTile *tile, const gchar *label_text, gint row) { MpdComputerTilePrivate *priv = tile->priv; ClutterActor *label, *toggle, *frame; label = mx_label_new_with_text (label_text); mx_table_add_actor_with_properties (MX_TABLE (tile), label, row, 0, "x-expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); frame = mx_frame_new (); toggle = mx_toggle_new (); mx_bin_set_child (MX_BIN (frame), toggle); mx_table_add_actor_with_properties (MX_TABLE (tile), frame, row, 1, "x-expand", FALSE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); priv->toggled_data[row].tile = tile; priv->toggled_data[row].row = row; g_signal_connect (toggle, "notify::active", G_CALLBACK (on_switch_toggled), &priv->toggled_data[row]); priv->rows[row].label = label; priv->rows[row].frame = frame; priv->rows[row].toggle = toggle; }
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); }
int main (int argc, char **argv) { const ClutterColor red = { 0xff, 0x00, 0x00, 0xff }; ClutterActor *stage, *box, *tile, *rectangle; clutter_init (&argc, &argv); mex_style_load_default (); stage = clutter_stage_get_default (); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); tile = mex_tile_new_with_label ("Red rectangle"); mex_tile_set_important (MEX_TILE (tile), TRUE); rectangle = clutter_rectangle_new_with_color (&red); clutter_actor_set_size (rectangle, 300, 300); mx_bin_set_child (MX_BIN (tile), rectangle); box = mex_expander_box_new (); clutter_container_add (CLUTTER_CONTAINER (box), tile, clutter_text_new_with_text ("Sans 16", "Hello"), NULL); clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); clutter_actor_set_reactive (rectangle, TRUE); g_signal_connect_swapped (rectangle, "enter-event", G_CALLBACK (toggle_important), box); clutter_actor_show (stage); clutter_main (); return 0; }
void mpl_application_view_set_thumbnail (MplApplicationView *view, ClutterActor *thumbnail) { MplApplicationViewPrivate *priv; g_return_if_fail (MPL_IS_APPLICATION_VIEW (view)); priv = view->priv; if (priv->thumbnail) { clutter_actor_unparent (priv->thumbnail); priv->thumbnail = NULL; clutter_actor_hide (priv->shadow); } if (thumbnail) { priv->thumbnail = thumbnail; mx_bin_set_child (MX_BIN (priv->shadow), thumbnail); clutter_actor_show_all (priv->shadow); } }
static void mx_button_update_contents (MxButton *self) { MxButtonPrivate *priv = self->priv; ClutterActor *child; gboolean icon_visible, label_visible; const gchar *text; /* If the icon doesn't have a name set, treat it as * not-visible. */ if (priv->icon_visible && mx_icon_get_icon_name (MX_ICON (priv->icon))) icon_visible = TRUE; else icon_visible = FALSE; text = clutter_text_get_text (CLUTTER_TEXT (priv->label)); if (priv->label_visible && text && (strcmp (text, "") != 0)) label_visible = TRUE; else label_visible = FALSE; /* replace any custom content */ child = mx_bin_get_child (MX_BIN (self)); if (child != priv->hbox) mx_bin_set_child (MX_BIN (self), priv->hbox); /* Handle the simple cases first */ if (!icon_visible && !label_visible) { clutter_actor_hide (priv->hbox); return; } /* ensure the hbox is visible */ clutter_actor_show (priv->hbox); if (icon_visible && !label_visible) { clutter_actor_show (priv->icon); clutter_actor_hide (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); return; } if (!icon_visible && label_visible) { clutter_actor_hide (priv->icon); clutter_actor_show (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->label, NULL); return; } /* Both the icon and text are visible, handle this case */ clutter_actor_show (priv->icon); clutter_actor_show (priv->label); switch (priv->icon_position) { case MX_POSITION_TOP: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); break; case MX_POSITION_RIGHT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); break; case MX_POSITION_BOTTOM: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); mx_box_layout_child_set_x_align (MX_BOX_LAYOUT (priv->hbox), priv->label, MX_ALIGN_MIDDLE); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); break; case MX_POSITION_LEFT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); break; } }
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 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 mx_bin_add (ClutterContainer *container, ClutterActor *actor) { mx_bin_set_child (MX_BIN (container), actor); }