コード例 #1
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);
}
コード例 #2
0
static ClutterActor *
_make_notification_actor (MexNotification *notification)
{
    ClutterActor *box;
    ClutterActor *label, *icon;

    box = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box),
                                   MX_ORIENTATION_HORIZONTAL);

    if (notification->icon)
    {
        icon = mx_icon_new ();
        clutter_actor_set_size (icon, 26, 26);
        mx_icon_set_icon_name (MX_ICON (icon), notification->icon);
        clutter_container_add_actor (CLUTTER_CONTAINER (box), icon);

        mx_box_layout_child_set_y_align (MX_BOX_LAYOUT (box),
                                         icon,
                                         MX_ALIGN_MIDDLE);
    }

    label = mx_label_new_with_text (notification->message);

    mx_label_set_y_align (MX_LABEL (label), MX_ALIGN_MIDDLE);

    clutter_container_add_actor (CLUTTER_CONTAINER (box), label);

    return box;
}
コード例 #3
0
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);
}
コード例 #4
0
ファイル: mpd-disk-tile.c プロジェクト: Cordia/dawati-shell
static void
mpd_disk_tile_init (MpdDiskTile *self)
{
  MpdDiskTilePrivate *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), 5);

  priv->label = mx_label_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->label);
  clutter_text_set_ellipsize (CLUTTER_TEXT (mx_label_get_clutter_text (
                                MX_LABEL (priv->label))), PANGO_ELLIPSIZE_NONE);

  priv->meter = mx_progress_bar_new ();
  clutter_actor_set_height (priv->meter, 12);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->meter);

  /* Display size of the volume $HOME is on. */
  priv->storage = mpd_storage_device_new (g_get_home_dir ());
  g_signal_connect (priv->storage, "notify::size",
                    G_CALLBACK (_storage_size_notify_cb), self);
  g_signal_connect (priv->storage, "notify::available-size",
                    G_CALLBACK (_storage_size_notify_cb), self);
  update (self);
}
コード例 #5
0
ファイル: mex-menu.c プロジェクト: ocrete/media-explorer
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;
}
コード例 #6
0
ファイル: mpd-fs-pane.c プロジェクト: Cordia/dawati-shell
static void
mpd_fs_pane_init (MpdFsPane *self)
{
  ClutterActor  *tile;

  self->priv = FS_PANEL_PRIVATE (self);

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL);
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), 21);
  clutter_actor_set_width (CLUTTER_ACTOR (self), MPD_PANE_WIDTH);

  tile = mpd_disk_tile_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (self), tile);

  tile = mpd_folder_tile_new ();
  clutter_actor_set_width (tile,  MPD_FOLDER_TILE_WIDTH);
  g_signal_connect (tile, "request-hide",
                    G_CALLBACK (_tile_request_hide_cb), self);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), tile);
  clutter_container_child_set (CLUTTER_CONTAINER (self), tile,
                               "expand", TRUE,
                               "x-fill", TRUE,
                               "y-fill", TRUE,
                               NULL);
}
コード例 #7
0
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);
}
コード例 #8
0
static void
mpd_devices_tile_init (MpdDevicesTile *self)
{
  MpdDevicesTilePrivate *priv = GET_PRIVATE (self);
  ClutterActor  *tile;
  GList *mounts;

  priv->tiles = g_hash_table_new (g_direct_hash, g_direct_equal);

  priv->vbox = mx_box_layout_new ();
  mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->vbox),
                                       TRUE);
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->vbox),
                                 MX_ORIENTATION_VERTICAL);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->vbox);

  tile = mpd_default_device_tile_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->vbox), tile);

  priv->monitor = g_volume_monitor_get ();
  g_signal_connect (priv->monitor, "mount-added",
                    G_CALLBACK (_monitor_mount_added_cb), self);
  g_signal_connect (priv->monitor, "mount-changed",
                    G_CALLBACK (_monitor_mount_changed_cb), self);
  g_signal_connect (priv->monitor, "mount-removed",
                    G_CALLBACK (_monitor_mount_removed_cb), self);

  mounts = g_volume_monitor_get_mounts (priv->monitor);
  g_list_foreach (mounts, (GFunc) _add_mount_cb, self);
  g_list_free (mounts);
}
コード例 #9
0
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);
}
コード例 #10
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);
}
コード例 #11
0
ファイル: test-path-bar.c プロジェクト: GunioRobot/mx
int
main (int argc, char **argv)
{
  MxWindow *window;
  MxApplication *app;
  ClutterActor *stage, *bar, *button, *hbox;

  app = mx_application_new (&argc, &argv, "Test PathBar", 0);

  window = mx_application_create_window (app);
  stage = (ClutterActor *)mx_window_get_clutter_stage (window);

  bar = mx_path_bar_new ();
  mx_path_bar_set_clear_on_change (MX_PATH_BAR (bar), TRUE);

  hbox = mx_box_layout_new ();

  button = mx_button_new_with_label ("Add crumb");
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (add_cb), bar);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button);

  button = mx_button_new_with_label ("Remove crumb");
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (remove_cb), bar);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button);

  button = mx_button_new_with_label ("Toggle editable");
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (toggle_editable_cb), bar);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button);

  button = mx_button_new_with_label ("Re-label first crumb");
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (relabel_cb), bar);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button);

  /* -a for 'alternative packing'... */
  if (argc > 1 && g_str_equal (argv[1], "-a"))
    {
      ClutterActor *vbox = mx_box_layout_new ();
      mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL);
      clutter_container_add_actor (CLUTTER_CONTAINER (vbox), bar);
      clutter_container_add_actor (CLUTTER_CONTAINER (vbox), hbox);
      mx_window_set_child (window, vbox);
      mx_path_bar_set_editable (MX_PATH_BAR (bar), TRUE);
    }
  else
    {
      MxToolbar *toolbar = mx_window_get_toolbar (window);
      clutter_container_add_actor (CLUTTER_CONTAINER (toolbar), bar);
      mx_window_set_child (window, hbox);
    }

  clutter_actor_show (stage);

  mx_application_run (app);

  return 0;
}
コード例 #12
0
static void
penge_email_pane_init (PengeEmailPane *self)
{
  PengeEmailPanePrivate *priv = GET_PRIVATE_REAL (self);

  self->priv = priv;

  priv->account_to_widget = g_hash_table_new (NULL, NULL);
  priv->provider = g_object_new (MAILME_TYPE_TELEPATHY, NULL);
  priv->vertical = FALSE;

  mailme_telepathy_prepare_async (priv->provider,
                                  _tp_provider_prepared,
                                  self);

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (self),
                                 MX_ORIENTATION_VERTICAL);

  g_signal_connect (G_OBJECT (priv->provider),
                    "account-added",
                    G_CALLBACK (_account_added_cb),
                    self);

  g_signal_connect (G_OBJECT (priv->provider),
                    "account-removed",
                    G_CALLBACK (_account_removed_cb),
                    self);
}
コード例 #13
0
int
main (int argc, char **argv)
{
  const ClutterColor dark_gray = { 0x40, 0x40, 0x40, 0xff };

  ClutterActor *box, *stage;
  MxApplication *app;
  MxWindow *window;

  mex_init (&argc, &argv);
  app = mx_application_new (&argc, &argv, "test-mex-expander-box", 0);
  clutter_init (&argc, &argv);

  mex_style_load_default ();

  window = mx_application_create_window (app);
  stage = (ClutterActor *)mx_window_get_clutter_stage (window);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &dark_gray);

  box = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL);

  add_pictures (box);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  mx_window_set_has_toolbar (window, FALSE);
  clutter_actor_set_size (stage, 640, 480);
  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
コード例 #14
0
ファイル: mx-list-view.c プロジェクト: ManMower/mx
static void
mx_list_view_init (MxListView *list_view)
{
  list_view->priv = LIST_VIEW_PRIVATE (list_view);

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (list_view), MX_ORIENTATION_VERTICAL);
}
コード例 #15
0
ファイル: test-focus.c プロジェクト: danni/mx
int
main (int argc, char *argv[])
{
  ClutterActor *button, *box, *stage;
  MxApplication *application;
  MxWindow *window;

  application = mx_application_new (&argc, &argv, "Test Mx focus handling",
                                    MX_APPLICATION_SINGLE_INSTANCE);

  window = mx_application_create_window (application);
  stage = (ClutterActor *)mx_window_get_clutter_stage (window);

  box = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL);
  mx_window_set_child (window, box);

  button = mx_button_new_with_label ("button #1 (activate to remove)");
  g_signal_connect (button, "clicked",
                    G_CALLBACK (button_clicked_cb), NULL);
  mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1);

  mx_focus_manager_push_focus (mx_focus_manager_get_for_stage (CLUTTER_STAGE (stage)),
                               MX_FOCUSABLE (button));


  button = mx_button_new_with_label ("button #2 (activate to remove)");
  g_signal_connect (button, "clicked",
                    G_CALLBACK (button_clicked_cb), NULL);
  mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1);

  button = mx_button_new_with_label ("button #3 (activate to remove)");
  g_signal_connect (button, "clicked",
                    G_CALLBACK (button_clicked_cb), NULL);
  mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1);

  button = mx_button_new_with_label ("button #4 (activate to remove)");
  g_signal_connect (button, "clicked",
                    G_CALLBACK (button_clicked_cb), NULL);
  mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1);

  clutter_actor_show (stage);

  mx_application_run (application);

  return EXIT_SUCCESS;
}
コード例 #16
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);
}
コード例 #17
0
static void
mex_content_box_init (MexContentBox *self)
{
  MexContentBoxPrivate *priv = self->priv = CONTENT_BOX_PRIVATE (self);
  ClutterActor *hline, *box;

  priv->thumb_width = 426;
  priv->thumb_height = 240;

  /* Create description panel */
  box = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL);

  hline = clutter_rectangle_new_with_color (&hline_color);
  clutter_actor_set_height (hline, 1);

  priv->panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_SIMPLE);

  clutter_container_add (CLUTTER_CONTAINER (box), hline, priv->panel, NULL);


  /* monitor key press events */
  g_signal_connect (self, "key-press-event",
                    G_CALLBACK (mex_content_box_key_press_event_cb), self);

  /* Create tile */
  priv->tile = mex_content_tile_new ();
  g_object_set (G_OBJECT (priv->tile),
                "thumb-width", priv->thumb_width,
                "thumb-height", priv->thumb_height,
                NULL);
  mx_bin_set_fill (MX_BIN (priv->tile), TRUE, TRUE);

  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 secondary box for tile/menu */
  priv->box = mex_expander_box_new ();
  mex_expander_box_set_important (MEX_EXPANDER_BOX (priv->box), TRUE);
  mex_expander_box_set_grow_direction (MEX_EXPANDER_BOX (priv->box),
                                      MEX_EXPANDER_BOX_RIGHT);
  mex_expander_box_set_primary_child (MEX_EXPANDER_BOX (priv->box), priv->tile);

  /* Pack box and panel into self */
  mex_expander_box_set_primary_child (MEX_EXPANDER_BOX (self), priv->box);
  mex_expander_box_set_secondary_child (MEX_EXPANDER_BOX (self), box);

  /* Create the action list */
  priv->action_list = mex_action_list_new ();
  mex_expander_box_set_secondary_child (MEX_EXPANDER_BOX (priv->box),
                                        priv->action_list);

  /* Connect to the open notify signal */
  g_signal_connect (self, "notify::open",
                    G_CALLBACK (mex_content_box_notify_open_cb), NULL);
}
コード例 #18
0
static void
mpd_volume_tile_init (MpdVolumeTile *self)
{
  MpdVolumeTilePrivate *priv = GET_PRIVATE (self);
  ClutterActor  *icon;

  /* Layout */
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), MPD_TILE_ICON_SPACING);

  icon = mx_icon_new ();
  clutter_actor_set_name (icon, "volume-off");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           icon,
                                           -1,
                                           "y-fill", FALSE,
                                           NULL);

  priv->volume_slider = mx_slider_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           priv->volume_slider,
                                           -1,
                                           "expand", TRUE,
                                           NULL);
  g_signal_connect (priv->volume_slider, "notify::value",
                    G_CALLBACK (_volume_slider_value_notify_cb), self);

  icon = mx_icon_new ();
  clutter_actor_set_name (icon, "volume-on");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           icon,
                                           -1,
                                           "y-fill", FALSE,
                                           NULL);

  /* Control */
  priv->control = gvc_mixer_control_new (MIXER_CONTROL_NAME);
  g_signal_connect (priv->control, "default-sink-changed",
                    G_CALLBACK (_mixer_control_default_sink_changed_cb), self);
  g_signal_connect (priv->control, "ready",
                    G_CALLBACK (_mixer_control_ready_cb), self);
  gvc_mixer_control_open (priv->control);
}
コード例 #19
0
static ClutterActor *
create_controls (RBShell *shell)
{
    RBShellPlayer *player;
    ClutterActor *box;
    ClutterActor *button;
    int pos;
    gboolean playing;

    g_object_get (shell, "shell-player", &player, NULL);

    box = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 16);
    mx_stylable_set_style_class (MX_STYLABLE (box), "ControlsBox");
    mx_stylable_set_style (MX_STYLABLE (box), style);
    clutter_actor_set_reactive (box, TRUE);

    /* XXX rtl? */
    pos = 0;
    button = create_button ("PrevButton", "PrevButtonIcon", "media-skip-backward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (prev_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("PlayPauseButton", "PlayPauseButtonIcon", "media-playback-start");
    g_signal_connect_object (button, "clicked", G_CALLBACK (playpause_clicked_cb), player, 0);
    g_signal_connect_object (player, "playing-changed", G_CALLBACK (playing_changed_cb), button, 0);
    g_object_get (player, "playing", &playing, NULL);
    update_playing (MX_BUTTON (button), playing);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("NextButton", "NextButtonIcon", "media-skip-forward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (next_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    g_object_unref (player);
    return box;
}
コード例 #20
0
ファイル: dawati-bt-shell.c プロジェクト: Cordia/dawati-shell
static void
dawati_bt_shell_add_request (DawatiBtShell *shell,
                             const char *name,
                             const char *device_path,
                             DawatiBtRequestType type,
                             const char *data)
{
  DawatiBtShellPrivate *priv = GET_PRIVATE (shell);
  ClutterActor *w;

  w = dawati_bt_request_new (name, device_path, type, data);
  g_signal_connect (w, "response",
                    G_CALLBACK (_request_response_cb), shell);
  mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->request_box), w, -1);
  g_hash_table_insert (priv->requests, g_strdup (device_path), w);
}
コード例 #21
0
ファイル: dawati-bt-shell.c プロジェクト: Cordia/dawati-shell
static ClutterActor*
dawati_bt_shell_add_device (DawatiBtShell *shell, const char *name, const char *device_path)
{
  DawatiBtShellPrivate *priv = GET_PRIVATE (shell);
  ClutterActor *w;

  w = dawati_bt_device_new (name, device_path);
  if (g_hash_table_size (priv->devices) == 0)
    mx_stylable_set_style_pseudo_class (MX_STYLABLE (w), "first-child");
  g_signal_connect (w, "disconnect",
                    G_CALLBACK (_device_widget_disconnect_cb), shell);

  mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->device_box), w, -1);
  g_hash_table_insert (priv->devices, g_strdup (device_path), w);

  return w;
}
コード例 #22
0
void
mpd_storage_device_tile_show_message_full (MpdStorageDeviceTile  *self,
                                           char const            *message,
                                           bool                   replace_buttons,
                                           unsigned int           timeout_s,
                                           GSourceFunc            function,
                                           void                  *data)
{
  MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self);

  g_return_if_fail (MPD_IS_STORAGE_DEVICE_TILE (self));

  if (priv->message == NULL)
  {
    ClutterText *text;
    priv->message = mx_label_new_with_text (message);
    mx_stylable_set_style_class (MX_STYLABLE (priv->message), "message");
    text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->message));
    clutter_text_set_line_wrap (text, true);
    clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD);
    clutter_text_set_single_line_mode (text, false);
    clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_NONE);
    mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->message,
                                             2,
                                             "x-align", MX_ALIGN_MIDDLE,
                                             NULL);
  }

  if (replace_buttons)
  {
    mx_widget_set_disabled (MX_WIDGET (priv->open), true);
    mx_widget_set_disabled (MX_WIDGET (priv->eject), true);
    clutter_container_remove_actor (CLUTTER_CONTAINER (self), priv->import);
  }

  mx_label_set_text (MX_LABEL (priv->message), message);

  if (timeout_s)
  {
    g_timeout_add_seconds (timeout_s, function, data);
  }
}
コード例 #23
0
ファイル: mx-button.c プロジェクト: danni/mx
static void
mx_button_init (MxButton *button)
{
  MxButtonPrivate *priv;

  priv = button->priv = MX_BUTTON_GET_PRIVATE (button);

  clutter_actor_set_reactive ((ClutterActor *) button, TRUE);

  g_signal_connect (button, "style-changed",
                    G_CALLBACK (mx_button_style_changed), NULL);

  priv->icon_visible = TRUE;
  priv->label_visible = TRUE;
  priv->icon_position = MX_POSITION_LEFT;

  /* take an extra reference to the hbox */
  priv->hbox = g_object_ref (mx_box_layout_new ());
  mx_bin_set_child (MX_BIN (button), priv->hbox);

  priv->icon = mx_icon_new ();
  priv->label = g_object_new (CLUTTER_TYPE_TEXT,
                              "line-alignment", PANGO_ALIGN_CENTER,
                              "ellipsize", PANGO_ELLIPSIZE_END,
                              NULL);

  clutter_actor_add_child (priv->hbox, priv->icon);
  clutter_actor_add_child (priv->hbox, priv->label);

  mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->hbox),
                                  priv->label, TRUE);
  mx_box_layout_child_set_y_fill (MX_BOX_LAYOUT (priv->hbox),
                                  priv->label, FALSE);
  mx_box_layout_child_set_x_fill (MX_BOX_LAYOUT (priv->hbox),
                                  priv->label, FALSE);

  mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->hbox),
                                  priv->icon, TRUE);
  mx_box_layout_child_set_y_fill (MX_BOX_LAYOUT (priv->hbox),
                                  priv->icon, FALSE);
  mx_box_layout_child_set_x_fill (MX_BOX_LAYOUT (priv->hbox),
                                  priv->icon, FALSE);

  mx_button_update_contents (button);
}
コード例 #24
0
static void
mpd_devices_pane_init (MpdDevicesPane *self)
{
  ClutterActor  *label;
  ClutterActor  *tile;

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL);
  clutter_actor_set_width (CLUTTER_ACTOR (self), MPD_DEVICES_PANE_WIDTH);

  label = mx_label_new_with_text (_("Other devices"));
  clutter_actor_set_name (label, "pane-label");
  clutter_container_add_actor (CLUTTER_CONTAINER (self), label);

  tile = mpd_devices_tile_new ();
  g_signal_connect (tile, "request-hide",
                    G_CALLBACK (_tile_request_hide_cb), self);
  g_signal_connect (tile, "request-show",
                    G_CALLBACK (_tile_request_show_cb), self);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), tile);
  clutter_container_child_set (CLUTTER_CONTAINER (self), tile,
                               "expand", true,
                               NULL);
}
コード例 #25
0
static void
mpd_folder_button_init (MpdFolderButton *self)
{
  MpdFolderButtonPrivate *priv = GET_PRIVATE (self);
  ClutterActor  *vbox;
  ClutterText   *text;

  /* Box */
  vbox = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL);
  mx_bin_set_child (MX_BIN (self), vbox);

  /* Icon */
  priv->icon = clutter_texture_new ();
  clutter_texture_set_sync_size (CLUTTER_TEXTURE (priv->icon), true);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->icon);
  clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->icon,
                               "expand", false,
                               "x-align", MX_ALIGN_MIDDLE,
                               "x-fill", false,
                               "y-align", MX_ALIGN_START,
                               "y-fill", false,
                               NULL);

  /* Label */
  priv->label = mx_label_new ();
  text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label));
  clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD_CHAR);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), priv->label);
  clutter_container_child_set (CLUTTER_CONTAINER (vbox), priv->label,
                               "expand", false,
                               "x-align", MX_ALIGN_MIDDLE,
                               "x-fill", false,
                               "y-align", MX_ALIGN_START,
                               "y-fill", false,
                               NULL);
}
コード例 #26
0
ファイル: mx-button.c プロジェクト: danni/mx
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;
    }
}
コード例 #27
0
static void
mex_telepathy_channel_create_toolbar (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  gchar *static_image_path;
  ClutterActor *toolbar;

  MxAction *end_action;
  MxAction *camera_action;
  MxAction *mute_action;
  GError *error = NULL;

  // Create the user label
  priv->avatar_image = mx_image_new ();
  static_image_path = g_build_filename (mex_get_data_dir (),
                                        "style",
                                        "thumb-call-avatar-small.png",
                                        NULL);
  mx_image_set_from_file (MX_IMAGE (priv->avatar_image),
                          static_image_path,
                          &error);

  if (error)
  {
    g_warning ("Error loading texture %s", error->message);
    g_clear_error (&error);
  }

  if (static_image_path)
    g_free (static_image_path);

  priv->title_label = mx_label_new ();
  mx_label_set_y_align (MX_LABEL (priv->title_label), MX_ALIGN_MIDDLE);
  mx_label_set_x_align (MX_LABEL (priv->title_label), MX_ALIGN_MIDDLE);

  end_action =
    mx_action_new_full ("End",
                        "Hang Up",
                        G_CALLBACK (mex_telepathy_channel_on_hangup),
                        self);

  priv->end_button = mex_action_button_new (end_action);
  mx_stylable_set_style_class (MX_STYLABLE (priv->end_button), "EndCall");

  camera_action =
    mx_action_new_full("Camera",
                       "Camera Off",
                       G_CALLBACK (mex_telepathy_channel_toggle_camera),
                       self);

  priv->camera_button = mex_action_button_new (camera_action);
  /* off by default */
  mex_telepathy_channel_set_camera_state (self, FALSE);

  mute_action =
    mx_action_new_full("Mute",
                       "Mic Off",
                       G_CALLBACK (mex_telepathy_channel_toggle_mute),
                       self);

  priv->mute_button = mex_action_button_new (mute_action);
  mx_stylable_set_style_class (MX_STYLABLE (priv->mute_button), "MediaMute");

  toolbar = mx_box_layout_new ();
  clutter_actor_set_width (toolbar, 980);
  clutter_actor_set_height (toolbar, 48);
  mx_stylable_set_style_class (MX_STYLABLE (toolbar),
                               "MexCallControlsTitle");
  // Put the buttons in the toolbar
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar),
                                           priv->avatar_image,
                                           0,
                                           "expand",
                                           FALSE,
                                           "x-align",
                                           MX_ALIGN_END,
                                           "x-fill",
                                           FALSE,
                                           NULL);

  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar),
                                           priv->title_label,
                                           1,
                                           "expand",
                                           TRUE,
                                           NULL);

  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar),
                                           priv->camera_button,
                                           2,
                                           "expand",
                                           TRUE,
                                           NULL);

  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar),
                                           priv->mute_button,
                                           3,
                                           "expand",
                                           TRUE,
                                           NULL);

  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (toolbar),
                                           priv->end_button,
                                           4,
                                           "expand",
                                           TRUE,
                                           NULL);

  priv->toolbar_area = mx_frame_new ();
  mx_bin_set_child (MX_BIN (priv->toolbar_area), toolbar);
  mx_stylable_set_style_class (MX_STYLABLE (priv->toolbar_area),
                               "ToolbarArea");
}
コード例 #28
0
ファイル: mex-menu.c プロジェクト: ocrete/media-explorer
MxBoxLayout *
mex_menu_get_layout (MexMenu *menu)
{
  g_return_val_if_fail (MEX_IS_MENU (menu), NULL);
  return MX_BOX_LAYOUT (menu->priv->layout);
}
コード例 #29
0
ファイル: mex-menu.c プロジェクト: ocrete/media-explorer
static ClutterActor *
mex_menu_item_new (MexMenu *self, MxAction *action, MexMenuActionType type)
{
  ClutterActor *button, *layout, *icon, *vbox, *label, *arrow = NULL;

  button = mx_button_new ();
  mx_button_set_is_toggle (MX_BUTTON (button), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (button), "Item");

  layout = mx_box_layout_new ();
  mx_bin_set_child (MX_BIN (button), layout);
  mx_bin_set_fill (MX_BIN (button), TRUE, FALSE);

  if (type == MEX_MENU_LEFT)
    {
      arrow = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (arrow), "Left");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow);

    }

  vbox = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL);

  label = mx_label_new ();
  mx_label_set_fade_out (MX_LABEL (label), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (label), "Action");
  g_object_bind_property (action, "display-name", label, "text",
                          G_BINDING_SYNC_CREATE);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label);

  label = mx_label_new ();
  mx_label_set_fade_out (MX_LABEL (label), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (label), "Detail");
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label);
  clutter_actor_hide (label);
  g_object_set_data (G_OBJECT (button), "detail-label", label);

  clutter_container_add_actor (CLUTTER_CONTAINER (layout), vbox);
  clutter_container_child_set (CLUTTER_CONTAINER (layout), vbox,
                               "expand", TRUE,
                               "x-fill", FALSE,
                               "x-align", MX_ALIGN_START,
                               "y-fill", FALSE,
                               NULL);

  icon = mx_icon_new ();
  g_object_bind_property (action, "icon", icon, "icon-name",
                          G_BINDING_SYNC_CREATE);
  clutter_container_add_actor (CLUTTER_CONTAINER (layout), icon);

  if (type == MEX_MENU_RIGHT)
    {
      arrow = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (arrow), "Right");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow);
    }
  else if (type == MEX_MENU_TOGGLE)
    {
      ClutterActor *toggle = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (toggle), "Toggle");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), toggle);
      g_object_set_data (G_OBJECT (button), "toggle-icon", toggle);
    }

  if (arrow)
    clutter_container_child_set (CLUTTER_CONTAINER (layout),
                                 arrow,
                                 "expand", FALSE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 "y-fill", FALSE,
                                 NULL);

  g_signal_connect (button, "clicked",
                    G_CALLBACK (mex_menu_item_clicked_cb), action);

  g_object_weak_ref (G_OBJECT (button),
                     (GWeakNotify)mex_menu_item_destroyed_cb,
                     self);

  /* Set the item qdata on the button to mark that we created it */
  g_object_set_qdata (G_OBJECT (button), mex_menu_item_quark,
                      GINT_TO_POINTER (TRUE));

  return button;
}
コード例 #30
0
static void
dawati_bt_request_init (DawatiBtRequest *request)
{
  ClutterActor *title_box, *close_btn, *btn_box;
  DawatiBtRequestPrivate *priv = GET_PRIVATE (request);

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (request),
                                 MX_ORIENTATION_VERTICAL);
  mx_stylable_set_style_class (MX_STYLABLE (request), "BtRequest");

  priv->request = DAWATI_BT_REQUEST_TYPE_PIN;

  /* FIXME: this should maybe not be instance-specific */
  priv->uuid_strings = _new_uiid_strings ();

  title_box = mx_box_layout_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), title_box, -1,
                                           "expand", TRUE,
                                           "x-fill", TRUE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  priv->title = mx_label_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->title), "BtTitle");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (title_box), priv->title, -1,
                                           "expand", TRUE,
                                           "x-fill", TRUE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  close_btn = mx_button_new ();
  mx_stylable_set_style_class (MX_STYLABLE (close_btn), "BtCloseButton");
  mx_bin_set_child (MX_BIN (close_btn), mx_icon_new ());
  mx_box_layout_add_actor (MX_BOX_LAYOUT (title_box), close_btn, -1);
  g_signal_connect (close_btn, "clicked",
                    G_CALLBACK (_close_clicked_cb), request);


  priv->request_label = mx_label_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->request_label), "BtLabel");
  mx_label_set_line_wrap (MX_LABEL (priv->request_label), TRUE);
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), priv->request_label, -1,
                                           "expand", TRUE,
                                           "x-fill", FALSE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  btn_box = mx_box_layout_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), btn_box, -1,
                                           "expand", TRUE,
                                           "x-fill", FALSE,
                                           "x-align", MX_ALIGN_END,
                                           NULL);

  priv->request_entry = mx_entry_new ();
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_entry, -1);

  priv->request_always_btn = mx_button_new ();
  /* TRANSLATORS: request button label */
  mx_button_set_label (MX_BUTTON (priv->request_always_btn),
                       _("Always grant"));
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_always_btn, -1);
  g_signal_connect (priv->request_always_btn, "clicked",
                    G_CALLBACK (_always_clicked_cb), request);

  priv->request_yes_btn = mx_button_new ();
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_yes_btn, -1);
  g_signal_connect (priv->request_yes_btn, "clicked",
                    G_CALLBACK (_yes_clicked_cb), request);
}