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 gboolean mx_button_leave (ClutterActor *actor, ClutterCrossingEvent *event) { MxButton *button = MX_BUTTON (actor); MxWidget *widget = MX_WIDGET (actor); if (event->source != actor) return FALSE; /* hide the tooltip */ if (mx_widget_get_tooltip_text (widget)) mx_widget_hide_tooltip (widget); /* check if the widget is disabled */ if (mx_widget_get_disabled (MX_WIDGET (actor))) return FALSE; if (button->priv->is_pressed) { //clutter_ungrab_pointer (); mx_widget_long_press_cancel (widget); mx_stylable_style_pseudo_class_remove (MX_STYLABLE (widget), "active"); button->priv->is_pressed = FALSE; } mx_stylable_style_pseudo_class_remove (MX_STYLABLE (widget), "hover"); return FALSE; }
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_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 _enter_event_cb (ClutterActor *actor, ClutterCrossingEvent *event, gpointer data) { MxFocusable *focusable; MxFocusManager *f_manager; f_manager = mx_focus_manager_get_for_stage (CLUTTER_STAGE (clutter_actor_get_stage (actor))); focusable = mx_focus_manager_get_focused (f_manager); /* hide the hover state on a button that has accepted focus via the default * focus as we're navigating by mouse and not keys we don't want to move * the focus as we may still want it in the place e.g. search bar */ if ((focusable) && (MNB_IS_LAUNCHER_BUTTON (focusable)) && (CLUTTER_ACTOR (focusable) != actor)) mx_stylable_set_style_pseudo_class (MX_STYLABLE (focusable), NULL); mx_stylable_set_style_pseudo_class (MX_STYLABLE (actor), "hover"); return FALSE; }
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 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 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); }
void mx_toggle_set_active (MxToggle *toggle, gboolean active) { MxTogglePrivate *priv; g_return_if_fail (MX_IS_TOGGLE (toggle)); priv = toggle->priv; if (priv->active != active || (priv->position > 0 && priv->position < 1)) { ClutterTimeline *timeline; priv->active = active; if (active) mx_stylable_set_style_pseudo_class (MX_STYLABLE (toggle), "checked"); else mx_stylable_set_style_pseudo_class (MX_STYLABLE (toggle), NULL); g_object_notify (G_OBJECT (toggle), "active"); /* don't run an animation if the actor is not mapped */ if (!CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR (toggle))) { priv->position = (active) ? 1 : 0; return; } timeline = clutter_alpha_get_timeline (priv->alpha); if (active) clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_FORWARD); else clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD); if (clutter_timeline_is_playing (timeline)) return; clutter_timeline_rewind (timeline); if (priv->drag_offset > -1) { clutter_alpha_set_mode (priv->alpha, CLUTTER_LINEAR); clutter_timeline_advance (timeline, priv->position * 300); } else { clutter_alpha_set_mode (priv->alpha, CLUTTER_EASE_IN_OUT_CUBIC); } clutter_timeline_start (timeline); } }
static void mex_tile_style_changed_cb (MexTile *self, MxStyleChangedFlags flags) { MexTilePrivate *priv = self->priv; MxBorderImage *image; if (priv->header_padding) { g_boxed_free (MX_TYPE_PADDING, priv->header_padding); priv->header_padding = NULL; } if (priv->header_background_color) { g_boxed_free (CLUTTER_TYPE_COLOR, priv->header_background_color); priv->header_background_color = NULL; } mx_stylable_get (MX_STYLABLE (self), "x-mex-header-background", &image, "x-mex-header-background-color", &priv->header_background_color, "x-mex-header-padding", &priv->header_padding, NULL); mx_stylable_apply_clutter_text_attributes (MX_STYLABLE (self), CLUTTER_TEXT (priv->label)); mx_stylable_apply_clutter_text_attributes (MX_STYLABLE (self), CLUTTER_TEXT (priv->secondary_label)); if (image && image->uri) { CoglObject *background; background = mx_texture_cache_get_cogl_texture (mx_texture_cache_get_default (), image->uri); cogl_material_set_layer (priv->material, 0, background); } else { if (cogl_material_get_n_layers (priv->material)) cogl_material_remove_layer (priv->material, 0); } if (image) g_boxed_free (MX_TYPE_BORDER_IMAGE, image); if (priv->icon1) mx_stylable_style_changed (MX_STYLABLE (priv->icon1), flags); if (priv->icon2) mx_stylable_style_changed (MX_STYLABLE (priv->icon2), flags); clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); }
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 MxFocusable* mx_toggle_accept_focus (MxFocusable *focusable, MxFocusHint hint) { MxTogglePrivate *priv = MX_TOGGLE (focusable)->priv; mx_stylable_style_pseudo_class_add (MX_STYLABLE (focusable), "focus"); mx_stylable_style_pseudo_class_add (MX_STYLABLE (priv->handle), "focus"); clutter_actor_grab_key_focus (CLUTTER_ACTOR (focusable)); return focusable; }
static void mx_scroll_view_apply_style (MxWidget *widget, MxStyle *style) { MxScrollViewPrivate *priv = MX_SCROLL_VIEW (widget)->priv; if (priv->hscroll != NULL) mx_stylable_set_style (MX_STYLABLE (priv->hscroll), style); if (priv->vscroll != NULL) mx_stylable_set_style (MX_STYLABLE (priv->vscroll), style); }
static void mx_scroll_view_style_changed (MxWidget *widget, MxStyleChangedFlags flags) { MxScrollViewPrivate *priv = MX_SCROLL_VIEW (widget)->priv; mx_stylable_style_changed (MX_STYLABLE (priv->hscroll), flags); mx_stylable_style_changed (MX_STYLABLE (priv->vscroll), flags); mx_stylable_get (MX_STYLABLE (widget), "x-mx-scrollbar-width", &priv->scrollbar_width, "x-mx-scrollbar-height", &priv->scrollbar_height, 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 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_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 MxFocusable* mx_toggle_move_focus (MxFocusable *focusable, MxFocusDirection direction, MxFocusable *from) { /* check if focus is being moved from us */ if (focusable == from) { MxTogglePrivate *priv = MX_TOGGLE (focusable)->priv; mx_stylable_style_pseudo_class_remove (MX_STYLABLE (focusable), "focus"); mx_stylable_style_pseudo_class_remove (MX_STYLABLE (priv->handle), "focus"); } return NULL; }
static gboolean mx_toggle_handle_button_release_event (ClutterActor *actor, ClutterButtonEvent *event, MxToggle *toggle) { ClutterActorBox box; if (mx_widget_get_disabled (MX_WIDGET (toggle))) return FALSE; if (toggle->priv->last_move == 0) mx_toggle_set_active (toggle, !toggle->priv->active); else mx_toggle_set_active (toggle, (toggle->priv->last_move > 0.0)); toggle->priv->drag_offset = -1; toggle->priv->last_move = 0; clutter_ungrab_pointer (); /* ensure the hover state is removed if the pointer left the handle * during the grab */ clutter_actor_get_allocation_box (actor, &box); if (!clutter_actor_box_contains (&box, event->x, event->y)) mx_stylable_style_pseudo_class_remove (MX_STYLABLE (actor), "hover"); return TRUE; }
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 gboolean mnb_launcher_button_key_release_event (ClutterActor *actor, ClutterKeyEvent *event) { if (event->keyval == CLUTTER_KEY_Return || event->keyval == CLUTTER_KEY_KP_Enter || event->keyval == CLUTTER_KEY_ISO_Enter) { MnbLauncherButton *self = MNB_LAUNCHER_BUTTON (actor); if (!self->priv->is_pressed) return FALSE; clutter_ungrab_keyboard (); self->priv->is_pressed = FALSE; g_signal_emit (self, _signals[ACTIVATED], 0); mx_stylable_set_style_pseudo_class (MX_STYLABLE (self), NULL); mx_widget_hide_tooltip (MX_WIDGET (self)); return TRUE; } return FALSE; }
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 mx_button_pull (MxButton *button) { MxWidget *widget = MX_WIDGET (button); MxButtonPrivate *priv = button->priv; if (!button->priv->is_pressed) return; //clutter_ungrab_pointer (); if (button->priv->is_toggle) { mx_button_set_toggled (button, !button->priv->is_toggled); } button->priv->is_pressed = FALSE; /* activate any associated action */ if (priv->action) g_signal_emit_by_name (priv->action, "activated", 0); g_signal_emit (button, button_signals[CLICKED], 0); mx_widget_long_press_cancel (widget); mx_stylable_style_pseudo_class_remove (MX_STYLABLE (button), "active"); }
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 mx_button_update_label_style (MxButton *button) { MxButtonPrivate *priv = button->priv; mx_stylable_apply_clutter_text_attributes (MX_STYLABLE (button), CLUTTER_TEXT (priv->label)); }
static MxFocusable* mx_button_accept_focus (MxFocusable *focusable, MxFocusHint hint) { mx_stylable_style_pseudo_class_add (MX_STYLABLE (focusable), "focus"); clutter_actor_grab_key_focus (CLUTTER_ACTOR (focusable)); return focusable; }
/** * mx_button_set_toggled: * @button: a #MxButton * @toggled: #TRUE or #FALSE * * Sets the toggled state of the button. This is only really useful if the * button has #toggle-mode mode set to #TRUE. */ void mx_button_set_toggled (MxButton *button, gboolean toggled) { g_return_if_fail (MX_IS_BUTTON (button)); if (button->priv->is_toggled != toggled) { button->priv->is_toggled = toggled; if (toggled) mx_stylable_style_pseudo_class_add (MX_STYLABLE (button), "checked"); else mx_stylable_style_pseudo_class_remove (MX_STYLABLE (button), "checked"); g_object_notify (G_OBJECT (button), "toggled"); } }