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);
}
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);
}
static void
mex_telepathy_channel_create_preview (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  ClutterActor *video_preview_area;

  priv->video_outgoing = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->video_outgoing),
                                         TRUE);

  priv->outgoing_sink =
    clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->video_outgoing));

  video_preview_area = mx_stack_new ();

  clutter_container_add (CLUTTER_CONTAINER (video_preview_area),
                         mex_telepathy_channel_create_static_image(),
                         priv->video_outgoing,
                         NULL);

  mx_stylable_set_style_class (MX_STYLABLE (video_preview_area),
                               "PreviewStack");

  clutter_actor_set_height (video_preview_area, 150.0);
  clutter_actor_add_effect (video_preview_area,
                            CLUTTER_EFFECT (
                              mex_telepathy_channel_create_shadow ()));

  priv->preview_area = mx_frame_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->preview_area),
                               "PreviewPadding");
  mx_bin_set_child (MX_BIN (priv->preview_area), video_preview_area);
}
static void
mex_telepathy_channel_create_incoming_video (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  ClutterActor *video_incoming_area;

  /* Setup the incoming surface to draw to */
  priv->incoming_texture = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->incoming_texture),
                                         TRUE);

  video_incoming_area = mx_stack_new ();

  clutter_container_add (CLUTTER_CONTAINER (video_incoming_area),
                         mex_telepathy_channel_create_static_image(),
                         priv->incoming_texture,
                         NULL);

  /* Create a frame for it with a styled border */
  priv->full_frame = mx_frame_new();
  clutter_actor_set_name (priv->full_frame, "Incoming Frame");
  mx_bin_set_fill (MX_BIN (priv->full_frame), TRUE, TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (priv->full_frame),
                               "CallWindow");
  clutter_actor_add_effect (priv->full_frame,
                            CLUTTER_EFFECT (
                              mex_telepathy_channel_create_shadow ()));
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->full_frame),
                               video_incoming_area);

  priv->incoming_sink =
    clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->incoming_texture));
}
static void
mx_scroll_bar_init (MxScrollBar *self)
{
  self->priv = MX_SCROLL_BAR_GET_PRIVATE (self);

  self->priv->bw_stepper = (ClutterActor *) mx_button_new ();
  mx_stylable_set_style_class (MX_STYLABLE (self->priv->bw_stepper),
                               "backward-stepper");
  clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->bw_stepper),
                            CLUTTER_ACTOR (self));
  g_signal_connect (self->priv->bw_stepper, "button-press-event",
                    G_CALLBACK (stepper_button_press_event_cb), self);
  g_signal_connect (self->priv->bw_stepper, "button-release-event",
                    G_CALLBACK (stepper_button_release_cb), self);
  g_signal_connect (self->priv->bw_stepper, "leave-event",
                    G_CALLBACK (stepper_button_release_cb), self);

  self->priv->fw_stepper = (ClutterActor *) mx_button_new ();
  mx_stylable_set_style_class (MX_STYLABLE (self->priv->fw_stepper),
                               "forward-stepper");
  clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->fw_stepper),
                            CLUTTER_ACTOR (self));
  g_signal_connect (self->priv->fw_stepper, "button-press-event",
                    G_CALLBACK (stepper_button_press_event_cb), self);
  g_signal_connect (self->priv->fw_stepper, "button-release-event",
                    G_CALLBACK (stepper_button_release_cb), self);
  g_signal_connect (self->priv->fw_stepper, "leave-event",
                    G_CALLBACK (stepper_button_release_cb), self);

  self->priv->trough = mx_frame_new ();
  clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (self->priv->trough), "htrough");
  clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->trough),
                            CLUTTER_ACTOR (self));
  g_signal_connect (self->priv->trough, "button-press-event",
                    G_CALLBACK (trough_button_press_event_cb), self);
  g_signal_connect (self->priv->trough, "button-release-event",
                    G_CALLBACK (trough_button_release_event_cb), self);
  g_signal_connect (self->priv->trough, "leave-event",
                    G_CALLBACK (trough_leave_event_cb), self);

  self->priv->handle = (ClutterActor *) mx_button_new ();
  mx_stylable_set_style_class (MX_STYLABLE (self->priv->handle), "hhandle");
  clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle),
                            CLUTTER_ACTOR (self));
  g_signal_connect (self->priv->handle, "button-press-event",
                    G_CALLBACK (handle_button_press_event_cb), self);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mx_scroll_bar_style_changed), NULL);
  g_signal_connect (self, "notify::reactive",
                    G_CALLBACK (mx_scroll_bar_notify_reactive), NULL);
}
static ClutterActor *
_make_messenger_launcher_tile (MnbPeoplePanel *panel)
{
  ClutterActor *table;
  ClutterActor *icon_tex;
  ClutterActor *button;
  GAppInfo *app_info;
  gchar *button_str;
  ClutterActor *bin;

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-messenger-launcher-tile");
  table = mx_table_new ();
  mx_bin_set_child (MX_BIN (bin), table);
  mx_table_set_column_spacing (MX_TABLE (table), 16);
  app_info = (GAppInfo *)g_desktop_app_info_new ("empathy.desktop");

  icon_tex = g_object_new (MX_TYPE_ICON,
                           "icon-name", "netbook-empathy",
                           NULL);

  mx_table_add_actor_with_properties (MX_TABLE (table),
                                      icon_tex,
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);

  button_str = g_strdup_printf (_("Open %s"),
                                g_app_info_get_name (app_info));

  button = mx_button_new_with_label (button_str);
  g_free (button_str);
  g_signal_connect (button,
                    "clicked",
                    (GCallback)_messenger_launcher_button_clicked_cb,
                    panel);

  mx_table_add_actor_with_properties (MX_TABLE (table),
                                      button,
                                      0, 1,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);

  g_object_unref (app_info);

  return bin;
}
Example #7
0
static void
create_header (MexEpgGrid *grid)
{
  MexEpgGridPrivate *priv = grid->priv;
  GTimeSpan diff;
  GDateTime *time_, *old_time;
  gint n_headers, i;
  gchar *time_str;

  diff = g_date_time_difference (priv->last_date, priv->first_date);
  n_headers = (diff * 1e-6 / 60. / 30) + 1; /* number of 30mins slices */

  if (MEX_DEBUG_ENABLED (EPG))
    {
      gchar *first_str, *last_str;

      first_str = mex_date_to_string (priv->first_date);
      last_str = mex_date_to_string (priv->last_date);
      MEX_NOTE (EPG, "Creating header between %s and %s (%d columns)",
                first_str, last_str, n_headers);
      g_free (first_str);
      g_free (last_str);
    }

  g_ptr_array_set_size (priv->header, n_headers);

  time_ = g_date_time_ref (priv->first_date);
  for (i = 0; i < n_headers; i++)
    {
      ClutterActor  *frame, *label;

      /* a Frame for 30 mins, each frame has a label in it */
      frame = mx_frame_new ();
      clutter_actor_set_parent (frame, CLUTTER_ACTOR (grid));
      mx_stylable_set_style_class (MX_STYLABLE (frame), "EpgHeader");
      clutter_actor_set_size (frame,
                              6 * priv->pixels_for_5_mins,
                              HEADER_HEIGHT);

      time_str = g_date_time_format (time_, "%H:%M");
      label = mx_label_new_with_text (time_str);
      mx_bin_set_child (MX_BIN (frame), label);
      mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE);

      g_ptr_array_index (priv->header, i) = frame;

      g_free (time_str);
      old_time = time_;
      time_ = g_date_time_add_minutes (time_, 30);
      g_date_time_unref (old_time);
    }
  g_date_time_unref (time_);
}
Example #8
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;
}
Example #9
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;
}
Example #10
0
File: mx-slider.c Project: 3v1n0/mx
static void
mx_slider_init (MxSlider *self)
{
  MxSliderPrivate *priv;

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

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

  priv->trough_bg = CLUTTER_ACTOR (_mx_progress_bar_fill_new ());
  clutter_actor_set_name (priv->trough_bg, "trough-background");
  clutter_actor_set_reactive (priv->trough_bg, TRUE);
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->trough_bg);
  g_signal_connect (priv->trough_bg, "button-press-event",
                    G_CALLBACK (on_trough_bg_button_press_event), self);
  g_signal_connect (priv->trough_bg, "button-release-event",
                    G_CALLBACK (on_trough_bg_button_release_event), self);
  g_signal_connect (priv->trough_bg, "leave-event",
                    G_CALLBACK (on_trough_bg_leave_event), self);

  priv->fill = CLUTTER_ACTOR (_mx_progress_bar_fill_new ());
  clutter_actor_set_name (priv->fill, "fill");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->fill);

  priv->trough = CLUTTER_ACTOR (mx_frame_new ());
  clutter_actor_set_name (priv->trough, "trough");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->trough);

  self->priv->handle = CLUTTER_ACTOR (mx_button_new ());
  clutter_actor_set_name (priv->handle, "handle");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->handle);
  g_signal_connect (priv->handle, "button-press-event",
                    G_CALLBACK (on_handle_button_press_event), self);

  priv->buffer = _mx_progress_bar_fill_new ();
  clutter_actor_set_name (priv->buffer, "buffer");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->buffer);
}
static void
create_network_row (MpdComputerTile *tile,
                    const gchar     *label_text,
                    gint             row)
{
  MpdComputerTilePrivate *priv = tile->priv;
  ClutterActor *label, *toggle, *frame;

  label = mx_label_new_with_text (label_text);
  mx_table_add_actor_with_properties (MX_TABLE (tile), label,
                                      row, 0,
                                      "x-expand", FALSE,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      "y-fill", FALSE,
                                      NULL);

  frame = mx_frame_new ();
  toggle = mx_toggle_new ();

  mx_bin_set_child (MX_BIN (frame), toggle);
  mx_table_add_actor_with_properties (MX_TABLE (tile), frame,
                                      row, 1,
                                      "x-expand", FALSE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      NULL);

  priv->toggled_data[row].tile = tile;
  priv->toggled_data[row].row = row;
  g_signal_connect (toggle,
                    "notify::active",
                    G_CALLBACK (on_switch_toggled),
                    &priv->toggled_data[row]);

  priv->rows[row].label = label;
  priv->rows[row].frame = frame;
  priv->rows[row].toggle = toggle;
}
Example #12
0
static void
mex_search_plugin_init (MexSearchPlugin *self)
{
  MexProxy *suggest_proxy;
  ClutterActor *icon, *header, *text, *frame, *box, *hbox;
  MexSearchPluginPrivate *priv = self->priv = SEARCH_PLUGIN_PRIVATE (self);

  /* Load style data */
  mx_style_load_from_file (mx_style_get_default (),
                           PLUGIN_DATA_DIR "/style.css", NULL);

  /* Create the history model and models list */
  priv->history_model = mex_feed_new (_("Search"), _("Search"));

  priv->model_info =
    mex_model_info_new_with_sort_funcs (MEX_MODEL (priv->history_model),
                                        "search", 0);
  g_object_unref (priv->history_model);
  priv->models = g_list_append (NULL, priv->model_info);

  /* Create the actions list */
  memset (&priv->action_info, 0, sizeof (MexActionInfo));
  priv->action_info.action =
    mx_action_new_full ("x-mex/search",
                        _("Search"),
                        G_CALLBACK (mex_search_plugin_history_cb),
                        self);
  priv->action_info.mime_types = (gchar **)search_mimetypes;
  priv->actions = g_list_append (NULL, &priv->action_info);

  /* Create the suggestions model */
  priv->suggest_model =
    mex_feed_new (_("Suggestions"), _("Google Suggestions"));

  /* Create the search page */

  /* Create header */
  icon = mx_icon_new ();
  mx_stylable_set_style_class (MX_STYLABLE (icon), "Search");

  header = mx_box_layout_new ();
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (header), 5);
  clutter_actor_set_name (header, "search-header");

  /* Create search entry */
  frame = mx_table_new ();
  clutter_actor_set_name (frame, "search-entry-frame");
  priv->search_entry = mx_entry_new ();
  priv->spinner = mx_spinner_new ();

  mx_table_add_actor (MX_TABLE (frame), priv->search_entry, 0, 0);
  mx_table_add_actor (MX_TABLE (frame), priv->spinner, 0, 1);
  mx_table_child_set_x_fill (MX_TABLE (frame), priv->spinner, FALSE);
  mx_table_child_set_x_expand (MX_TABLE (frame), priv->spinner, FALSE);
  mx_table_child_set_y_fill (MX_TABLE (frame), priv->spinner, FALSE);

  mx_spinner_set_animating (MX_SPINNER (priv->spinner), FALSE);
  clutter_actor_hide (priv->spinner);

  clutter_container_add (CLUTTER_CONTAINER (header), icon, frame, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (header), icon,
                               "x-fill", FALSE, "y-fill", FALSE, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (header), frame,
                               "expand", TRUE, "x-fill", TRUE, NULL);

  text = mx_entry_get_clutter_text (MX_ENTRY (priv->search_entry));
  g_signal_connect_swapped (text, "activate",
                            G_CALLBACK (mex_search_plugin_search_cb), self);
  g_signal_connect (priv->search_entry, "notify::text",
                    G_CALLBACK (mex_search_text_changed_cb), self);
  g_signal_connect (priv->search_entry, "notify::style-pseudo-class",
                    G_CALLBACK (mex_search_text_style_changed), header);

  /* Create the suggestions column */
  priv->suggest_column = mx_box_layout_new ();
  clutter_actor_set_name (priv->suggest_column, "suggest-column");
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->suggest_column),
                                 MX_ORIENTATION_VERTICAL);
  suggest_proxy = mex_generic_proxy_new (MEX_MODEL (priv->suggest_model),
                                        MX_TYPE_BUTTON);
  mex_generic_proxy_bind (MEX_GENERIC_PROXY (suggest_proxy),
                          mex_enum_to_string (MEX_TYPE_CONTENT_METADATA,
                                              MEX_CONTENT_METADATA_TITLE),
                          "label");
  g_signal_connect (suggest_proxy, "object-created",
                    G_CALLBACK (mex_search_proxy_add_cb),
                    priv->suggest_column);
  g_signal_connect (suggest_proxy, "object-removed",
                    G_CALLBACK (mex_search_proxy_remove_cb),
                    priv->suggest_column);
  g_object_weak_ref (G_OBJECT (priv->suggest_column),
                     (GWeakNotify)g_object_unref, suggest_proxy);

  /* Pack the search page */
  priv->search_page = mx_frame_new ();
  clutter_actor_set_name (priv->search_page, "search-page");
  mx_bin_set_fill (MX_BIN (priv->search_page), FALSE, TRUE);
  mx_bin_set_alignment (MX_BIN (priv->search_page), MX_ALIGN_START,
                        MX_ALIGN_START);
  hbox = mex_resizing_hbox_new ();
  mex_resizing_hbox_set_resizing_enabled (MEX_RESIZING_HBOX (hbox), FALSE);
  box = mx_box_layout_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->search_page), hbox);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), box);
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box),
                                 MX_ORIENTATION_VERTICAL);
  clutter_container_add (CLUTTER_CONTAINER (box),
                         header, priv->suggest_column, NULL);
  mx_box_layout_child_set_expand (MX_BOX_LAYOUT (box),
                                  priv->suggest_column, TRUE);
  clutter_container_child_set (CLUTTER_CONTAINER (box), header,
                               "x-fill", TRUE,
                               "x-align", MX_ALIGN_START, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (box),
                               priv->suggest_column,
                               "x-fill", TRUE,
                               "x-align", MX_ALIGN_START, NULL);
  clutter_actor_set_width (box, 426.0);

  /* Update the history list */
  mex_search_plugin_update_history (self, NULL);

  /* Start the history list and suggestions proxy */
  mex_proxy_start (suggest_proxy);
}
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");
}
Example #14
0
static void
penge_welcome_tile_init (PengeWelcomeTile *tile)
{
  ClutterActor *placeholder_image;
  GError *error = NULL;

  placeholder_image = clutter_texture_new_from_file (PLACEHOLDER_IMAGE, &error);
  if (error != NULL)
    {
      g_warning ("Couldn't open the placeholder image %s", PLACEHOLDER_IMAGE);
      g_clear_error (&error);
    }
  else
    {
      ClutterActor *bin;

      bin = mx_frame_new ();

      clutter_container_add_actor (CLUTTER_CONTAINER (bin),
          placeholder_image);

      clutter_actor_set_name (bin,
                              "penge-welcome-placeholder-margin");
      clutter_actor_set_name (placeholder_image,
                              "penge-welcome-placeholder");
      clutter_actor_set_size (placeholder_image, 548, 247);

      mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                             bin,
                                             0, 0,
                                             "x-expand", TRUE,
                                             "y-expand", TRUE,
                                             "x-fill", TRUE,
                                             "y-fill", TRUE,
                                             "x-align", MX_ALIGN_START,
                                             NULL);
      mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);
    }


  /* It's not to be shown
  if (g_file_test (WELCOME_VIDEO_FILENAME, G_FILE_TEST_EXISTS))
    {
      ClutterActor *launcher;
      ClutterActor *inner_table;
      ClutterActor *icon;

      launcher = mx_button_new ();
      clutter_actor_set_name (launcher, "penge-welcome-launcher");

      inner_table = mx_table_new ();
      mx_bin_set_child (MX_BIN (launcher), inner_table);

      icon = mx_icon_new ();
      clutter_actor_set_name (icon, "penge-welcome-launcher-thumbnail");
      mx_table_insert_actor_with_properties (MX_TABLE (inner_table),
                                          icon,
                                          0, 0,
                                          "x-expand", TRUE,
                                          "x-fill", TRUE,
                                          "y-expand", TRUE,
                                          "y-fill", TRUE,
                                          NULL);

      icon = mx_icon_new ();
      clutter_actor_set_name (icon, "penge-welcome-launcher-play-button");
      mx_table_insert_actor_with_properties (MX_TABLE (inner_table),
                                          icon,
                                          0, 0,
                                          "x-expand", TRUE,
                                          "x-fill", FALSE,
                                          "y-expand", TRUE,
                                          "y-fill", FALSE,
                                          NULL);

      mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                          launcher,
                                          1, 0,
                                          "x-expand", FALSE,
                                          "x-fill", FALSE,
                                          "y-expand", FALSE,
                                          "y-fill", FALSE,
                                          "x-align", MX_ALIGN_START,
                                          NULL);

      g_signal_connect (launcher,
                        "clicked",
                        (GCallback)_welcome_launcher_clicked_cb,
                        NULL);
    }
    */
}
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
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 ClutterActor *
create_track_info (RBShell *shell)
{
    RBShellPlayer *player;
    RhythmDB *db;
    ClutterActor *box;
    ClutterActor *box2;
    ClutterActor *widget;
    ClutterActor *frame;
    RhythmDBEntry *entry;
    GValue *value;
    guint elapsed;

    g_object_get (shell, "shell-player", &player, "db", &db, NULL);
    entry = rb_shell_player_get_playing_entry (player);

    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), "TrackInfoBox");
    mx_stylable_set_style (MX_STYLABLE (box), style);

    /* XXX rtl? */

    /* image container */
    frame = mx_frame_new ();
    mx_stylable_set_style_class (MX_STYLABLE (frame), "TrackInfoImage");
    mx_stylable_set_style (MX_STYLABLE (frame), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), frame, 0);
    clutter_container_child_set (CLUTTER_CONTAINER (box), frame,
                                 "expand", FALSE,
                                 NULL);
    set_blank_image (MX_FRAME (frame));
    clutter_actor_show_all (CLUTTER_ACTOR (frame));

    g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (cover_art_entry_changed_cb), frame, 0);
    request_cover_art (MX_FRAME (frame), entry);

    box2 = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box2), MX_ORIENTATION_VERTICAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box2), 16);
    mx_stylable_set_style (MX_STYLABLE (box2), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), box2, 1);
    clutter_container_child_set (CLUTTER_CONTAINER (box), box2,
                                 "expand", TRUE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    /* track info */
    widget = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackInfoText");
    mx_stylable_set_style (MX_STYLABLE (widget), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 1);
    clutter_container_child_set (CLUTTER_CONTAINER (box2), widget,
                                 "expand", FALSE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (playing_song_changed_cb), widget, 0);
    g_signal_connect_object (db, "entry-changed", G_CALLBACK (entry_changed_cb), widget, 0);
    g_signal_connect_object (db, "entry-extra-metadata-notify::" RHYTHMDB_PROP_STREAM_SONG_TITLE, G_CALLBACK (streaming_title_notify_cb), widget, 0);

    value = rhythmdb_entry_request_extra_metadata (db, entry, RHYTHMDB_PROP_STREAM_SONG_TITLE);
    if (value != NULL) {
        update_track_info (MX_LABEL (widget), db, entry, g_value_get_string (value));
        g_value_unset (value);
        g_free (value);
    } else {
        update_track_info (MX_LABEL (widget), db, entry, NULL);
    }

    /* elapsed/duration */
    widget = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackTimeText");
    mx_stylable_set_style (MX_STYLABLE (widget), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 2);
    clutter_container_child_set (CLUTTER_CONTAINER (box2), widget,
                                 "expand", FALSE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    g_signal_connect_object (player, "elapsed-changed", G_CALLBACK (elapsed_changed_cb), widget, 0);
    if (rb_shell_player_get_playing_time (player, &elapsed, NULL)) {
        update_elapsed (widget, player, elapsed);
    }

    rhythmdb_entry_unref (entry);
    g_object_unref (player);
    g_object_unref (db);
    return box;
}
Example #18
0
static void
construct_completion (MnpWorldClock *world_clock)
{
    const ClutterColor transparent = { 0x00, 0x00, 0x00, 0x00 };

    ClutterActor *frame, *scroll, *view, *stage;
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);
    ClutterModel *model;
    MnpButtonItem *button_item;

    stage = priv->stage;

    /* Create an event-box to capture input when the completion list
     * displays.
     */
    priv->event_box = clutter_rectangle_new_with_color (&transparent);
    clutter_actor_set_size (priv->event_box,
                            clutter_actor_get_width (stage),
                            clutter_actor_get_height (stage));
    clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                 priv->event_box);
    clutter_actor_set_reactive (priv->event_box, TRUE);
    clutter_actor_hide (priv->event_box);
    g_signal_connect (priv->event_box, "button-press-event",
                      G_CALLBACK (event_box_clicked_cb), world_clock);

    if (!priv->zones_model) {
        model = mnp_get_world_timezones ();
        priv->zones_model = model;
    } else
        model = priv->zones_model;

    clutter_model_set_filter (model, filter_zone, world_clock, NULL);
    priv->search_text = "asd";

    frame = mx_frame_new ();
    clutter_actor_set_name (frame, "CompletionFrame");
    mx_bin_set_fill (MX_BIN (frame), TRUE, TRUE);

    scroll = mx_scroll_view_new ();
    clutter_actor_set_name (scroll, "CompletionScrollView");
    g_object_set (G_OBJECT (scroll), "clip-to-allocation", TRUE, NULL);
    clutter_actor_set_size (scroll, -1, 300);
    mx_bin_set_child (MX_BIN (frame), scroll);
    clutter_container_add_actor ((ClutterContainer *)stage, frame);
    clutter_actor_raise_top((ClutterActor *) frame);
    clutter_actor_set_position (frame, 14, 167);
    clutter_actor_hide (frame);

    priv->completion = frame;
    g_signal_connect (priv->completion, "show",
                      G_CALLBACK (completion_show_cb), world_clock);
    g_signal_connect (priv->completion, "hide",
                      G_CALLBACK (completion_hide_cb), world_clock);

    view = mx_list_view_new ();
    clutter_actor_set_name (view, "CompletionListView");
    priv->zones_list = (MxListView *)view;

    clutter_container_add_actor (CLUTTER_CONTAINER (scroll), view);
    mx_list_view_set_model (MX_LIST_VIEW (view), model);

    button_item = mnp_button_item_new ((gpointer)world_clock, mnp_completion_done);
    mx_list_view_set_factory (MX_LIST_VIEW (view), (MxItemFactory *)button_item);
    mx_list_view_add_attribute (MX_LIST_VIEW (view), "label", 0);
}
Example #19
0
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *bin;
  ClutterActor *table;
  ClutterActor *scroll_view;
  ClutterActor *left_side;
  ClutterActor *right_side;
  AnerleyFeed *active_feed;

  priv->am = tp_account_manager_dup ();
  priv->aggregator = folks_individual_aggregator_new ();

  /* Populate top level table */
  label = mx_label_new_with_text (_("IM"));
  mx_stylable_set_style_class (MX_STYLABLE (label), "titleBar");
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (label),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  table = mx_table_new ();
  mx_stylable_set_style_class (MX_STYLABLE (table), "contentPane");
  mx_table_set_column_spacing (MX_TABLE (table), 23);
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (table),
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  left_side = mx_table_new ();
  clutter_actor_set_width (left_side, 300);
  mx_table_set_row_spacing (MX_TABLE (left_side), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         CLUTTER_ACTOR (left_side),
                                         0, 0,
                                         "x-expand", FALSE,
                                         "y-expand", TRUE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  right_side = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (right_side), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         CLUTTER_ACTOR (right_side),
                                         0, 1,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);

  /* Populate left side */
  table = mx_table_new ();
  mx_table_set_column_spacing (MX_TABLE (table), 10);
  clutter_actor_set_name (table, "people-panel-me-table");
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         CLUTTER_ACTOR (table),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-me-avatar-frame");
  clutter_actor_set_size (bin, 84, 85);
  priv->avatar = anerley_tp_user_avatar_new ();
  clutter_actor_set_size (priv->avatar, 64, 64);
  mx_bin_set_child (MX_BIN (bin), priv->avatar);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         bin,
                                         0, 0,
                                         "row-span", 3,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "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_insert_actor_with_properties (MX_TABLE (table),
                                         label,
                                         0, 1,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  priv->presence_message = mx_label_new ();
  clutter_actor_set_name (label, "people-panel-me-presence-message");
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->presence_message,
                                         1, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  clutter_actor_set_height (priv->presence_chooser, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->presence_chooser,
                                         2, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "y-align", MX_ALIGN_END,
                                         NULL);
  label = mx_label_new_with_text (_("You are chatting with:"));
  mx_stylable_set_style_class (MX_STYLABLE (label), "sectionHeader");
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         label,
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  scroll_view = mx_scroll_view_new ();
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         scroll_view,
                                         2, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  active_feed = anerley_tp_monitor_feed_new (priv->aggregator,
                                             "DawatiPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);
  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);

  /* Populate right side */
  table = mx_table_new ();
  clutter_actor_set_name (table, "people-panel-actions-box");
  mx_table_set_column_spacing (MX_TABLE (table), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (right_side),
                                         CLUTTER_ACTOR (table),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  create_sort_by_chooser (self);
  clutter_actor_set_size (priv->sort_by_chooser, 160, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->sort_by_chooser,
                                         0, 0,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  create_new_chooser (self);
  clutter_actor_set_size (priv->new_chooser, 126, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->new_chooser,
                                         0, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  create_search_entry (self);
  //clutter_actor_set_height (priv->search_entry, 30);
  mx_stylable_set_style_class (MX_STYLABLE (priv->search_entry), "searchBox");
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->search_entry,
                                         0, 2,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  priv->content_table = mx_table_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->content_table), "contentPanel");
  mx_table_insert_actor_with_properties (MX_TABLE (right_side),
                                         priv->content_table,
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  priv->tp_feed = ANERLEY_FEED (anerley_tp_feed_new (priv->aggregator));
  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_insert_actor (MX_TABLE (priv->content_table),
                         priv->main_scroll_view,
                         0, 0);

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

  mx_table_insert_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_insert_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_insert_actor_with_properties (MX_TABLE (priv->content_table),
                                         priv->offline_banner,
                                         3, 0,
                                         "x-fill", TRUE,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "y-fill", FALSE,
                                         "y-align", MX_ALIGN_START,
                                         "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);


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

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());

  tp_proxy_prepare_async (priv->am, NULL, am_prepared_cb, self);
}
Example #20
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;
}
Example #21
0
static void
penge_apps_pane_update (PengeAppsPane *pane)
{
  PengeAppsPanePrivate *priv = GET_PRIVATE (pane);
  GList *bookmarks, *l, *to_remove;
  ClutterActor *actor;
  gint count = 0;
  gchar *path;
  GError *error = NULL;
  const gchar *uri = NULL;

  bookmarks = mpl_app_bookmark_manager_get_bookmarks (priv->manager);

  to_remove = g_hash_table_get_keys (priv->uris_to_actors);

  for (l = bookmarks; l && count < MAX_COUNT; l = l->next)
  {
    uri = (gchar *)l->data;

    actor = g_hash_table_lookup (priv->uris_to_actors,
                                 uri);

    /* Check if this URI is on the system */
    path = g_filename_from_uri (uri, NULL, &error);

    if (error)
    {
      g_warning (G_STRLOC ": Error converting uri to path: %s",
                 error->message);
      g_clear_error (&error);

      if (actor)
      {
        clutter_container_remove_actor (CLUTTER_CONTAINER (pane),
                                        actor);
      }

      continue;
    }

    if (!g_file_test (path, G_FILE_TEST_EXISTS))
    {
      /* skip those that have a missing .desktop file */
      g_free (path);
      continue;
    }

    g_free (path);

    if (actor)
    {
      if (!priv->vertical)
      {
        clutter_container_child_set (CLUTTER_CONTAINER (pane),
                                     actor,
                                     "row",
                                     count / ROW_SIZE,
                                     "column",
                                     count % ROW_SIZE,
                                     NULL);
      } else {
        clutter_container_child_set (CLUTTER_CONTAINER (pane),
                                     actor,
                                     "row",
                                     count / 1,
                                     "column",
                                     count % 1,
                                     NULL);
      }
    } else {
      ClutterActor *overlay, *stack;

      stack = mx_stack_new ();

      actor = g_object_new (PENGE_TYPE_APP_TILE,
                            "bookmark",
                            uri,
                            NULL);
      clutter_actor_set_name (actor, "tile");

      overlay = mx_frame_new ();
      mx_stylable_set_style_class (MX_STYLABLE (overlay), "PengeAppTileOverlay");

      clutter_container_add (CLUTTER_CONTAINER (stack), actor, overlay, NULL);
      /* actor's sizes have been set in PengeAppTile */
      clutter_actor_set_size (overlay,
          clutter_actor_get_width (actor),
          clutter_actor_get_height (actor));
      clutter_actor_set_size (stack, TILE_STACKED_SIZE, TILE_STACKED_SIZE);

      if (!priv->vertical)
      {
        mx_table_add_actor (MX_TABLE (pane),
                            stack,
                            count / ROW_SIZE,
                            count % ROW_SIZE);
      } else {
        mx_table_add_actor (MX_TABLE (pane),
                            stack,
                            count / 1,
                            count % 1);
      }
      clutter_container_child_set (CLUTTER_CONTAINER (pane),
                                   stack,
                                   "x-expand", FALSE,
                                   "y-expand", FALSE,
                                   "x-fill", FALSE,
                                   "y-fill", FALSE,
                                   NULL);
      g_hash_table_insert (priv->uris_to_actors,
                           g_strdup (uri),
                           stack);
    }

    /* Found, so don't remove */
    /* This craziness is because the allocated string is probably different */
    to_remove = g_list_delete_link (to_remove,
                                    g_list_find_custom (to_remove,
                                                        uri,
                                                        (GCompareFunc)g_strcmp0));
    count++;
  }

  g_list_free (bookmarks);

  for (l = to_remove; l; l = g_list_delete_link (l, l))
  {
    actor = g_hash_table_lookup (priv->uris_to_actors,
                                 (gchar *)(l->data));
    clutter_container_remove_actor (CLUTTER_CONTAINER (pane),
                                    actor);
    g_hash_table_remove (priv->uris_to_actors, (gchar *)(l->data));
  }
}
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);
}