Пример #1
0
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);
}
Пример #2
0
static void
mex_queue_button_init (MexQueueButton *self)
{
  ClutterActor *temp_text;

  self->priv = QUEUE_BUTTON_PRIVATE (self);

  self->priv->inner_box = mx_box_layout_new ();
  self->priv->icon = mx_icon_new ();
  self->priv->label = mx_label_new_with_text ("Unknown queue state");
  self->priv->spinner = mx_spinner_new ();
  self->priv->queue_model = mex_queue_model_dup_singleton ();

  g_signal_connect (self->priv->spinner,
                    "looped",
                    (GCallback)_spinner_looped_cb,
                    self);

  clutter_container_add (CLUTTER_CONTAINER (self->priv->inner_box),
                         self->priv->label,
                         self->priv->icon,
                         self->priv->spinner,
                         NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->label,
                               "expand", TRUE,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->icon,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               "x-align", MX_ALIGN_END,
                               NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->spinner,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               "x-align", MX_ALIGN_END,
                               NULL);

  clutter_actor_hide (self->priv->spinner);

  mx_bin_set_child (MX_BIN (self), self->priv->inner_box);
  mx_bin_set_fill (MX_BIN (self), TRUE, FALSE);

  temp_text = mx_label_get_clutter_text (MX_LABEL (self->priv->label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (temp_text), PANGO_ELLIPSIZE_NONE);

  g_signal_connect (self,
                    "notify::toggled",
                    (GCallback)_queue_button_notify_toggled_cb,
                    self);

  mx_button_set_is_toggle (MX_BUTTON (self), TRUE);
}
Пример #3
0
static void
mnb_launcher_button_init (MnbLauncherButton *self)
{
  ClutterActor *label;

  self->priv = MNB_LAUNCHER_BUTTON_GET_PRIVATE (self);

  g_signal_connect (self, "leave-event",
                    G_CALLBACK (_leave_event_cb), NULL);
  g_signal_connect (self, "key-focus-out",
                    G_CALLBACK (_leave_event_cb), NULL);
  g_signal_connect (self, "enter-event",
                    G_CALLBACK (_enter_event_cb), NULL);

  self->priv->icon = NULL;

  mx_stylable_set_style_class (MX_STYLABLE (self), "contentTile");

  /* "app" label */
  self->priv->title = (MxLabel *) mx_label_new ();
  mx_label_set_x_align (MX_LABEL (self->priv->title), MX_ALIGN_MIDDLE);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->title), FALSE);
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (self->priv->title),
                                         1, 0,
                                         "x-align", MX_ALIGN_MIDDLE,
                                         "x-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-align", MX_ALIGN_MIDDLE,
                                         "y-expand", TRUE,
                                         "y-fill", TRUE,
                                         NULL);

  label = mx_label_get_clutter_text (self->priv->title);
  clutter_text_set_ellipsize (CLUTTER_TEXT (label), PANGO_ELLIPSIZE_END);
  clutter_text_set_line_alignment (CLUTTER_TEXT (label), PANGO_ALIGN_CENTER);
  clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (label), PANGO_WRAP_WORD_CHAR);

  /* "fav app" toggle */
  self->priv->fav_toggle = g_object_ref_sink (CLUTTER_ACTOR (mx_button_new ()));
  mx_button_set_is_toggle (MX_BUTTON (self->priv->fav_toggle), TRUE);
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fav_toggle),
                          "mnb-launcher-button-fav-toggle");
  clutter_actor_set_size (self->priv->fav_toggle, FAV_TOGGLE_SIZE, FAV_TOGGLE_SIZE);
  mx_table_insert_actor (MX_TABLE (self),
                         CLUTTER_ACTOR (self->priv->fav_toggle),
                         0, 0);


  g_signal_connect (self->priv->fav_toggle, "notify::toggled",
                    G_CALLBACK (fav_button_notify_toggled_cb), self);

  clutter_actor_set_reactive ((ClutterActor *) self, TRUE);
}
static void
update_track_info (MxLabel *label, RhythmDB *db, RhythmDBEntry *entry, const char *streaming_title)
{
    const char *title;
    ClutterActor *text;
    GString *str;

    text = mx_label_get_clutter_text (label);

    str = g_string_sized_new (100);
    if (entry == NULL) {
        g_string_append_printf (str, "<big>%s</big>", _("Not Playing"));
    } else {
        title = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);

        if (streaming_title) {
            str_append_printf_escaped (str, "<big>%s</big>\n", streaming_title);
            str_append_printf_escaped (str, _("from <i>%s</i>"), title);
        } else {
            const char *artist_template = NULL;
            const char *album_template = NULL;
            const char *artist;
            const char *album;
            gboolean space = FALSE;

            artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
            album = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
            get_artist_album_templates (artist, album, &artist_template, &album_template);

            str_append_printf_escaped (str, "<big>%s</big>\n", title);

            if (album != NULL && album[0] != '\0') {
                str_append_printf_escaped (str, album_template, album);
                space = TRUE;
            }
            if (artist != NULL && artist[0] != '\0') {
                if (space) {
                    g_string_append_c (str, ' ');
                }
                str_append_printf_escaped (str, artist_template, artist);
            }
        }
    }

    /* tiny bit of extra padding */
    g_string_append (str, "  ");
    clutter_text_set_markup (CLUTTER_TEXT (text), str->str);
    clutter_text_set_ellipsize (CLUTTER_TEXT (text), PANGO_ELLIPSIZE_NONE);
    g_string_free (str, TRUE);
}
Пример #5
0
static ClutterActor *
create_label (const ClutterColor *color,
              const gchar        *text)
{
  ClutterActor *retval = clutter_text_new ();

  clutter_text_set_color (CLUTTER_TEXT (retval), color);
  clutter_text_set_markup (CLUTTER_TEXT (retval), text);
  clutter_text_set_editable (CLUTTER_TEXT (retval), FALSE);
  clutter_text_set_selectable (CLUTTER_TEXT (retval), FALSE);
  clutter_text_set_single_line_mode (CLUTTER_TEXT (retval), TRUE);
  clutter_text_set_ellipsize (CLUTTER_TEXT (retval), PANGO_ELLIPSIZE_END);

  return retval;
}
Пример #6
0
static ClutterActor *
_make_offline_banner (MnbPeoplePanel *pane,
                      gint            width)
{
  ClutterActor *tile;
  ClutterActor *tmp_text;
  ClutterActor *label, *bin;

  tile = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (tile), 8);

  clutter_actor_set_width (tile, width);
  clutter_actor_set_name (tile,
                          "people-pane-you-offline-banner");
  label = mx_label_new_with_text (_("To see your IM contacts, "
                                    "you need to go online."));
  clutter_actor_set_name (label,
                          "people-pane-you-offline-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text),
                                   PANGO_WRAP_WORD_CHAR);
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                              PANGO_ELLIPSIZE_NONE);

  bin = mx_frame_new ();
  mx_bin_set_child (MX_BIN (bin), (label));
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE);
  clutter_actor_set_name (bin,
                          "people-pane-you-offline-bin");

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         (ClutterActor *)bin,
                                         0,
                                         0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  return tile;
}
Пример #7
0
static ClutterActor *
_make_everybody_offline_tile (MnbPeoplePanel *pane)
{
  ClutterActor *tile;
  ClutterActor *label, *bin;
  ClutterActor *tmp_text;

  tile = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (tile), 8);

  clutter_actor_set_name ((ClutterActor *)tile,
                          "people-pane-everybody-offline-tile");
  label = mx_label_new_with_text (_("Sorry, we can't find any people. " \
                                    "It looks like they are all offline."));
  clutter_actor_set_name ((ClutterActor *)label,
                          "people-pane-everybody-offline-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text),
                                   PANGO_WRAP_WORD_CHAR);
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                              PANGO_ELLIPSIZE_NONE);

  bin = mx_frame_new ();
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE);
  clutter_actor_set_name (bin,
                          "people-pane-everybody-offline-bin");

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         (ClutterActor *)bin,
                                         0,
                                         0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  return tile;
}
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);
  }
}
/**
 * mx_label_set_fade_out:
 * @label: A #MxLabel
 * @fade: %TRUE to fade out, %FALSE otherwise
 *
 * Set whether to fade out the end of the label, instead of ellipsizing.
 * Enabling this mode will also set the #ClutterText:single-line-mode and
 * #ClutterText:ellipsize properties.
 *
 * Since: 1.2
 */
void
mx_label_set_fade_out (MxLabel  *label,
                       gboolean  fade)
{
  MxLabelPrivate *priv;

  g_return_if_fail (MX_IS_LABEL (label));

  priv = label->priv;
  if (priv->fade_out != fade)
    {
      priv->fade_out = fade;
      g_object_notify (G_OBJECT (label), "fade-out");

      /* Enable the fade-effect */
      if (fade)
        {
          priv->label_should_fade = FALSE;
          clutter_text_set_single_line_mode (CLUTTER_TEXT (priv->label), TRUE);
          clutter_text_set_ellipsize (CLUTTER_TEXT (priv->label),
                                      PANGO_ELLIPSIZE_NONE);
        }

      /* If we need to fade, listen for the font-description changing so
       * we can keep track of the em-width of the label.
       */
      if (fade)
        {
          g_signal_connect (priv->label, "notify::font-description",
                            G_CALLBACK (mx_label_font_description_cb), label);
          mx_label_font_description_cb (CLUTTER_TEXT (priv->label),
                                        NULL, label);
        }
      else
        {
          g_signal_handlers_disconnect_by_func (priv->label,
                                                mx_label_font_description_cb,
                                                label);
        }
    }
}
Пример #10
0
static void _add_app(MetaSwitcher* self, MetaWindow* app, gint* x, gint* y)
{
    MetaSwitcherPrivate* priv = self->priv;

    if (!priv->icons)
        priv->icons = g_hash_table_new(NULL, NULL);

    // container
    ClutterActor* actor = clutter_actor_new();
    WindowPrivate* win_priv = get_window_private(actor);
    win_priv->window = app;
    win_priv->highlight = FALSE;
    g_hash_table_insert(priv->icons, app, actor);

    gint w = APP_ACTOR_WIDTH, h = APP_ACTOR_HEIGHT, screen_width, screen_height;
    /* TODO: @sonald scale app actor width */
    MetaScreen *screen = meta_plugin_get_screen(priv->plugin);
    meta_screen_get_size(screen, &screen_width, &screen_height);
    if (priv->apps->len)
        w = (screen_width - priv->apps->len * APP_ICON_PADDING) / priv->apps->len;

    if (w > APP_ACTOR_WIDTH)
        w = APP_ACTOR_WIDTH;

    // add children
    ClutterContent* canvas = clutter_canvas_new();
    g_signal_connect(canvas, "draw", G_CALLBACK(on_icon_background_draw), actor);
    clutter_canvas_set_size(CLUTTER_CANVAS(canvas), w, h);

    ClutterActor* bg = clutter_actor_new();
    clutter_actor_set_name(bg, "bg");
    clutter_actor_set_content(bg, canvas);
    g_object_unref(canvas);

    clutter_actor_set_size(bg, w, h);
    g_object_set(bg, "x-expand", TRUE, "y-expand", TRUE, "x-align", CLUTTER_ACTOR_ALIGN_FILL,
            "y-align", CLUTTER_ACTOR_ALIGN_FILL, NULL);
    clutter_actor_add_child(actor, bg);

    ClutterActor* icon = load_icon_for_window(self, app);
    if (icon) clutter_actor_add_child(actor, icon);

    ClutterActor* label = clutter_text_new();
    clutter_actor_add_child(actor, label);
    clutter_text_set_text(CLUTTER_TEXT(label), meta_window_get_title(app));
    clutter_text_set_font_name(CLUTTER_TEXT(label), "Sans 10");
    ClutterColor clr = {0xff, 0xff, 0xff, 0xff};
    clutter_text_set_color(CLUTTER_TEXT(label), &clr);
    clutter_text_set_ellipsize(CLUTTER_TEXT(label), PANGO_ELLIPSIZE_END);
    g_object_set(label, "x-align", CLUTTER_ACTOR_ALIGN_CENTER, "y-align", CLUTTER_ACTOR_ALIGN_CENTER, NULL);

    gfloat pref_width = clutter_actor_get_width(label);
    if (pref_width > w - 10) {
        pref_width = w - 10;
        clutter_actor_set_width(label, pref_width);
    }
    /* TODO: @sonald adjust app title position */
    clutter_actor_set_position(label, (w - pref_width) / 2, APP_ICON_SIZE + 2);

    g_debug("%s: size: %d, %d", __func__, w, h);
    clutter_actor_show(actor);

    clutter_actor_add_child(priv->top, actor);

    *x += w;
}
Пример #11
0
static void
penge_event_tile_init (PengeEventTile *self)
{
  PengeEventTilePrivate *priv = GET_PRIVATE_REAL (self);
  ClutterActor *tmp_text;
  ClutterActor *indicator_container, *indicator_overlay;
  GError *error = NULL;

  self->priv = priv;

  priv->inner_table = mx_table_new ();
  mx_bin_set_child (MX_BIN (self), (ClutterActor *)priv->inner_table);
  mx_bin_set_fill (MX_BIN (self), TRUE, TRUE);

  indicator_container = mx_stack_new ();
  clutter_actor_set_size (indicator_container, 20, 20);

  priv->calendar_indicator = clutter_cairo_texture_new (20, 20);
  clutter_actor_set_size (priv->calendar_indicator, 20, 20);

  indicator_overlay = clutter_texture_new_from_file (CALENDAR_INDICATOR_OVERLAY_MASK, &error); 
  if (error != NULL)
    {
      g_critical (G_STRLOC ": Loading calendar colour overlay failed: %s",
                  error->message);
      g_clear_error (&error);
      indicator_overlay = NULL;
    }
  else
    {
      clutter_actor_set_size (indicator_overlay, 20, 20);
    }

  clutter_container_add (CLUTTER_CONTAINER (indicator_container),
      priv->calendar_indicator, indicator_overlay, NULL);

  priv->time_label = mx_label_new ();
  tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->time_label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE);
  mx_stylable_set_style_class (MX_STYLABLE (priv->time_label),
                               "PengeEventTimeLabel");

  priv->summary_label = mx_label_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->summary_label),
                               "PengeEventSummary");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->summary_label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END);
  clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE);

  /* Populate the table */
  mx_table_add_actor (MX_TABLE (priv->inner_table),
                      indicator_container,
                      0,
                      0);
  mx_table_add_actor (MX_TABLE (priv->inner_table),
                      priv->time_label,
                      0,
                      1);
  mx_table_add_actor (MX_TABLE (priv->inner_table),
                      priv->summary_label,
                      0,
                      2);

  clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table),
                               indicator_container,
                               "x-expand", FALSE,
                               "x-fill", FALSE,
                               "y-expand", FALSE,
                               "y-fill", FALSE,
                               NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table),
                               priv->time_label,
                               "x-expand", FALSE,
                               "x-fill", FALSE,
                               "y-expand", FALSE,
                               "y-fill", FALSE,
                               NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table),
                               priv->summary_label,
                               "x-expand", TRUE,
                               "x-fill", TRUE,
                               "y-expand", FALSE,
                               "y-fill", FALSE,
                               NULL);


  /* Setup spacing and padding */
  mx_table_set_column_spacing (MX_TABLE (priv->inner_table), 6);

  g_signal_connect (self,
                    "clicked",
                    (GCallback)_button_clicked_cb,
                    self);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
}
Пример #12
0
static ClutterActor *
_make_empty_people_tile (MnbPeoplePanel *people_panel)
{
  ClutterActor *tile;
  ClutterActor *frame;
  ClutterActor *label;
  ClutterActor *tmp_text;
  ClutterActor *settings_launcher;
  ClutterActor *picture;

  tile = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (tile), 8);

  clutter_actor_set_name ((ClutterActor *)tile,
                          "people-pane-no-people-tile");
  /* title */
  frame = mx_frame_new ();
  clutter_actor_set_name (frame,
                          "people-no-people-message-bin");
  label = mx_label_new_with_text (_("This is the People panel."));
  clutter_actor_set_name (label,
                          "people-no-people-message-title");
  mx_bin_set_child (MX_BIN (frame), label);
  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         frame,
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE);

  /* message */
  frame = mx_frame_new ();
  clutter_actor_set_name (frame,
                          "people-no-people-message-bin");
  label = mx_label_new_with_text (PLACEHOLDER_MESSAGE);
  clutter_actor_set_name (label,
                          "people-no-people-message-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text),
                                   PANGO_WRAP_WORD_CHAR);
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                              PANGO_ELLIPSIZE_NONE);
  clutter_actor_set_width (label, 500);

  mx_bin_set_child (MX_BIN (frame), label);

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         frame,
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE);

  settings_launcher = _make_settings_launcher (people_panel);

  clutter_actor_set_name (settings_launcher,
                          "people-panel-settings-launcher-tile");

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         settings_launcher,
                                         2, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);

  picture = clutter_texture_new_from_file (PLACEHOLDER_IMAGE, NULL);

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         picture,
                                         3, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", FALSE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_END,
                                         "y-align", MX_ALIGN_END,
                                         NULL);



  return tile;
}
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *scroll_view, *bin, *tmp_text;
  AnerleyFeed *active_feed;
  ClutterActor *settings_launcher;

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

  /* Populate top level table */
  priv->header_box = mx_table_new ();
  clutter_actor_set_name (priv->header_box, "people-panel-header-box");
  mx_table_set_column_spacing (MX_TABLE (priv->header_box), 20);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->header_box),
                                      0, 0,
                                      "column-span", 2,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_START,
                                      NULL);

  priv->content_table = mx_table_new ();
  clutter_actor_set_name (priv->content_table, "people-panel-content-box");
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->content_table),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  priv->side_table = mx_table_new ();
  clutter_actor_set_width (priv->side_table, 288);
  clutter_actor_set_name (priv->side_table, "people-panel-side-box");
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->side_table),
                                      1, 1,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      NULL);


  /* Populate header */
  label = mx_label_new_with_text (_("People"));
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (label),
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  clutter_actor_set_name (label, "people-panel-header-label");

  /* Main body table */

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-content-header");
  label = mx_label_new_with_text (_("Me and my people"));
  clutter_actor_set_name (label, "people-panel-content-header-label");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      CLUTTER_ACTOR (bin),
                                      0, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  /* Me table containing avatar, name and presence chooser */
  priv->me_table = mx_table_new ();

  mx_table_set_column_spacing (MX_TABLE (priv->me_table), 16);
  mx_table_set_row_spacing (MX_TABLE (priv->me_table), 8);

  clutter_actor_set_name (priv->me_table, "people-panel-me-box");

  priv->avatar = anerley_tp_user_avatar_new ();
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-me-avatar-frame");
  mx_bin_set_child (MX_BIN (bin), priv->avatar);
  clutter_actor_set_size (priv->avatar, 48, 48);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      bin,
                                      0, 0,
                                      "row-span", 2,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);
  label = mx_label_new_with_text (_("Me"));
  clutter_actor_set_name (label, "people-panel-me-label");
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      label,
                                      0, 1,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      priv->presence_chooser,
                                      1, 1,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  settings_launcher = _make_settings_launcher (self);
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      settings_launcher,
                                      0, 2,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_END,
                                      "y-expand", TRUE,
                                      "y-fill", FALSE,
                                      "row-span", 2,
                                      NULL);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      CLUTTER_ACTOR (priv->me_table),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  priv->tp_feed = anerley_aggregate_tp_feed_new ();

  priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed);
  priv->tile_view = anerley_tile_view_new (priv->model);

  priv->main_scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->main_scroll_view),
                               priv->tile_view);

  mx_table_add_actor (MX_TABLE (priv->content_table),
                      priv->main_scroll_view,
                      2,
                      0);

  /* No people && no accounts enabled */
  priv->no_people_tile = _make_empty_people_tile (self);
  clutter_actor_hide (priv->no_people_tile);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->no_people_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  /* No people && acounts are online */
  priv->everybody_offline_tile = _make_everybody_offline_tile (self);
  clutter_actor_hide (priv->everybody_offline_tile);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->everybody_offline_tile,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  priv->offline_banner =
    _make_offline_banner (self,
                          clutter_actor_get_width (priv->main_scroll_view));
  clutter_actor_hide (priv->offline_banner);
  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->offline_banner,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* Side table */
  label = mx_label_new_with_text (_("My conversations"));
  clutter_actor_set_name (label, "people-panel-side-box-header-label");
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-side-box-header");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      CLUTTER_ACTOR (bin),
                                      0, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      _make_messenger_launcher_tile (self),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      NULL);


  active_feed = anerley_tp_monitor_feed_new ((AnerleyAggregateTpFeed *)priv->tp_feed,
                                             "MeegoPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);


  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);

  /* active conversations */
  priv->active_content_table = mx_table_new ();
  clutter_actor_set_name (priv->active_content_table,
                          "people-panel-active-content-box");

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-active-content-header");
  label = mx_label_new_with_text (_("You are chatting with:"));
  clutter_actor_set_name (label, "people-panel-active-content-header-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_ellipsize (CLUTTER_TEXT(tmp_text), PANGO_ELLIPSIZE_NONE);
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);

  mx_table_add_actor_with_properties (MX_TABLE (priv->active_content_table),
                                      bin,
                                      0, 0,
                                      "y-expand", FALSE,
                                      NULL);


  mx_table_add_actor (MX_TABLE (priv->active_content_table),
                      scroll_view,
                      1, 0);

  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      priv->active_content_table,
                                      2, 0,
                                      "x-expand", TRUE,
                                      NULL);



  g_signal_connect (priv->tile_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  g_signal_connect (priv->active_list_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);


  g_signal_connect (priv->model,
                    "bulk-change-end",
                    (GCallback)_model_bulk_changed_end_cb,
                    self);
  g_signal_connect (priv->active_model,
                    "bulk-change-end",
                    (GCallback)_active_model_bulk_change_end_cb,
                    self);
  clutter_actor_hide ((ClutterActor *)priv->main_scroll_view);

  /* Placeholder changes based on onlineness or not */
  _update_placeholder_state (self);

  g_signal_connect (priv->tp_feed,
                    "notify::accounts-online",
                    (GCallback)_tp_feed_online_notify_cb,
                    self);
  g_signal_connect (priv->tp_feed,
                    "notify::accounts-available",
                    (GCallback)_tp_feed_available_notify_cb,
                    self);

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());
}
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *scroll_view, *scroll_bin, *bin, *tmp_text;
  AnerleyFeed *active_feed;

  mx_table_set_column_spacing (MX_TABLE (self), 4);
  mx_table_set_row_spacing (MX_TABLE (self), 6);
  clutter_actor_set_name (CLUTTER_ACTOR (self), "people-vbox");

  priv->header_box = mx_table_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (priv->header_box), "people-search");
  mx_table_set_column_spacing (MX_TABLE (priv->header_box), 20);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->header_box),
                                      0, 0,
                                      "row-span", 1,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_START,
                                      NULL);

  label = mx_label_new_with_text (_("People"));
  clutter_actor_set_name (CLUTTER_ACTOR (label), "people-search-label");
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (label),
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  priv->entry = (ClutterActor *) mpl_entry_new (_("Search"));
  clutter_actor_set_name (CLUTTER_ACTOR (priv->entry), "people-search-entry");
  clutter_actor_set_width (CLUTTER_ACTOR (priv->entry), 600);
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (priv->entry),
                                      0, 1,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      priv->presence_chooser,
                                      0, 2,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_END,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);
  g_signal_connect (priv->entry,
                    "text-changed",
                    (GCallback)_entry_text_changed_cb,
                    self);

  priv->tp_feed = anerley_aggregate_tp_feed_new ();

  priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed);
  priv->tile_view = anerley_tile_view_new (priv->model);

  active_feed = anerley_tp_monitor_feed_new ((AnerleyAggregateTpFeed *)priv->tp_feed,
                                             "MeegoPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);

  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);
  priv->content_table = mx_table_new ();
  clutter_actor_set_name (priv->content_table, "content-table");

  /* active conversations */
  priv->active_content_table = mx_table_new ();

  clutter_actor_hide (priv->active_content_table);
  clutter_actor_set_name (priv->active_content_table, "active-content-table");

  bin = mx_frame_new ();
  label = mx_label_new_with_text (_("You are chatting with:"));
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_ellipsize (CLUTTER_TEXT(tmp_text), PANGO_ELLIPSIZE_NONE);
  clutter_actor_set_name (label, "active-content-header-label");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);
  clutter_actor_set_name (bin, "active-content-header");

  mx_table_add_actor_with_properties (MX_TABLE (priv->active_content_table),
                                      bin,
                                      0, 0,
                                      "y-expand", FALSE,
                                      NULL);

  mx_table_add_actor (MX_TABLE (priv->active_content_table),
                      scroll_view,
                      1, 0);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->active_content_table,
                                      0, 1,
                                      "x-expand", FALSE,
                                      NULL);


  /* main area */
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->tile_view);

  scroll_bin = mx_table_new ();
  mx_table_add_actor (MX_TABLE (scroll_bin),
                      scroll_view,
                      0,
                      0);
  mx_table_add_actor (MX_TABLE (priv->content_table),
                      scroll_bin,
                      0,
                      0);
  clutter_actor_set_name (scroll_bin, "people-scroll-bin");


  /* No people && no accounts enabled */
  priv->no_people_tile = _make_empty_people_tile (self);

  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->no_people_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* No people && acounts are online */
  priv->everybody_offline_tile = _make_everybody_offline_tile (self);
  clutter_actor_hide (priv->everybody_offline_tile);

  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->everybody_offline_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  priv->offline_banner =
    _make_offline_banner (self,
                          clutter_actor_get_width (scroll_view));
  clutter_actor_hide (priv->offline_banner);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->offline_banner,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* Real content stuff */
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->content_table,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      "row-span", 1,
                                      NULL);

  g_signal_connect (priv->tile_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  g_signal_connect (priv->active_list_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  /* Put into the no people state */
  clutter_actor_hide ((ClutterActor *)priv->content_table);

  g_signal_connect (priv->model,
                    "bulk-change-end",
                    (GCallback)_model_bulk_changed_end_cb,
                    self);
  g_signal_connect (priv->active_model,
                    "bulk-change-end",
                    (GCallback)_active_model_bulk_change_end_cb,
                    self);

  /* Placeholder changes based on onlineness or not */
  _update_placeholder_state (self);

  g_signal_connect (priv->tp_feed,
                    "notify::accounts-online",
                    (GCallback)_tp_feed_online_notify_cb,
                    self);
  g_signal_connect (priv->tp_feed,
                    "notify::accounts-available",
                    (GCallback)_tp_feed_available_notify_cb,
                    self);

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());
}
static void
mpd_storage_device_tile_init (MpdStorageDeviceTile *self)
{
  MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self);
  ClutterText   *text;
  ClutterActor  *separator;

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (self),
                                 MX_ORIENTATION_VERTICAL);
  mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (self), true);

  priv->table = mx_table_new ();
  mx_table_set_column_spacing (MX_TABLE (priv->table), 5);
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->table, -1,
                                           "x-fill", true,
                                           NULL);
/*
   0      1           2
  +--------------------------+ Table
0 |      | Text      |  Open |
1 | Icon | Progress  | Eject |
  +------+-----------+-------+ Vbox
2 | <message> .. Import data |
  +--------------------------+
3 | ======================== |
  +--------------------------+
*/

  /*
   * Column 0: icon
   */

  priv->icon = clutter_texture_new ();
  clutter_actor_set_size (priv->icon,
                          MPD_STORAGE_DEVICE_TILE_ICON_SIZE,
                          MPD_STORAGE_DEVICE_TILE_ICON_SIZE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->icon, 0, 0,
                                      "row-span", 2,
                                      "column-span", 1,
                                      "x-align", MX_ALIGN_START,
                                      "x-expand", false,
                                      "x-fill", false,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      "y-expand", false,
                                      "y-fill", false,
                                      NULL);

  /*
   * Column 1
   */

  /* Text */
  priv->label = mx_label_new ();
  clutter_actor_set_width (priv->label, 200.0);
  text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label));
  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_END);
  mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->label, 0, 1,
                                      "x-align", MX_ALIGN_START,
                                      "x-expand", true,
                                      "x-fill", true,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      "y-expand", false,
                                      "y-fill", false,
                                      NULL);

  /* Progress */
  priv->meter = mx_progress_bar_new ();
  mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->meter, 1, 1,
                                      "x-align", MX_ALIGN_START,
                                      "x-expand", true,
                                      "x-fill", true,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      "y-expand", false,
                                      "y-fill", false,
                                      NULL);

  /*
   * Column 2: buttons
   */

  /* Open button */
  priv->open = mx_button_new_with_label (_("Open"));
  g_signal_connect (priv->open, "clicked",
                    G_CALLBACK (_open_clicked_cb), self);
  mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->open, 0, 2,
                                      "x-align", MX_ALIGN_END,
                                      "x-expand", false,
                                      "x-fill", true,
                                      "y-align", MX_ALIGN_END,
                                      "y-expand", false,
                                      "y-fill", false,
                                      NULL);

  /* Eject button */
  priv->eject = mx_button_new_with_label (_("Eject"));
  g_signal_connect (priv->eject, "clicked",
                    G_CALLBACK (_eject_clicked_cb), self);
  mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->eject, 1, 2,
                                      "x-align", MX_ALIGN_END,
                                      "x-expand", false,
                                      "x-fill", true,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      "y-expand", false,
                                      "y-fill", false,
                                      NULL);

  /*
   * Row 2
   */

  /* Import button */
  priv->import = mx_button_new ();
  clutter_actor_set_name (priv->import, "import");
  g_signal_connect (priv->import, "clicked",
                    G_CALLBACK (_import_clicked_cb), self);
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->import,
                                           -1,
                                           "expand", false,
                                           "x-align", MX_ALIGN_END,
                                           "x-fill", false,
                                           NULL);

  /*
   * 4th row: separator
   */

  /* Separator */
  separator = mx_frame_new ();
  mx_stylable_set_style_class (MX_STYLABLE (separator), "separator");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), separator,
                                           -1,
                                           "expand", false,
                                           "x-align", MX_ALIGN_MIDDLE,
                                           "x-fill", true,
                                           "y-align", MX_ALIGN_START,
                                           "y-fill", false,
                                           NULL);
}
static void
penge_count_tile_init (PengeCountTile *self)
{
  ClutterActor *tmp_text;
  PengeCountTilePrivate *priv = GET_PRIVATE_REAL (self);

  self->priv = priv;

  priv->table = mx_table_new ();
  g_object_ref (priv->table);

  priv->count_label = mx_label_new ();

  tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->count_label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE);
  clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE);

  g_object_set (G_OBJECT (priv->count_label),
                "x-align", MX_ALIGN_MIDDLE,
                "y-align", MX_ALIGN_MIDDLE,
                NULL);

  penge_count_tile_set_count (self, 0);

  clutter_actor_show (priv->count_label);
  mx_table_insert_actor_with_properties (MX_TABLE (priv->table),
                                      priv->count_label,
                                      0, 0,
                                      "row-span", 2,
                                      "x-expand", FALSE,
                                      NULL);

  priv->message_label = mx_label_new ();

  tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->message_label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END);
  clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE);

  mx_stylable_set_style_class (MX_STYLABLE (priv->message_label),
                              "PengeCountMessageLabel");

  clutter_actor_show (priv->message_label);
  mx_table_insert_actor_with_properties (MX_TABLE (priv->table),
                                      priv->message_label,
                                      0, 1,
                                      "x-expand", TRUE,
                                      NULL);

  priv->account_label = mx_label_new ();

  tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->account_label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END);
  clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE);

  mx_stylable_set_style_class (MX_STYLABLE (priv->account_label),
                              "PengeCountAccountLabel");

  clutter_actor_show (priv->account_label);
  mx_table_insert_actor_with_properties (MX_TABLE (priv->table),
                                      priv->account_label,
                                      1, 1,
                                      "x-expand", TRUE,
                                      NULL);
  mx_table_set_column_spacing (MX_TABLE (priv->table), 12);
  clutter_actor_show (priv->table);

  clutter_actor_add_child ((self), priv->table);
  //mx_bin_set_fill ((self), TRUE, FALSE);
}
Пример #17
0
static void
penge_interesting_tile_init (PengeInterestingTile *self)
{
    PengeInterestingTilePrivate *priv = GET_PRIVATE_REAL (self);
    ClutterActor *tmp_text;
    ClutterActor *icon;

    self->priv = priv;

    priv->inner_table = mx_table_new ();
    mx_bin_set_child (MX_BIN (self),
                      priv->inner_table);
    mx_bin_set_fill (MX_BIN (self), TRUE, TRUE);

    priv->primary_text = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->primary_text),
                                 "PengeInterestingTilePrimaryLabel");
    tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->primary_text));
    clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text),
                                     PANGO_ALIGN_LEFT);
    clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                                PANGO_ELLIPSIZE_END);
    g_signal_connect (priv->primary_text,
                      "notify::allocation",
                      (GCallback)_label_notify_allocation_cb,
                      self);

    priv->secondary_text = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->secondary_text),
                                 "PengeInterestingTileSecondaryLabel");
    tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->secondary_text));
    clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text),
                                     PANGO_ALIGN_LEFT);
    clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                                PANGO_ELLIPSIZE_END);
    g_signal_connect (priv->secondary_text,
                      "notify::allocation",
                      (GCallback)_label_notify_allocation_cb,
                      self);

    priv->icon = clutter_texture_new ();
    clutter_actor_set_size (priv->icon, 28, 28);
    clutter_actor_hide (priv->icon);

    /* This gets added to ourself table after our body because of ordering */
    priv->details_overlay = mx_table_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->details_overlay),
                                 "PengeInterestingTileDetails");

    mx_table_add_actor (MX_TABLE (priv->inner_table),
                        priv->details_overlay,
                        1,
                        0);

    clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table),
                                 (ClutterActor *)priv->details_overlay,
                                 "x-expand", TRUE,
                                 "y-expand", FALSE,
                                 "y-fill", FALSE,
                                 "y-align", MX_ALIGN_END,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->primary_text,
                        0,
                        1);

    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 (ClutterActor *)priv->primary_text,
                                 "x-expand",
                                 TRUE,
                                 "y-expand",
                                 FALSE,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->secondary_text,
                        1,
                        1);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 (ClutterActor *)priv->secondary_text,
                                 "x-expand",
                                 TRUE,
                                 "y-expand",
                                 FALSE,
                                 NULL);

    mx_table_add_actor (MX_TABLE (priv->details_overlay),
                        priv->icon,
                        0,
                        0);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->icon,
                                 "row-span", 2,
                                 "y-expand", FALSE,
                                 "x-expand", FALSE,
                                 "y-fill", FALSE,
                                 "x-fill", FALSE,
                                 NULL);

    priv->remove_button = mx_button_new ();
    mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button),
                                 "PengeInterestingTileRemoveButton");
    icon = (ClutterActor *)mx_icon_new ();
    mx_stylable_set_style_class (MX_STYLABLE (icon),
                                 "PengeInterestingTileIcon");
    mx_bin_set_child (MX_BIN (priv->remove_button),
                      (ClutterActor *)icon);
    mx_table_add_actor_with_properties (MX_TABLE (priv->details_overlay),
                                        priv->remove_button,
                                        0, 2,
                                        "row-span", 2,
                                        "x-expand", TRUE,
                                        "y-expand", TRUE,
                                        "x-fill", FALSE,
                                        "y-fill", FALSE,
                                        "x-align", MX_ALIGN_END,
                                        "y-align", MX_ALIGN_MIDDLE,
                                        NULL);

    g_signal_connect (priv->remove_button,
                      "clicked",
                      (GCallback)_remove_button_clicked,
                      self);

    mx_table_set_column_spacing (MX_TABLE (priv->details_overlay), 4);

    clutter_actor_set_reactive ((ClutterActor *) self, TRUE);

    clutter_actor_hide (priv->icon);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->primary_text,
                                 "column", 0,
                                 NULL);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay),
                                 priv->secondary_text,
                                 "column", 0,
                                 NULL);
}
Пример #18
0
static gboolean
do_tests (CallbackData *data)
{
  PangoFontDescription *fd;
  static const ClutterColor red = { 0xff, 0x00, 0x00, 0xff };
  PangoAttrList *attr_list, *attr_list_copy;
  PangoAttribute *attr;

  /* TEST 1: change the text */
  clutter_text_set_text (CLUTTER_TEXT (data->label), "Counter 0");
  pango_layout_set_text (data->test_layout, "Counter 0", -1);
  g_assert (check_result (data, "Change text", TRUE) == FALSE);

  /* TEST 2: change a single character */
  clutter_text_set_text (CLUTTER_TEXT (data->label), "Counter 1");
  pango_layout_set_text (data->test_layout, "Counter 1", -1);
  g_assert (check_result (data, "Change a single character", TRUE) == FALSE);

  /* TEST 3: move the label */
  clutter_actor_set_position (data->label, 10, 0);
  g_assert (check_result (data, "Move the label", FALSE) == FALSE);

  /* TEST 4: change the font */
  clutter_text_set_font_name (CLUTTER_TEXT (data->label), "Serif 15");
  fd = pango_font_description_from_string ("Serif 15");
  pango_layout_set_font_description (data->test_layout, fd);
  pango_font_description_free (fd);
  g_assert (check_result (data, "Change the font", TRUE) == FALSE);

  /* TEST 5: change the color */
  clutter_text_set_color (CLUTTER_TEXT (data->label), &red);
  g_assert (check_result (data, "Change the color", FALSE) == FALSE);

  /* TEST 6: change the attributes */
  attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
  attr->start_index = 0;
  attr->end_index = 2;
  attr_list = pango_attr_list_new ();
  pango_attr_list_insert (attr_list, attr);
  attr_list_copy = pango_attr_list_copy (attr_list);
  clutter_text_set_attributes (CLUTTER_TEXT (data->label), attr_list);
  pango_layout_set_attributes (data->test_layout, attr_list_copy);
  pango_attr_list_unref (attr_list_copy);
  pango_attr_list_unref (attr_list);
  g_assert (check_result (data, "Change the attributes", TRUE) == FALSE);

  /* TEST 7: change the text again */
  clutter_text_set_attributes (CLUTTER_TEXT (data->label), NULL);
  clutter_text_set_text (CLUTTER_TEXT (data->label), long_text);
  pango_layout_set_attributes (data->test_layout, NULL);
  pango_layout_set_text (data->test_layout, long_text, -1);
  g_assert (check_result (data, "Change the text again", TRUE) == FALSE);

  /* TEST 8: enable markup */
  clutter_text_set_use_markup (CLUTTER_TEXT (data->label), TRUE);
  pango_layout_set_markup (data->test_layout, long_text, -1);
  g_assert (check_result (data, "Enable markup", TRUE) == FALSE);

  /* This part can't be a test because Clutter won't restrict the
     width if wrapping and ellipsizing is disabled so the extents will
     be different, but we still want to do it for the later tests */
  clutter_actor_set_width (data->label, 200);
  pango_layout_set_width (data->test_layout, 200 * PANGO_SCALE);
  /* Force a redraw so that changing the width won't affect the
     results */
  force_redraw (data);

  /* TEST 9: enable ellipsize */
  clutter_text_set_ellipsize (CLUTTER_TEXT (data->label),
			       PANGO_ELLIPSIZE_END);
  pango_layout_set_ellipsize (data->test_layout, PANGO_ELLIPSIZE_END);
  g_assert (check_result (data, "Enable ellipsize", TRUE) == FALSE);
  clutter_text_set_ellipsize (CLUTTER_TEXT (data->label),
			       PANGO_ELLIPSIZE_NONE);
  pango_layout_set_ellipsize (data->test_layout, PANGO_ELLIPSIZE_NONE);
  force_redraw (data);

  /* TEST 10: enable line wrap */
  clutter_text_set_line_wrap (CLUTTER_TEXT (data->label), TRUE);
  pango_layout_set_wrap (data->test_layout, PANGO_WRAP_WORD);
  g_assert (check_result (data, "Enable line wrap", TRUE) == FALSE);

  /* TEST 11: change wrap mode
   * FIXME - broken
   */
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (data->label),
				    PANGO_WRAP_CHAR);
  pango_layout_set_wrap (data->test_layout, PANGO_WRAP_CHAR);
  g_assert (check_result (data, "Change wrap mode", TRUE) == FALSE);

  /* TEST 12: enable justify */
  clutter_text_set_justify (CLUTTER_TEXT (data->label), TRUE);
  pango_layout_set_justify (data->test_layout, TRUE);
  /* Pango appears to have a bug which means that you can't change the
     justification after setting the text but this fixes it.
     See http://bugzilla.gnome.org/show_bug.cgi?id=551865 */
  pango_layout_context_changed (data->test_layout);
  g_assert (check_result (data, "Enable justify", TRUE) == FALSE);

  /* TEST 13: change alignment */
  clutter_text_set_line_alignment (CLUTTER_TEXT (data->label),
                                   PANGO_ALIGN_RIGHT);
  pango_layout_set_alignment (data->test_layout, PANGO_ALIGN_RIGHT);
  g_assert (check_result (data, "Change alignment", TRUE) == FALSE);

  clutter_main_quit ();

  return FALSE;
}