static void container_real_raise (ClutterContainer *container, ClutterActor *child, ClutterActor *sibling) { ClutterActor *self = CLUTTER_ACTOR (container); clutter_actor_set_child_above_sibling (self, child, sibling); }
static void overview_animated_destroy(MosesOverview* self, MosesOverviewQuitReason reason, gboolean animate) { MosesOverviewPrivate* priv = self->priv; gboolean just_destroy = !animate; if (reason == MOSES_OV_REASON_ACTIVATE_WINDOW && !priv->selected_actor) { just_destroy = TRUE; } else if (reason == MOSES_OV_REASON_ACTIVATE_WORKSPACE && !priv->selected_workspace) { just_destroy = TRUE; } else if (reason == MOSES_OV_REASON_NORMAL) { just_destroy = TRUE; } if (just_destroy) { clutter_actor_destroy(CLUTTER_ACTOR(self)); return; } gfloat x, y, w, h; ClutterActor* target = NULL; if (reason == MOSES_OV_REASON_ACTIVATE_WINDOW) { target = self->priv->selected_actor; ClutterActor* orig = clutter_clone_get_source(CLUTTER_CLONE(target)); clutter_actor_get_position(orig, &x, &y); clutter_actor_get_size(orig, &w, &h); g_signal_handlers_disconnect_by_func(target, on_effect_complete, self); } else if (reason == MOSES_OV_REASON_ACTIVATE_WORKSPACE) { g_assert(priv->selected_actor == NULL); MetaScreen* screen = meta_plugin_get_screen(priv->plugin); target = overview_head_get_actor_for_workspace(priv->ov_head, priv->selected_workspace); MetaRectangle geom; int focused_monitor = meta_screen_get_current_monitor(screen); meta_screen_get_monitor_geometry(screen, focused_monitor, &geom); x = geom.x, y = geom.y, w = geom.width, h = geom.height; } if (target) { clutter_actor_remove_all_transitions(target); clutter_actor_set_child_above_sibling(clutter_actor_get_parent(target), target, NULL); clutter_actor_save_easing_state(target); clutter_actor_set_easing_mode(target, CLUTTER_LINEAR); clutter_actor_set_easing_duration(target, 150); clutter_actor_set_position(target, x, y); clutter_actor_set_scale(target, w / clutter_actor_get_width(target), h / clutter_actor_get_height(target)); clutter_actor_restore_easing_state(target); g_object_connect(target, "signal::transitions-completed", G_CALLBACK(on_restore_position_effect_complete), self, NULL); } }
static void mx_button_update_contents (MxButton *self) { MxButtonPrivate *priv = self->priv; ClutterActor *child; gboolean icon_visible, label_visible; const gchar *text; /* If the icon doesn't have a name set, treat it as * not-visible. */ if (priv->icon_visible && mx_icon_get_icon_name (MX_ICON (priv->icon))) icon_visible = TRUE; else icon_visible = FALSE; text = clutter_text_get_text (CLUTTER_TEXT (priv->label)); if (priv->label_visible && text && (strcmp (text, "") != 0)) label_visible = TRUE; else label_visible = FALSE; /* replace any custom content */ child = mx_bin_get_child (MX_BIN (self)); if (child != priv->hbox) mx_bin_set_child (MX_BIN (self), priv->hbox); /* Handle the simple cases first */ if (!icon_visible && !label_visible) { clutter_actor_hide (priv->hbox); return; } /* ensure the hbox is visible */ clutter_actor_show (priv->hbox); if (icon_visible && !label_visible) { clutter_actor_show (priv->icon); clutter_actor_hide (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); return; } if (!icon_visible && label_visible) { clutter_actor_hide (priv->icon); clutter_actor_show (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->label, NULL); return; } /* Both the icon and text are visible, handle this case */ clutter_actor_show (priv->icon); clutter_actor_show (priv->label); switch (priv->icon_position) { case MX_POSITION_TOP: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); break; case MX_POSITION_RIGHT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); break; case MX_POSITION_BOTTOM: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); mx_box_layout_child_set_x_align (MX_BOX_LAYOUT (priv->hbox), priv->label, MX_ALIGN_MIDDLE); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); break; case MX_POSITION_LEFT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); break; } }
static void mex_info_bar_init (MexInfoBar *self) { ClutterScript *script; ClutterActor *notification_area; GError *err = NULL; gchar *tmp; GSettings *settings; MexInfoBarPrivate *priv = self->priv = INFO_BAR_PRIVATE (self); priv->script = script = clutter_script_new (); tmp = g_build_filename (mex_get_data_dir (), "json", "info-bar.json", NULL); clutter_script_load_from_file (script, tmp, &err); g_free (tmp); if (err) g_error ("Could not load info bar: %s", err->message); priv->group = CLUTTER_ACTOR (clutter_script_get_object (script, "main-group")); clutter_actor_set_parent (priv->group, CLUTTER_ACTOR (self)); priv->settings_button = CLUTTER_ACTOR (clutter_script_get_object (script, "settings-button")); priv->power_button = CLUTTER_ACTOR (clutter_script_get_object (script, "power-button")); priv->back_button = CLUTTER_ACTOR (clutter_script_get_object (script, "back-button")); priv->notification_source = mex_generic_notification_source_new (); notification_area = CLUTTER_ACTOR (clutter_script_get_object (priv->script, "notification-area")); /* ensure the notification area is above any other actors */ clutter_actor_set_child_above_sibling (clutter_actor_get_parent (notification_area), notification_area, NULL); mex_notification_area_add_source (MEX_NOTIFICATION_AREA (notification_area), MEX_NOTIFICATION_SOURCE (priv->notification_source)); g_signal_connect (priv->settings_button, "clicked", G_CALLBACK (_show_settings_dialog_cb), self); g_signal_connect (priv->power_button, "clicked", G_CALLBACK (_close_request_cb), self); g_signal_connect (priv->back_button, "clicked", G_CALLBACK (_back_button_cb), self); _create_settings_dialog (MEX_INFO_BAR (self)); settings = g_settings_new ("org.media-explorer.Shell"); if (!g_settings_get_boolean (settings, "close-button-visible")) clutter_actor_hide (priv->power_button); g_clear_object (&settings); }