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_telepathy_channel_toggle_mute (MxAction *action, gpointer user_data) { MexTelepathyChannel *self = MEX_TELEPATHY_CHANNEL (user_data); MexTelepathyChannelPrivate *priv = self->priv; gboolean muted; g_object_get (priv->mic_volume, "mute", &muted, NULL); muted = !muted; g_object_set (priv->mic_volume, "mute", muted, NULL); if (muted) { mx_stylable_set_style_class (MX_STYLABLE( priv->mute_button), "MediaUnmute"); mx_action_set_display_name (action, "Mic On"); } else { mx_stylable_set_style_class (MX_STYLABLE(priv->mute_button), "MediaMute"); mx_action_set_display_name (action, "Mic Off"); } }
static void penge_count_tile_set_count (PengeCountTile *self, guint count) { PengeCountTilePrivate *priv = self->priv; gchar *count_str; priv->count = count; /* min-width does not seem to work, so we workaround adding padding spaced * around the number for 1 digit version */ if (count < 10) count_str = g_strdup_printf (" %u ", count); else count_str = g_strdup_printf ("%u", count); mx_label_set_text (MX_LABEL (priv->count_label), count_str); g_free (count_str); if (count == 0) mx_stylable_set_style_class (MX_STYLABLE (priv->count_label), "PengeZeroCountLabel"); else mx_stylable_set_style_class (MX_STYLABLE (priv->count_label), "PengeCountLabel"); if (priv->compact) penge_count_tile_update_tooltip (self); }
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 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 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_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_music_player_update_playing (MexMusicPlayer *player) { MexMusicPlayerPrivate *priv = player->priv; if (clutter_media_get_playing (priv->player)) mx_stylable_set_style_class (MX_STYLABLE (priv->play_button), "MediaPause"); else mx_stylable_set_style_class (MX_STYLABLE (priv->play_button), "MediaPlay"); }
static void mx_scroll_bar_init (MxScrollBar *self) { self->priv = MX_SCROLL_BAR_GET_PRIVATE (self); self->priv->bw_stepper = (ClutterActor *) mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (self->priv->bw_stepper), "backward-stepper"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->bw_stepper), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->bw_stepper, "button-press-event", G_CALLBACK (stepper_button_press_event_cb), self); g_signal_connect (self->priv->bw_stepper, "button-release-event", G_CALLBACK (stepper_button_release_cb), self); g_signal_connect (self->priv->bw_stepper, "leave-event", G_CALLBACK (stepper_button_release_cb), self); self->priv->fw_stepper = (ClutterActor *) mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (self->priv->fw_stepper), "forward-stepper"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->fw_stepper), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->fw_stepper, "button-press-event", G_CALLBACK (stepper_button_press_event_cb), self); g_signal_connect (self->priv->fw_stepper, "button-release-event", G_CALLBACK (stepper_button_release_cb), self); g_signal_connect (self->priv->fw_stepper, "leave-event", G_CALLBACK (stepper_button_release_cb), self); self->priv->trough = mx_frame_new (); clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE); mx_stylable_set_style_class (MX_STYLABLE (self->priv->trough), "htrough"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->trough), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->trough, "button-press-event", G_CALLBACK (trough_button_press_event_cb), self); g_signal_connect (self->priv->trough, "button-release-event", G_CALLBACK (trough_button_release_event_cb), self); g_signal_connect (self->priv->trough, "leave-event", G_CALLBACK (trough_leave_event_cb), self); self->priv->handle = (ClutterActor *) mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (self->priv->handle), "hhandle"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->handle, "button-press-event", G_CALLBACK (handle_button_press_event_cb), self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); g_signal_connect (self, "style-changed", G_CALLBACK (mx_scroll_bar_style_changed), NULL); g_signal_connect (self, "notify::reactive", G_CALLBACK (mx_scroll_bar_notify_reactive), NULL); }
static void update_playing (MxButton *button, gboolean playing) { ClutterActor *child; child = mx_bin_get_child (MX_BIN (button)); if (playing) { mx_stylable_set_style_class (MX_STYLABLE (button), "PauseButton"); mx_icon_set_icon_name (MX_ICON (child), "media-playback-pause"); } else { mx_stylable_set_style_class (MX_STYLABLE (button), "PlayButton"); mx_icon_set_icon_name (MX_ICON (child), "media-playback-start"); } /* stop button? meh */ }
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); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->volume); }
static ClutterActor * mex_menu_create_layout (MexMenu *menu, gboolean lower) { ClutterActor *layout, *scroll; MexMenuPrivate *priv = menu->priv; layout = mx_box_layout_new (); if (priv->min_width >= 0) g_object_set (G_OBJECT (layout), "min-width", priv->min_width, NULL); mx_box_layout_set_orientation (MX_BOX_LAYOUT (layout), MX_ORIENTATION_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (layout), "Menu"); clutter_container_add_actor (CLUTTER_CONTAINER (menu), layout); priv->action_layout = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->action_layout), MX_ORIENTATION_VERTICAL); scroll = mex_scroll_view_new (); clutter_container_add_actor (CLUTTER_CONTAINER (scroll), priv->action_layout); clutter_container_add_actor (CLUTTER_CONTAINER (layout), scroll); g_object_set_data (G_OBJECT (layout), "action-layout", priv->action_layout); return layout; }
static void mex_telepathy_channel_create_incoming_video (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; ClutterActor *video_incoming_area; /* Setup the incoming surface to draw to */ priv->incoming_texture = clutter_texture_new (); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->incoming_texture), TRUE); video_incoming_area = mx_stack_new (); clutter_container_add (CLUTTER_CONTAINER (video_incoming_area), mex_telepathy_channel_create_static_image(), priv->incoming_texture, NULL); /* Create a frame for it with a styled border */ priv->full_frame = mx_frame_new(); clutter_actor_set_name (priv->full_frame, "Incoming Frame"); mx_bin_set_fill (MX_BIN (priv->full_frame), TRUE, TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->full_frame), "CallWindow"); clutter_actor_add_effect (priv->full_frame, CLUTTER_EFFECT ( mex_telepathy_channel_create_shadow ())); clutter_container_add_actor (CLUTTER_CONTAINER (priv->full_frame), video_incoming_area); priv->incoming_sink = clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->incoming_texture)); }
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 mx_expander_update (MxExpander *expander) { MxExpanderPrivate *priv = expander->priv; if (priv->expanded) { clutter_actor_set_name (priv->arrow, "mx-expander-arrow-open"); mx_stylable_set_style_class (MX_STYLABLE (expander), "open-expander"); } /* closed state is set when animation is finished */ if (!priv->child) return; /* setup and start the expansion animation */ if (!priv->expanded) { clutter_actor_hide (priv->child); clutter_timeline_set_direction (priv->timeline, CLUTTER_TIMELINE_BACKWARD); } else { clutter_timeline_set_direction (priv->timeline, CLUTTER_TIMELINE_FORWARD); } if (!clutter_timeline_is_playing (priv->timeline)) clutter_timeline_rewind (priv->timeline); clutter_timeline_start (priv->timeline); }
static void mex_content_box_toggle_open (MexContentBox *box) { MexContentBoxPrivate *priv = box->priv; gboolean close_notified, next_is_open; const gchar *mimetype; /* search history items should not appear in the "open" state */ mimetype = mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_MIMETYPE); if (!g_strcmp0 (mimetype, "x-mex/search")) return; /* if the close animation was cancelled then no notify for the closed state * will have been sent, therefore notify for the opened state does not need * to be emitted */ close_notified = (!priv->is_open && !clutter_timeline_is_playing (priv->timeline)); next_is_open = !priv->is_open; if (next_is_open) { /* opening */ clutter_timeline_set_direction (priv->timeline, CLUTTER_TIMELINE_FORWARD); mx_stylable_set_style_class (MX_STYLABLE (box), "open"); /* refresh the action list */ mex_content_view_set_content (MEX_CONTENT_VIEW (priv->action_list), priv->content); priv->extras_visible = TRUE; if (close_notified) g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_OPEN]); mex_push_focus (MX_FOCUSABLE (priv->action_list)); } else { priv->is_closing = TRUE; /* closing */ mex_push_focus (MX_FOCUSABLE (priv->tile)); clutter_timeline_set_direction (priv->timeline, CLUTTER_TIMELINE_BACKWARD); priv->is_closing = FALSE; priv->extras_visible = TRUE; } if (!clutter_timeline_is_playing (priv->timeline)) clutter_timeline_rewind (priv->timeline); clutter_timeline_start (priv->timeline); priv->is_open = next_is_open; }
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 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 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 update_style_class (MexVolumeControl *self) { MexVolumeControlPrivate *priv = self->priv; gchar *new_style_class; 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); }
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 mpl_entry_init (MplEntry *self) { MplEntryPrivate *priv; ClutterActor *text; self->priv = priv = MPL_ENTRY_GET_PRIVATE (self); priv->entry = mx_entry_new (); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->entry); mx_stylable_set_style_class (MX_STYLABLE (priv->entry), "MplEntryEntry"); text = mx_entry_get_clutter_text (MX_ENTRY (priv->entry)); clutter_text_set_single_line_mode (CLUTTER_TEXT (text), TRUE); g_signal_connect (text, "text-changed", G_CALLBACK (text_changed_cb), self); priv->table = CLUTTER_ACTOR (mx_table_new ()); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->table); priv->clear_button = CLUTTER_ACTOR (mx_button_new ()); clutter_actor_hide (priv->clear_button); mx_table_insert_actor (MX_TABLE (priv->table), priv->clear_button, 0, 0); mx_stylable_set_style_class (MX_STYLABLE (priv->clear_button), "MplEntryClearButton"); set_clear_button_size (priv->clear_button); g_signal_connect (priv->clear_button, "clicked", G_CALLBACK (clear_button_clicked_cb), self); priv->search_button = CLUTTER_ACTOR (mx_button_new ()); mx_table_insert_actor (MX_TABLE (priv->table), priv->search_button, 0, 1); mx_stylable_set_style_class (MX_STYLABLE (priv->search_button), "MplEntryButton"); g_signal_connect (priv->search_button, "clicked", G_CALLBACK (search_button_clicked_cb), self); }
static void mex_telepathy_channel_set_camera_state (MexTelepathyChannel *self, gboolean on) { MexTelepathyChannelPrivate *priv = self->priv; MxAction *action = mx_button_get_action ( MX_BUTTON (self->priv->camera_button)); if (on) { clutter_actor_show (priv->video_outgoing); // We are starting, so change the button to pause. mx_stylable_set_style_class (MX_STYLABLE ( priv->camera_button), "CameraOff"); mx_action_set_display_name (action, "Camera Off"); } else { clutter_actor_hide (priv->video_outgoing); // We are stopping, so change the button to play. mx_stylable_set_style_class (MX_STYLABLE ( priv->camera_button), "CameraOn"); mx_action_set_display_name (action, "Camera On"); } }
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 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); }
void mx_scroll_bar_set_orientation (MxScrollBar *bar, MxOrientation orientation) { MxScrollBarPrivate *priv; g_return_if_fail (MX_IS_SCROLL_BAR (bar)); priv = bar->priv; if (orientation != priv->orientation) { priv->orientation = orientation; if (bar->priv->orientation) { mx_stylable_set_style_class (MX_STYLABLE (priv->bw_stepper), "up-stepper"); mx_stylable_set_style_class (MX_STYLABLE (priv->fw_stepper), "down-stepper"); mx_stylable_set_style_class (MX_STYLABLE (priv->handle), "vhandle"); mx_stylable_set_style_class (MX_STYLABLE (priv->trough), "vtrough"); } else { mx_stylable_set_style_class (MX_STYLABLE (priv->fw_stepper), "forward-stepper"); mx_stylable_set_style_class (MX_STYLABLE (priv->bw_stepper), "backward-stepper"); mx_stylable_set_style_class (MX_STYLABLE (priv->handle), "hhandle"); mx_stylable_set_style_class (MX_STYLABLE (priv->trough), "htrough"); } clutter_actor_queue_relayout (CLUTTER_ACTOR (bar)); g_object_notify (G_OBJECT (bar), "orientation"); } }
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 timeline_complete (ClutterTimeline *timeline, ClutterActor *expander) { guchar opacity; MxExpanderPrivate *priv = MX_EXPANDER (expander)->priv; g_signal_emit (expander, expander_signals[EXPAND_COMPLETE], 0); /* if the expander is now closed, update the style */ if (!priv->expanded) { clutter_actor_set_name (priv->arrow, "mx-expander-arrow-closed"); mx_stylable_set_style_class (MX_STYLABLE (expander), "closed-expander"); clutter_actor_queue_relayout (expander); } if (!priv->child) return; /* continue only if we are "opening" */ if (!priv->expanded) return; /* we can't do an animation if there is already one in progress, * because we cannot get the actors original opacity */ if (clutter_actor_get_transition (priv->child, "opacity")) { clutter_actor_show (priv->child); return; } opacity = clutter_actor_get_opacity (priv->child); clutter_actor_set_opacity (priv->child, 0); clutter_actor_show (priv->child); clutter_actor_save_easing_state (priv->child); clutter_actor_set_easing_mode (priv->child, CLUTTER_EASE_IN_SINE); clutter_actor_set_easing_duration (priv->child, 100); clutter_actor_set_opacity (priv->child, opacity); clutter_actor_restore_easing_state (priv->child); }
static void mex_media_controls_notify_playing_cb (ClutterMedia *media, GParamSpec *pspec, MexMediaControls *self) { MexMediaControlsPrivate *priv = self->priv; MxStylable *button; const gchar *name; if (clutter_media_get_playing (media)) name = "MediaPause"; else name = "MediaPlay"; button = MX_STYLABLE (clutter_script_get_object (priv->script, "play-pause-button")); mx_stylable_set_style_class (button, name); }
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); }