コード例 #1
0
ファイル: st-scroll-view.c プロジェクト: acbramley/Cinnamon
static void
st_scroll_view_init (StScrollView *self)
{
  StScrollViewPrivate *priv = self->priv = SCROLL_VIEW_PRIVATE (self);

  priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
  priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;

  priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
  priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR,
                                "adjustment", priv->hadjustment,
                                "vertical", FALSE,
                                NULL);

  priv->vadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
  priv->vscroll = g_object_new (ST_TYPE_SCROLL_BAR,
                                "adjustment", priv->vadjustment,
                                "vertical", TRUE,
                                NULL);

  clutter_actor_set_parent (priv->hscroll, CLUTTER_ACTOR (self));
  clutter_actor_set_parent (priv->vscroll, CLUTTER_ACTOR (self));

  /* mouse scroll is enabled by default, so we also need to be reactive */
  priv->mouse_scroll = TRUE;
  g_object_set (G_OBJECT (self), "reactive", TRUE, NULL);

  priv->auto_scroll = FALSE;
  priv->auto_scroll_timeout_id = 0;
  priv->mouse_pointer = clutter_device_manager_get_core_device (clutter_device_manager_get_default (),
                                                                      CLUTTER_POINTER_DEVICE);
  priv->settings = g_settings_new("org.cinnamon");
  priv->setting_connect_id = g_signal_connect (priv->settings, "changed::enable-vfade", G_CALLBACK (vfade_setting_changed_cb), self);
}
コード例 #2
0
ファイル: st-scroll-view.c プロジェクト: Ak-/Cinnamon
static void
st_scroll_view_init (StScrollView *self)
{
  StScrollViewPrivate *priv = self->priv = SCROLL_VIEW_PRIVATE (self);

  priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
  priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;

  priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
  priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR,
                                "adjustment", priv->hadjustment,
                                "vertical", FALSE,
                                NULL);

  priv->vadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
  priv->vscroll = g_object_new (ST_TYPE_SCROLL_BAR,
                                "adjustment", priv->vadjustment,
                                "vertical", TRUE,
                                NULL);

  clutter_actor_set_parent (priv->hscroll, CLUTTER_ACTOR (self));
  clutter_actor_set_parent (priv->vscroll, CLUTTER_ACTOR (self));

  /* mouse scroll is enabled by default, so we also need to be reactive */
  priv->mouse_scroll = TRUE;
  g_object_set (G_OBJECT (self), "reactive", TRUE, NULL);
}
コード例 #3
0
ファイル: mx-expander.c プロジェクト: GunioRobot/mx
static void
mx_expander_init (MxExpander *self)
{
  MxExpanderPrivate *priv = self->priv = GET_PRIVATE (self);

  priv->label = clutter_text_new ();
  clutter_actor_set_parent (priv->label, (ClutterActor *) self);

  priv->arrow = (ClutterActor *) mx_icon_new ();
  clutter_actor_set_parent (priv->arrow, (ClutterActor *) self);
  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);
  g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (new_frame), self);
  g_signal_connect (priv->timeline, "completed", G_CALLBACK (timeline_complete), self);

  priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_IN_SINE);
  g_object_ref_sink (priv->alpha);

  clutter_actor_set_reactive ((ClutterActor *) self, TRUE);

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mx_expander_style_changed), NULL);
}
コード例 #4
0
static void
penge_grid_view_init (PengeGridView *self)
{
  PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self);

  self->priv = priv;



  priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE,
                                        NULL);

  mx_table_add_actor (MX_TABLE (self), priv->everything_pane, 0, 0);

  mx_table_set_row_spacing (MX_TABLE (self), 6);
  mx_table_set_column_spacing (MX_TABLE (self), 6);

  /* 
   * Create a background and parent it to the grid. We paint and allocate this
   * in the overridden vfuncs
   */
  priv->background = g_object_new (PENGE_TYPE_VIEW_BACKGROUND, NULL);
  clutter_actor_set_parent (priv->background, (ClutterActor *)self);
  clutter_actor_show (priv->background);

  priv->background_fade = clutter_texture_new_from_file (FADE_BG,
                                                         NULL);
  clutter_actor_set_parent (priv->background_fade, (ClutterActor *)self);
  clutter_actor_show (priv->background_fade);

  priv->gconf_client = gconf_client_get_default ();

 _update_layout (self);
}
コード例 #5
0
ファイル: mx-menu.c プロジェクト: jku/mx
static void
mx_menu_init (MxMenu *self)
{
  MxMenuPrivate *priv = self->priv = MENU_PRIVATE (self);

  priv->children = g_array_new (FALSE, FALSE, sizeof (MxMenuChild));

  g_object_set (G_OBJECT (self),
                "show-on-set-parent", FALSE,
                NULL);

  g_signal_connect (self, "style-changed", G_CALLBACK (mx_menu_style_changed),
                    NULL);
  priv->id_offset = 0;
  priv->last_shown_id = 0;

  priv->up_button = mx_button_new_with_label("/\\");
  clutter_actor_set_parent (CLUTTER_ACTOR (priv->up_button),
                            CLUTTER_ACTOR (self));
  g_signal_connect (priv->up_button, "enter-event",
                    G_CALLBACK(mx_menu_up_enter), self);
  g_signal_connect (priv->up_button, "leave-event",
                    G_CALLBACK(mx_menu_up_leave), self);
  priv->down_button = mx_button_new_with_label ("\\/");
  clutter_actor_set_parent (CLUTTER_ACTOR (priv->down_button),
                            CLUTTER_ACTOR (self));
  g_signal_connect (priv->down_button, "enter-event",
                    G_CALLBACK(mx_menu_down_enter), self);
  g_signal_connect (priv->down_button, "leave-event",
                    G_CALLBACK(mx_menu_down_leave), self);
}
コード例 #6
0
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 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);
}
コード例 #8
0
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);
}
コード例 #9
0
ファイル: st-scroll-bar.c プロジェクト: magcius/gnome-shell
static void
st_scroll_bar_init (StScrollBar *self)
{
  self->priv = ST_SCROLL_BAR_GET_PRIVATE (self);

  self->priv->bw_stepper = (ClutterActor *) st_button_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (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);

  self->priv->fw_stepper = (ClutterActor *) st_button_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (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);

  self->priv->trough = (ClutterActor *) st_bin_new ();
  clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough");
  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 *) st_button_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle");
  clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle),
                            self->priv->trough);
  g_signal_connect (self->priv->handle, "button-press-event",
                    G_CALLBACK (handle_button_press_event_cb), self);
  g_signal_connect (self->priv->handle, "button-release-event",
                    G_CALLBACK (handle_button_release_event_cb), self);
  g_signal_connect (self->priv->handle, "motion-event",
                    G_CALLBACK (handle_motion_event_cb), self);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);

  g_signal_connect (self, "notify::reactive",
                    G_CALLBACK (st_scroll_bar_notify_reactive), NULL);
}
コード例 #10
0
static void
tidy_scroll_view_init (TidyScrollView *self)
{
  TidyScrollViewPrivate *priv = self->priv = SCROLL_VIEW_PRIVATE (self);
  
  priv->hscroll = tidy_scroll_bar_new (NULL);
  priv->vscroll = tidy_scroll_bar_new (NULL);
  
  clutter_actor_set_parent (priv->hscroll, CLUTTER_ACTOR (self));
  clutter_actor_set_parent (priv->vscroll, CLUTTER_ACTOR (self));
  
  clutter_actor_show (priv->hscroll);
  clutter_actor_show (priv->vscroll);
  clutter_actor_set_rotation (priv->vscroll, CLUTTER_Z_AXIS, 90.0, 0, 0, 0);
}
コード例 #11
0
ファイル: st-widget.c プロジェクト: MarkieMark/gnome-shell
/**
 * st_widget_set_has_tooltip:
 * @widget: A #StWidget
 * @has_tooltip: %TRUE if the widget should display a tooltip
 *
 * Enables tooltip support on the #StWidget.
 *
 * Note that setting has-tooltip to %TRUE will cause
 * #ClutterActor:reactive and #StWidget:track-hover to be set %TRUE as
 * well, but you must clear these flags yourself (if appropriate) when
 * setting it %FALSE.
 */
void
st_widget_set_has_tooltip (StWidget *widget,
                           gboolean  has_tooltip)
{
  StWidgetPrivate *priv;

  g_return_if_fail (ST_IS_WIDGET (widget));

  priv = widget->priv;

  priv->has_tooltip = has_tooltip;

  if (has_tooltip)
    {
      clutter_actor_set_reactive ((ClutterActor*) widget, TRUE);
      st_widget_set_track_hover (widget, TRUE);

      if (!priv->tooltip)
        {
          priv->tooltip = g_object_new (ST_TYPE_TOOLTIP, NULL);
          clutter_actor_set_parent ((ClutterActor *) priv->tooltip,
                                    (ClutterActor *) widget);
        }
    }
  else
    {
      if (priv->tooltip)
        {
          clutter_actor_unparent (CLUTTER_ACTOR (priv->tooltip));
          priv->tooltip = NULL;
        }
    }
}
コード例 #12
0
ファイル: mex-tile.c プロジェクト: frankopt/media-explorer
void
mex_tile_set_secondary_icon (MexTile      *tile,
                             ClutterActor *icon)
{
  MexTilePrivate *priv;

  g_return_if_fail (MEX_IS_TILE (tile));
  g_return_if_fail (!icon || CLUTTER_IS_ACTOR (icon));

  priv = tile->priv;
  if (priv->icon2 != icon)
    {
      if (priv->icon2)
        clutter_actor_destroy (priv->icon2);

      if (icon)
        {
          clutter_actor_push_internal (CLUTTER_ACTOR (tile));
          clutter_actor_set_parent (icon, CLUTTER_ACTOR (tile));
          clutter_actor_pop_internal (CLUTTER_ACTOR (tile));
        }

      priv->icon2 = icon;

      g_object_notify (G_OBJECT (tile), "secondary-icon");
    }
}
コード例 #13
0
ファイル: st-icon.c プロジェクト: Ak-/Cinnamon
static void
st_icon_finish_update (StIcon *icon)
{
  StIconPrivate *priv = icon->priv;

  if (priv->icon_texture)
    {
      clutter_actor_destroy (priv->icon_texture);
      priv->icon_texture = NULL;
    }

  if (priv->pending_texture)
    {
      priv->icon_texture = priv->pending_texture;
      priv->pending_texture = NULL;
      clutter_actor_set_parent (priv->icon_texture, CLUTTER_ACTOR (icon));

      /* Remove the temporary ref we added */
      g_object_unref (priv->icon_texture);

      st_icon_update_shadow_material (icon);

      /* "pixbuf-change" is actually a misnomer for "texture-changed" */
      g_signal_connect (priv->icon_texture, "pixbuf-change",
                        G_CALLBACK (on_pixbuf_changed), icon);
    }
}
コード例 #14
0
ファイル: mx-combo-box.c プロジェクト: GunioRobot/mx
static void
mx_combo_box_init (MxComboBox *self)
{
  MxComboBoxPrivate *priv;
  ClutterActor *menu;

  priv = self->priv = COMBO_BOX_PRIVATE (self);

  priv->spacing = 8;

  priv->label = clutter_text_new ();
  clutter_actor_set_parent (priv->label, (ClutterActor*) self);

  menu = mx_menu_new ();
  mx_widget_set_menu (MX_WIDGET (self), MX_MENU (menu));

  g_signal_connect (menu, "action-activated",
                    G_CALLBACK (mx_combo_box_action_activated_cb),
                    self);

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mx_combo_box_style_changed), NULL);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
}
コード例 #15
0
ファイル: mx-toggle.c プロジェクト: jlec/mx
static void
mx_toggle_init (MxToggle *self)
{
  ClutterTimeline *timeline;

  self->priv = TOGGLE_PRIVATE (self);

  self->priv->handle = g_object_new (MX_TYPE_TOGGLE_HANDLE,
                                     "reactive", TRUE, NULL);
  clutter_actor_set_parent (self->priv->handle, CLUTTER_ACTOR (self));
  g_object_bind_property (self, "disabled", self->priv->handle, "disabled",
                          G_BINDING_SYNC_CREATE);

  timeline = clutter_timeline_new (300);
  g_signal_connect (timeline, "new-frame",
                    G_CALLBACK (mx_toggle_update_position), self);

  self->priv->alpha = clutter_alpha_new_full (timeline,
                                              CLUTTER_EASE_IN_OUT_CUBIC);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
  clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->handle), TRUE);

  self->priv->drag_offset = -1;
  g_signal_connect (self->priv->handle, "button-press-event",
                    G_CALLBACK (mx_toggle_handle_button_press_event), self);
  g_signal_connect (self->priv->handle, "button-release-event",
                    G_CALLBACK (mx_toggle_handle_button_release_event), self);
  g_signal_connect (self->priv->handle, "motion-event",
                    G_CALLBACK (mx_toggle_handle_motion_event), self);

  g_signal_connect (self, "style-changed", G_CALLBACK (mx_toggle_style_changed),
                    NULL);

}
コード例 #16
0
ファイル: mx-menu.c プロジェクト: jku/mx
/**
 * mx_menu_add_action:
 * @menu: A #MxMenu
 * @action: A #MxAction
 *
 * Append @action to @menu.
 *
 */
void
mx_menu_add_action (MxMenu   *menu,
                    MxAction *action)
{
  MxMenuChild child;

  g_return_if_fail (MX_IS_MENU (menu));
  g_return_if_fail (MX_IS_ACTION (action));

  MxMenuPrivate *priv = menu->priv;

  child.action = g_object_ref_sink (action);
  /* TODO: Connect to notify signals in case action properties change */
  child.box = g_object_new (MX_TYPE_BUTTON,
                            "action", child.action,
                            "x-align", MX_ALIGN_START,
                            NULL);
  mx_button_set_action (MX_BUTTON (child.box), child.action);

  g_signal_connect (child.box, "clicked",
                    G_CALLBACK (mx_menu_button_clicked_cb), action);
  g_signal_connect (child.box, "enter-event",
                    G_CALLBACK (mx_menu_button_enter_event_cb), menu);
  clutter_actor_set_parent (CLUTTER_ACTOR (child.box),
                            CLUTTER_ACTOR (menu));

  g_array_append_val (priv->children, child);

  clutter_actor_queue_relayout (CLUTTER_ACTOR (menu));
}
コード例 #17
0
ファイル: tidy-grid.c プロジェクト: knewter/gnome-shell
static void
tidy_grid_real_add (ClutterContainer *container,
                    ClutterActor     *actor)
{
  TidyGridPrivate *priv;
  TidyGridActorData *data;

  g_return_if_fail (TIDY_IS_GRID (container));

  priv = TIDY_GRID (container)->priv;

  g_object_ref (actor);

  clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));

  data = g_slice_alloc0 (sizeof (TidyGridActorData));

  priv->list = g_list_append (priv->list, actor);
  g_hash_table_insert (priv->hash_table, actor, data);

  g_signal_emit_by_name (container, "actor-added", actor);

  clutter_actor_queue_relayout (CLUTTER_ACTOR (container));

  g_object_unref (actor);
}
コード例 #18
0
ファイル: mnb-statusbar.c プロジェクト: xclaesse/dawati-shell
static void
mnb_statusbar_init (MnbStatusbar *self)
{
  MnbStatusbarPrivate *priv;
  GDateTime *datetime;

  priv = self->priv = STATUSBAR_PRIVATE (self);

  g_signal_connect (self,
                    "event",
                    G_CALLBACK (mnb_statusbar_event_cb),
                    NULL);

  priv->datetime = mx_button_new ();
  clutter_actor_set_name (priv->datetime, "statusbar-date-button");
  clutter_actor_set_parent (priv->datetime, CLUTTER_ACTOR (self));

  mnb_statusbar_update_datetime (self);

  datetime = g_date_time_new_now_local ();
  g_timeout_add_seconds (60 - g_date_time_get_second (datetime),
                         (GSourceFunc) mnb_statusbar_initial_timeout_cb,
                         self);
  g_date_time_unref (datetime);
}
コード例 #19
0
ファイル: st-entry.c プロジェクト: 3n4rch3/Cinnamon
static void
_st_entry_set_icon (StEntry       *entry,
                    ClutterActor **icon,
                    ClutterActor  *new_icon)
{
  if (*icon)
    {
      g_signal_handlers_disconnect_by_func (*icon,
                                            _st_entry_icon_press_cb,
                                            entry);
      clutter_actor_unparent (*icon);
      *icon = NULL;
    }

  if (new_icon)
    {
      *icon = g_object_ref (new_icon);

      clutter_actor_set_reactive (*icon, TRUE);
      clutter_actor_set_parent (*icon, CLUTTER_ACTOR (entry));
      g_signal_connect (*icon, "button-release-event",
                        G_CALLBACK (_st_entry_icon_press_cb), entry);
    }

  clutter_actor_queue_relayout (CLUTTER_ACTOR (entry));
}
コード例 #20
0
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);
}
コード例 #21
0
ファイル: mex-shell.c プロジェクト: dudochkin-victor/mex
static void
mex_shell_add (ClutterContainer *container,
               ClutterActor     *actor)
{
  ClutterActorBox box;
  MexShellChildData *data;

  MexShell *self = MEX_SHELL (container);
  MexShellPrivate *priv = self->priv;

  data = mex_shell_child_data_new (self, actor);
  priv->children = g_list_append (priv->children, data);
  clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
  clutter_actor_set_opacity (actor, 0x00);

  clutter_actor_get_allocation_box (CLUTTER_ACTOR (container), &box);
  data->target_width = box.x2 - box.x1;
  data->target_height = box.y2 - box.y1;
  g_object_set (G_OBJECT (actor),
                "natural-width", data->target_width,
                "natural-height", data->target_height,
                NULL);

  g_signal_emit_by_name (container, "actor-added", actor);
}
コード例 #22
0
void
mex_column_view_set_placeholder_actor (MexColumnView *column,
                                       ClutterActor  *actor)
{
  MexColumnViewPrivate *priv;

  g_return_if_fail (MEX_IS_COLUMN_VIEW (column));
  g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));

  priv = column->priv;

  /* placeholder label */
  if (priv->placeholder_actor)
    clutter_actor_unparent (priv->placeholder_actor);

  priv->placeholder_actor = actor;

  if (actor)
    {
      clutter_actor_push_internal (CLUTTER_ACTOR (column));
      clutter_actor_set_parent (priv->placeholder_actor, CLUTTER_ACTOR (column));
      clutter_actor_pop_internal (CLUTTER_ACTOR (column));
    }

  clutter_actor_queue_relayout (CLUTTER_ACTOR (column));
}
コード例 #23
0
ファイル: st-entry.c プロジェクト: 3n4rch3/Cinnamon
static void
st_entry_init (StEntry *entry)
{
  StEntryPrivate *priv;

  priv = entry->priv = ST_ENTRY_GET_PRIVATE (entry);

  priv->entry = g_object_new (ST_TYPE_IM_TEXT,
                              "line-alignment", PANGO_ALIGN_LEFT,
                              "editable", TRUE,
                              "reactive", TRUE,
                              "single-line-mode", TRUE,
                              NULL);

  g_signal_connect (priv->entry, "key-focus-in",
                    G_CALLBACK (clutter_text_focus_in_cb), entry);

  g_signal_connect (priv->entry, "key-focus-out",
                    G_CALLBACK (clutter_text_focus_out_cb), entry);

  g_signal_connect (priv->entry, "notify::password-char",
                    G_CALLBACK (clutter_text_password_char_cb), entry);

  priv->spacing = 6.0f;

  clutter_actor_set_parent (priv->entry, CLUTTER_ACTOR (entry));
  clutter_actor_set_reactive ((ClutterActor *) entry, TRUE);

  /* set cursor hidden until we receive focus */
  clutter_text_set_cursor_visible ((ClutterText *) priv->entry, FALSE);
}
コード例 #24
0
static void
champlain_group_real_add (ClutterContainer *container,
    ClutterActor *actor)
{
  ChamplainGroupPrivate *priv = CHAMPLAIN_GROUP (container)->priv;

  g_object_ref (actor);
  
  if (priv->children_end)
    {
      priv->children_end = g_list_append (priv->children_end, actor);
      priv->children_end = g_list_next (priv->children_end);
    }
  else
    {
      priv->children = g_list_append (priv->children, actor);
      priv->children_end = priv->children;
    }  
    
  clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));

  /* queue a relayout, to get the correct positioning inside
   * the ::actor-added signal handlers
   */
  clutter_actor_queue_relayout (CLUTTER_ACTOR (container));

  g_signal_emit_by_name (container, "actor-added", actor);

  clutter_container_sort_depth_order (container);

  g_object_unref (actor);
}
コード例 #25
0
ファイル: IoClutterActor.c プロジェクト: Akiyah/io
IO_METHOD(IoClutterActor, setParent) {
  clutter_actor_set_parent(
    IOCACTOR(self),
    IOCACTOR(IoMessage_locals_clutterActorArgAt_(m, locals, 0))
  );
  return self;
}
コード例 #26
0
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);
}
コード例 #27
0
ファイル: mex-info-bar.c プロジェクト: ocrete/media-explorer
static void
mex_info_bar_init (MexInfoBar *self)
{
  ClutterScript *script;
  ClutterActor *notification_area;
  GError *err = NULL;
  gchar *tmp;

  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"));

  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 (_show_power_dialog_cb), self);

  g_signal_connect (priv->back_button,
                    "clicked",
                    G_CALLBACK (_back_button_cb), self);

  _create_power_dialog (MEX_INFO_BAR (self));
  _create_settings_dialog (MEX_INFO_BAR (self));
}
コード例 #28
0
ファイル: mex-tile.c プロジェクト: frankopt/media-explorer
static void
mex_tile_init (MexTile *self)
{
  MexTilePrivate *priv = self->priv = TILE_PRIVATE (self);
  const ClutterColor opaque = { 0x00, 0x00, 0x00, 0x00 };
  ClutterEffect *fade;

  /* create a template material for the header background from which cheap
   * copies can be made for each instance */
  if (G_UNLIKELY (!template_material))
    template_material = cogl_material_new ();

  priv->material = cogl_material_copy (template_material);


  /* layout for primary and secondary labels */
  priv->box_layout = mx_box_layout_new ();
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (priv->box_layout), 12);

  /* add fade effect to the box layout */
  fade = (ClutterEffect*) mx_fade_effect_new ();
  mx_fade_effect_set_border (MX_FADE_EFFECT (fade), 0, 50, 0, 0);
  mx_fade_effect_set_color (MX_FADE_EFFECT (fade), &opaque);
  clutter_actor_add_effect_with_name (priv->box_layout, "fade", fade);
  clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (fade), TRUE);

  clutter_actor_push_internal (CLUTTER_ACTOR (self));
  clutter_actor_set_parent (priv->box_layout, CLUTTER_ACTOR (self));
  clutter_actor_pop_internal (CLUTTER_ACTOR (self));


  priv->label = clutter_text_new ();
  priv->secondary_label = clutter_text_new ();
  clutter_actor_set_opacity (priv->secondary_label, 128);

  clutter_container_add (CLUTTER_CONTAINER (priv->box_layout), priv->label,
                         priv->secondary_label, NULL);

  priv->header_visible = TRUE;

  priv->timeline = clutter_timeline_new (DURATION);
  priv->important_alpha =
    clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_OUT_QUAD);
  g_signal_connect_object (priv->timeline, "new-frame",
                           G_CALLBACK (mex_tile_important_new_frame_cb), self,
                           0);
  g_signal_connect_object (priv->timeline, "completed",
                           G_CALLBACK (mex_tile_timeline_completed_cb), self,
                           0);

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mex_tile_style_changed_cb), NULL);

  g_signal_connect (self, "actor-added",
                    G_CALLBACK (mex_tile_actor_added), NULL);
  g_signal_connect (self, "actor-removed",
                    G_CALLBACK (mex_tile_actor_removed), NULL);
}
コード例 #29
0
ファイル: mx-progress-bar.c プロジェクト: GunioRobot/mx
static void
mx_progress_bar_init (MxProgressBar *self)
{
  MxProgressBarPrivate *priv = self->priv = PROGRESS_BAR_PRIVATE (self);

  priv->fill = g_object_new (MX_TYPE_PROGRESS_BAR_FILL,
                             "clip-to-allocation", TRUE,
                             NULL);
  clutter_actor_set_parent (priv->fill, CLUTTER_ACTOR (self));
}
コード例 #30
0
ファイル: ntf-overlay.c プロジェクト: xclaesse/dawati-shell
static void
ntf_overlay_constructed (GObject *object)
{
    NtfOverlay        *self  = (NtfOverlay*) object;
    NtfOverlayPrivate *priv  = self->priv;
    ClutterActor      *actor = (ClutterActor*) object;
    ClutterColor       low_clr = {0, 0, 0, 0x7f};

    if (G_OBJECT_CLASS (ntf_overlay_parent_class)->constructed)
        G_OBJECT_CLASS (ntf_overlay_parent_class)->constructed (object);

    priv->tray_normal = ntf_tray_new (FALSE);
    clutter_actor_set_parent (CLUTTER_ACTOR (priv->tray_normal), actor);

    priv->tray_urgent = ntf_tray_new (TRUE);
    clutter_actor_set_parent (CLUTTER_ACTOR (priv->tray_urgent), actor);

    priv->lowlight = clutter_rectangle_new_with_color (&low_clr);
    clutter_actor_set_parent (CLUTTER_ACTOR (priv->lowlight), actor);
    mnb_input_manager_push_actor (priv->lowlight, MNB_INPUT_LAYER_TOP);
    clutter_actor_hide (priv->lowlight);

    /*
     * The urgent tray shows/hides itself when it contains something / is empty.
     * We need to show the lowlight any time it is visible.
     */
    g_signal_connect (priv->tray_urgent, "show",
                      G_CALLBACK (ntf_overlay_urgent_tray_show_cb),
                      self);

    g_signal_connect (priv->tray_urgent, "hide",
                      G_CALLBACK (ntf_overlay_urgent_tray_hide_cb),
                      self);

    g_signal_connect (priv->lowlight, "button-press-event",
                      G_CALLBACK (ntf_overlay_lowlight_button_event_cb),
                      self);

    g_signal_connect (priv->lowlight, "button-release-event",
                      G_CALLBACK (ntf_overlay_lowlight_button_event_cb),
                      self);
}