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 mx_expander_init (MxExpander *self) { MxExpanderPrivate *priv = self->priv = GET_PRIVATE (self); priv->label = clutter_text_new (); clutter_actor_add_child ((ClutterActor *) self, priv->label); priv->arrow = (ClutterActor *) mx_icon_new (); clutter_actor_add_child ((ClutterActor*) self, priv->arrow); clutter_actor_set_name (priv->arrow, "mx-expander-arrow-closed"); /* TODO: make this a style property */ priv->spacing = 10.0f; priv->timeline = clutter_timeline_new (250); clutter_timeline_set_progress_mode (priv->timeline, CLUTTER_EASE_IN_SINE); g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (new_frame), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (timeline_complete), self); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); g_signal_connect (self, "style-changed", G_CALLBACK (mx_expander_style_changed), NULL); g_signal_connect (self, "actor-added", G_CALLBACK (mx_expander_actor_added), NULL); g_signal_connect (self, "actor-removed", G_CALLBACK (mx_expander_actor_removed), NULL); }
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 ClutterActor * _make_notification_actor (MexNotification *notification) { ClutterActor *box; ClutterActor *label, *icon; box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL); if (notification->icon) { icon = mx_icon_new (); clutter_actor_set_size (icon, 26, 26); mx_icon_set_icon_name (MX_ICON (icon), notification->icon); clutter_container_add_actor (CLUTTER_CONTAINER (box), icon); mx_box_layout_child_set_y_align (MX_BOX_LAYOUT (box), icon, MX_ALIGN_MIDDLE); } label = mx_label_new_with_text (notification->message); mx_label_set_y_align (MX_LABEL (label), MX_ALIGN_MIDDLE); clutter_container_add_actor (CLUTTER_CONTAINER (box), label); return box; }
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 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); }
/** * mx_combo_box_set_index: * @box: A #MxComboBox * @index: the index of the list item to set * * Set the current combo box text from the item at @index in the list. * */ void mx_combo_box_set_index (MxComboBox *box, gint index) { MxComboBoxPrivate *priv; GSList *item; MxAction *action; const gchar *icon_name; g_return_if_fail (MX_IS_COMBO_BOX (box)); priv = box->priv; item = g_slist_nth (box->priv->actions, index); if (!item) { box->priv->index = -1; clutter_text_set_text ((ClutterText*) box->priv->label, NULL); return; } box->priv->index = index; action = (MxAction *)item->data; clutter_text_set_text ((ClutterText*) box->priv->label, mx_action_get_display_name (action)); if (priv->icon) { clutter_actor_remove_child (CLUTTER_ACTOR (box), priv->icon); priv->icon = NULL; } icon_name = mx_action_get_icon (item->data); if (icon_name) { MxIconTheme *icon_theme; icon_theme = mx_icon_theme_get_default (); if (mx_icon_theme_has_icon (icon_theme, icon_name)) { priv->icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (priv->icon), icon_name); clutter_actor_add_child (CLUTTER_ACTOR (box), priv->icon); } } g_object_notify (G_OBJECT (box), "index"); g_object_notify (G_OBJECT (box), "active-text"); g_object_notify (G_OBJECT (box), "active-icon-name"); }
static void mex_content_box_init (MexContentBox *self) { MexContentBoxPrivate *priv = self->priv = CONTENT_BOX_PRIVATE (self); ClutterActor *icon; clutter_actor_push_internal (CLUTTER_ACTOR (self)); priv->info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_SIMPLE); clutter_actor_set_parent (priv->info_panel, CLUTTER_ACTOR (self)); /* monitor key press events */ g_signal_connect (self, "key-press-event", G_CALLBACK (mex_content_box_key_press_event_cb), NULL); /* Create tile */ icon = mx_icon_new (); priv->tile = mex_content_tile_new (); clutter_actor_set_parent (priv->tile, CLUTTER_ACTOR (self)); g_object_set (G_OBJECT (priv->tile), "thumb-width", DEFAULT_THUMB_WIDTH, "thumb-height", DEFAULT_THUMB_HEIGHT, NULL); mx_stylable_set_style_class (MX_STYLABLE (icon), "Info"); mex_tile_set_secondary_icon (MEX_TILE (priv->tile), icon); clutter_actor_set_reactive (priv->tile, TRUE); g_signal_connect (priv->tile, "button-release-event", G_CALLBACK (mex_content_box_tile_clicked_cb), self); /* Create the action list */ priv->action_list = mex_action_list_new (); clutter_actor_set_parent (priv->action_list, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); priv->timeline = clutter_timeline_new (200); priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_OUT_CUBIC); g_signal_connect_swapped (priv->timeline, "new-frame", G_CALLBACK (clutter_actor_queue_relayout), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (mex_content_box_timeline_completed), self); }
static void mex_content_box_notify_key_focus_cb (ClutterStage *stage, GParamSpec *pspec, MexContentBox *self) { MexContentBoxPrivate *priv = self->priv; ClutterActor *focus = clutter_stage_get_key_focus (stage); if (focus == priv->tile) { gboolean show_info; if (mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_SYNOPSIS) || mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_DATE) || mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_CREATION_DATE) || mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_DURATION)) show_info = TRUE; else { MexActionManager *manager = mex_action_manager_get_default (); GList *actions = mex_action_manager_get_actions_for_content (manager, priv->content); if (actions && actions->next) show_info = TRUE; else show_info = FALSE; g_list_free (actions); } if (show_info) { ClutterActor *icon = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "Info"); mex_tile_set_secondary_icon (MEX_TILE (priv->tile), icon); } } else mex_tile_set_secondary_icon (MEX_TILE (priv->tile), NULL); }
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 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 startup_cb (MxApplication *application) { MxWindow *window; ClutterActor *scroll, *child; gint i; window = mx_application_create_window (application, "Test Widgets"); /* Create scroll view */ scroll = mx_kinetic_scroll_view_new (); mx_kinetic_scroll_view_set_use_grab (MX_KINETIC_SCROLL_VIEW (scroll), TRUE); mx_kinetic_scroll_view_set_mouse_button (MX_KINETIC_SCROLL_VIEW (scroll), 3); clutter_actor_set_clip_to_allocation (scroll, TRUE); child = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); for (i = 0; i < 10000; i++) { ClutterActor *layout, *label, *icon; gchar *s = g_strdup_printf ("Row %d", i); layout = mx_box_layout_new_with_orientation (MX_ORIENTATION_HORIZONTAL); label = mx_label_new_with_text (s); clutter_actor_add_child (layout, label); g_free (s); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-left"); mx_icon_set_icon_size (MX_ICON (icon), 32); clutter_actor_add_child (layout, icon); clutter_actor_add_child (child, layout); } clutter_actor_add_child (scroll, child); mx_window_set_child (window, scroll); /* show the window */ mx_window_set_has_toolbar (window, FALSE); mx_window_show (window); }
/** * mx_combo_box_set_active_icon_name: * @box: A #MxComboBox * @icon_name: (allow-none): Icon name to use for displayed icon * * Set the icon displayed in the combo box. * */ void mx_combo_box_set_active_icon_name (MxComboBox *box, const gchar *icon_name) { MxComboBoxPrivate *priv; g_return_if_fail (MX_IS_COMBO_BOX (box)); priv = box->priv; if (!priv->icon) { if (icon_name) { MxIconTheme *icon_theme; icon_theme = mx_icon_theme_get_default (); if (mx_icon_theme_has_icon (icon_theme, icon_name)) { priv->icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (priv->icon), icon_name); clutter_actor_add_child (CLUTTER_ACTOR (box), priv->icon); } } } else { if (icon_name) mx_icon_set_icon_name (MX_ICON (priv->icon), icon_name); else { clutter_actor_destroy (priv->icon); priv->icon = NULL; clutter_actor_queue_relayout (CLUTTER_ACTOR (box)); } } priv->index = -1; g_object_notify (G_OBJECT (box), "index"); g_object_notify (G_OBJECT (box), "active-icon-name"); }
static void mex_search_plugin_init (MexSearchPlugin *self) { MexProxy *suggest_proxy; ClutterActor *icon, *header, *text, *frame, *box, *hbox; MexSearchPluginPrivate *priv = self->priv = SEARCH_PLUGIN_PRIVATE (self); /* Load style data */ mx_style_load_from_file (mx_style_get_default (), PLUGIN_DATA_DIR "/style.css", NULL); /* Create the history model and models list */ priv->history_model = mex_feed_new (_("Search"), _("Search")); priv->model_info = mex_model_info_new_with_sort_funcs (MEX_MODEL (priv->history_model), "search", 0); g_object_unref (priv->history_model); priv->models = g_list_append (NULL, priv->model_info); /* Create the actions list */ memset (&priv->action_info, 0, sizeof (MexActionInfo)); priv->action_info.action = mx_action_new_full ("x-mex/search", _("Search"), G_CALLBACK (mex_search_plugin_history_cb), self); priv->action_info.mime_types = (gchar **)search_mimetypes; priv->actions = g_list_append (NULL, &priv->action_info); /* Create the suggestions model */ priv->suggest_model = mex_feed_new (_("Suggestions"), _("Google Suggestions")); /* Create the search page */ /* Create header */ icon = mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "Search"); header = mx_box_layout_new (); mx_box_layout_set_spacing (MX_BOX_LAYOUT (header), 5); clutter_actor_set_name (header, "search-header"); /* Create search entry */ frame = mx_table_new (); clutter_actor_set_name (frame, "search-entry-frame"); priv->search_entry = mx_entry_new (); priv->spinner = mx_spinner_new (); mx_table_add_actor (MX_TABLE (frame), priv->search_entry, 0, 0); mx_table_add_actor (MX_TABLE (frame), priv->spinner, 0, 1); mx_table_child_set_x_fill (MX_TABLE (frame), priv->spinner, FALSE); mx_table_child_set_x_expand (MX_TABLE (frame), priv->spinner, FALSE); mx_table_child_set_y_fill (MX_TABLE (frame), priv->spinner, FALSE); mx_spinner_set_animating (MX_SPINNER (priv->spinner), FALSE); clutter_actor_hide (priv->spinner); clutter_container_add (CLUTTER_CONTAINER (header), icon, frame, NULL); clutter_container_child_set (CLUTTER_CONTAINER (header), icon, "x-fill", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (header), frame, "expand", TRUE, "x-fill", TRUE, NULL); text = mx_entry_get_clutter_text (MX_ENTRY (priv->search_entry)); g_signal_connect_swapped (text, "activate", G_CALLBACK (mex_search_plugin_search_cb), self); g_signal_connect (priv->search_entry, "notify::text", G_CALLBACK (mex_search_text_changed_cb), self); g_signal_connect (priv->search_entry, "notify::style-pseudo-class", G_CALLBACK (mex_search_text_style_changed), header); /* Create the suggestions column */ priv->suggest_column = mx_box_layout_new (); clutter_actor_set_name (priv->suggest_column, "suggest-column"); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->suggest_column), MX_ORIENTATION_VERTICAL); suggest_proxy = mex_generic_proxy_new (MEX_MODEL (priv->suggest_model), MX_TYPE_BUTTON); mex_generic_proxy_bind (MEX_GENERIC_PROXY (suggest_proxy), mex_enum_to_string (MEX_TYPE_CONTENT_METADATA, MEX_CONTENT_METADATA_TITLE), "label"); g_signal_connect (suggest_proxy, "object-created", G_CALLBACK (mex_search_proxy_add_cb), priv->suggest_column); g_signal_connect (suggest_proxy, "object-removed", G_CALLBACK (mex_search_proxy_remove_cb), priv->suggest_column); g_object_weak_ref (G_OBJECT (priv->suggest_column), (GWeakNotify)g_object_unref, suggest_proxy); /* Pack the search page */ priv->search_page = mx_frame_new (); clutter_actor_set_name (priv->search_page, "search-page"); mx_bin_set_fill (MX_BIN (priv->search_page), FALSE, TRUE); mx_bin_set_alignment (MX_BIN (priv->search_page), MX_ALIGN_START, MX_ALIGN_START); hbox = mex_resizing_hbox_new (); mex_resizing_hbox_set_resizing_enabled (MEX_RESIZING_HBOX (hbox), FALSE); box = mx_box_layout_new (); clutter_container_add_actor (CLUTTER_CONTAINER (priv->search_page), hbox); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), box); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL); clutter_container_add (CLUTTER_CONTAINER (box), header, priv->suggest_column, NULL); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (box), priv->suggest_column, TRUE); clutter_container_child_set (CLUTTER_CONTAINER (box), header, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); clutter_container_child_set (CLUTTER_CONTAINER (box), priv->suggest_column, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); clutter_actor_set_width (box, 426.0); /* Update the history list */ mex_search_plugin_update_history (self, NULL); /* Start the history list and suggestions proxy */ mex_proxy_start (suggest_proxy); }
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 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 penge_calendar_pane_init (PengeCalendarPane *self) { PengeCalendarPanePrivate *priv = GET_PRIVATE_REAL (self); JanaTime *now; JanaTime *on_the_next_hour; glong next_timeout_seconds; ClutterActor *label; ClutterActor *tasks_icon; ClutterActor *button; self->priv = priv; now = jana_ecal_utils_time_now_local (); /* Events header */ priv->events_header_table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->events_header_table), 8); mx_stylable_set_style_class (MX_STYLABLE (priv->events_header_table), "PengeEventsPaneHeader"); priv->calendar_tex = clutter_texture_new (); /* Need to fix the size to avoid being squashed */ clutter_actor_set_size (priv->calendar_tex, 27, 28); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), priv->calendar_tex, 0, 0, "x-expand", FALSE, "x-fill", FALSE, "y-expand", TRUE, "y-fill", FALSE, NULL); penge_calendar_pane_update_calendar_icon (self, now); label = mx_label_new_with_text (_("Appointments")); mx_stylable_set_style_class (MX_STYLABLE (label), "PengeEventsPaneTitle"); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), label, 0, 1, "y-expand", TRUE, "y-fill", FALSE, "x-expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); button = mx_button_new_with_label (_("Open")); g_signal_connect (button, "clicked", (GCallback)_events_open_button_clicked_cb, NULL); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), button, 0, 2, "y-expand", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-expand", FALSE, NULL); /* Tasks header */ priv->tasks_header_table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->tasks_header_table), 8); mx_stylable_set_style_class (MX_STYLABLE (priv->tasks_header_table), "PengeTasksPaneHeader"); tasks_icon = mx_icon_new (); clutter_actor_set_name (tasks_icon, "tasks-icon"); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), tasks_icon, 0, 0, "x-expand", FALSE, "x-fill", FALSE, "y-expand", TRUE, "y-fill", FALSE, NULL); label = mx_label_new_with_text (_("Tasks")); mx_stylable_set_style_class (MX_STYLABLE (label), "PengeTasksPaneTitle"); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), label, 0, 1, "y-expand", TRUE, "y-fill", FALSE, "x-expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); button = mx_button_new_with_label (_("Open")); g_signal_connect (button, "clicked", (GCallback)_tasks_open_button_clicked_cb, NULL); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), button, 0, 2, "y-expand", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-expand", FALSE, NULL); priv->events_pane = g_object_new (PENGE_TYPE_EVENTS_PANE, "time", now, NULL); priv->tasks_pane = g_object_new (PENGE_TYPE_TASKS_PANE, NULL); clutter_actor_set_parent (CLUTTER_ACTOR (priv->events_header_table), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->events_pane), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->tasks_header_table), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->tasks_pane), CLUTTER_ACTOR (self)); on_the_next_hour = jana_ecal_utils_time_now_local (); jana_time_set_minutes (on_the_next_hour, 0); jana_time_set_seconds (on_the_next_hour, 0); jana_utils_time_adjust (on_the_next_hour, 0, 0, 0, 1, 0, 0); jana_utils_time_diff (now, on_the_next_hour, NULL, NULL, NULL, NULL, NULL, &next_timeout_seconds); priv->refresh_timeout_id = g_timeout_add_seconds (next_timeout_seconds % (60 * 10), _first_refresh_timeout_cb, self); g_object_unref (now); g_object_unref (on_the_next_hour); }
static void construct_heading_and_top_area (MnpWorldClock *world_clock) { MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock); ClutterActor *box, *icon, *check_button, *text; GConfClient *client = gconf_client_get_default (); gboolean tfh; /* Time title */ box = mx_box_layout_new (); mx_stylable_set_style_class (MX_STYLABLE (box), "sectionHeader"); /* clutter_actor_set_name (box, */ /* "TimeTitleBox"); */ mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_HORIZONTAL); mx_box_layout_set_spacing ((MxBoxLayout *)box, 4); icon = (ClutterActor *)mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "ClockIcon"); clutter_actor_set_size (icon, 36, 36); mx_box_layout_add_actor (MX_BOX_LAYOUT(box), icon, -1); clutter_container_child_set (CLUTTER_CONTAINER (box), icon, "expand", FALSE, "x-fill", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-align", MX_ALIGN_START, NULL); text = mx_label_new_with_text (_("Time")); /* clutter_actor_set_name (text, "TimeTitle"); */ mx_box_layout_add_actor (MX_BOX_LAYOUT(box), text, -1); clutter_container_child_set (CLUTTER_CONTAINER (box), text, "expand", TRUE, "x-fill", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-align", MX_ALIGN_START, NULL); mx_box_layout_add_actor (MX_BOX_LAYOUT(world_clock), box, -1); clutter_container_child_set (CLUTTER_CONTAINER (world_clock), box, "expand", FALSE, "y-fill", FALSE, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); /* Check box */ box = mx_box_layout_new (); priv->widget_box = box; mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing ((MxBoxLayout *)box, 6); clutter_actor_set_name (box, "TwelveHourButtonBox"); box = mx_box_layout_new (); mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_HORIZONTAL); mx_box_layout_set_spacing ((MxBoxLayout *)box, 4); tfh = gconf_client_get_bool (client, "/apps/date-time-panel/24_h_clock", NULL); g_object_unref(client); check_button = mx_button_new (); priv->tfh_clock = check_button; mx_button_set_is_toggle (MX_BUTTON (check_button), TRUE); mx_button_set_toggled(MX_BUTTON (check_button), tfh); g_signal_connect(priv->tfh_clock, "clicked", G_CALLBACK(hour_clock_changed), world_clock); mx_stylable_set_style_class (MX_STYLABLE (check_button), "check-box"); clutter_actor_set_size ((ClutterActor *)check_button, 21, 21); mx_box_layout_add_actor (MX_BOX_LAYOUT(box), check_button, -1); clutter_container_child_set (CLUTTER_CONTAINER (box), check_button, "expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, NULL); text = mx_label_new_with_text (_("24 hour clock")); clutter_actor_set_name (text, "HourClockLabel"); mx_box_layout_add_actor (MX_BOX_LAYOUT(box), text, -1); clutter_container_child_set (CLUTTER_CONTAINER (box), text, "expand", TRUE, "y-fill", FALSE, "x-fill", TRUE, NULL); mx_box_layout_add_actor (MX_BOX_LAYOUT(priv->widget_box), box, -1); clutter_container_child_set (CLUTTER_CONTAINER (priv->widget_box), box, "expand", FALSE, "y-fill", FALSE, "x-fill", TRUE, NULL); mx_box_layout_add_actor (MX_BOX_LAYOUT(world_clock), priv->widget_box, -1); clutter_container_child_set (CLUTTER_CONTAINER (world_clock), box, "expand", FALSE, "y-fill", FALSE, "x-fill", TRUE, NULL); /* div = clutter_texture_new_from_file (SINGLE_DIV_LINE, NULL); mx_box_layout_add_actor (MX_BOX_LAYOUT(world_clock), div, -1); */ }
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 startup_cb (MxApplication *app) { MxWindow *window; ClutterActor *stage, *toggle, *label, *table, *button, *icon; window = mx_application_create_window (app, "Test Window"); stage = (ClutterActor *)mx_window_get_clutter_stage (window); mx_window_set_icon_name (window, "window-new"); clutter_actor_set_size (stage, 480, 320); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 8); mx_table_set_row_spacing (MX_TABLE (table), 12); mx_window_set_child (window, table); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle small-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (small_screen_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 0, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle full-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (fullscreen_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 1, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 1, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle custom window icon"); g_signal_connect (toggle, "notify::active", G_CALLBACK (icon_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 2, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 2, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle user-resizable"); g_signal_connect (toggle, "notify::active", G_CALLBACK (resizable_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 3, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 3, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle toolbar"); g_signal_connect (toggle, "notify::active", G_CALLBACK (toolbar_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 4, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 4, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-right"); mx_icon_set_icon_size (MX_ICON (icon), 16); button = mx_button_new (); mx_bin_set_child (MX_BIN (button), icon); g_signal_connect (button, "clicked", G_CALLBACK (rotate_clicked_cb), window); clutter_container_add_actor ( CLUTTER_CONTAINER (mx_window_get_toolbar (window)), button); mx_bin_set_alignment (MX_BIN (mx_window_get_toolbar (window)), MX_ALIGN_END, MX_ALIGN_MIDDLE); clutter_actor_show (stage); }
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 mnp_clock_construct (MnpClockTile *tile) { MnpDateFormat *fmt; ClutterActor *box1, *label1, *label2, *label3; ClutterActor *icon; MnpClockTilePriv *priv = tile->priv; GConfClient *client = gconf_client_get_default(); fmt = mnp_format_time_from_location (tile->priv->loc, tile->priv->time_now, gconf_client_get_bool (client, "/apps/date-time-panel/24_h_clock", NULL) ); g_object_unref(client); label1 = mx_label_new_with_text (fmt->date); tile->priv->date = (MxLabel *)label1; clutter_actor_set_name (label1, "ClockTileDate"); label2 = mx_label_new_with_text (fmt->time); tile->priv->time = (MxLabel *)label2; clutter_actor_set_name (label2, fmt->day ? "ClockTileTimeDay" : "ClockTileTimeNight"); label3 = mx_label_new_with_text (fmt->city); tile->priv->city = (MxLabel *)label3; clutter_actor_set_name (label3, "ClockTileCity"); box1 = mx_box_layout_new (); clutter_actor_set_name (box1, "ClockTileDateCityBox"); mx_box_layout_set_orientation ((MxBoxLayout *)box1, MX_ORIENTATION_VERTICAL); mx_box_layout_add_actor ((MxBoxLayout *)box1, label3, 0); clutter_container_child_set ((ClutterContainer *)box1, label3, "expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_END, NULL); mx_box_layout_add_actor ((MxBoxLayout *)box1, label1, 1); clutter_container_child_set ((ClutterContainer *)box1, label1, "expand", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_START, NULL); mx_box_layout_set_orientation ((MxBoxLayout *)tile, MX_ORIENTATION_HORIZONTAL); mx_box_layout_add_actor ((MxBoxLayout *)tile, box1, 0); clutter_container_child_set ((ClutterContainer *)tile, box1, "expand", TRUE, "x-fill", TRUE, "y-fill", FALSE, NULL); mx_box_layout_add_actor ((MxBoxLayout *)tile, label2, 1); clutter_container_child_set ((ClutterContainer *)tile, label2, "expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-align", MX_ALIGN_END, NULL); FREE_DFMT(fmt); priv->remove_button = (MxButton *)mx_button_new (); g_signal_connect (priv->remove_button, "clicked", G_CALLBACK(remove_tile), tile); mx_box_layout_add_actor ((MxBoxLayout *)tile, (ClutterActor *)priv->remove_button, 2); clutter_container_child_set ((ClutterContainer *)tile, (ClutterActor *)priv->remove_button, "expand", FALSE, "x-fill", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-align", MX_ALIGN_END, NULL); mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button), "ClockTileRemoveButton"); icon = (ClutterActor *)mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "ClockTileRemoveIcon"); mx_bin_set_child (MX_BIN (priv->remove_button), (ClutterActor *)icon); }