ClutterActor * _make_settings_launcher (MnbPeoplePanel *people_panel) { ClutterActor *table; ClutterActor *icon_tex; ClutterActor *button; GAppInfo *app_info; gchar *button_str; app_info = (GAppInfo *)g_desktop_app_info_new ("empathy-accounts.desktop"); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 16); app_info = (GAppInfo *)g_desktop_app_info_new ("empathy-accounts.desktop"); icon_tex = g_object_new (MX_TYPE_ICON, "icon-name", "netbook-empathy-accounts", NULL); mx_table_insert_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)_settings_launcher_button_clicked_cb, people_panel); mx_table_insert_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 table; }
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; }
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; }
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; }
static void ntf_tray_constructed (GObject *object) { NtfTray *self = (NtfTray*) object; ClutterActor *actor = (ClutterActor*) self; NtfTrayPrivate *priv = self->priv; ClutterActor *button; if (G_OBJECT_CLASS (ntf_tray_parent_class)->constructed) G_OBJECT_CLASS (ntf_tray_parent_class)->constructed (object); priv->notifiers = clutter_actor_new (); clutter_actor_add_child(actor, priv->notifiers); /* 'Overflow' control */ priv->control = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->control), "notification-control"); #if 0 button = mx_button_new (); mx_button_set_label (MX_BUTTON (button), _("Dismiss All")); mx_table_add_actor (MX_TABLE (priv->control), button, 0, 1); g_signal_connect (button, "clicked", G_CALLBACK (ntf_tray_dismiss_all_cb), self); #endif //DV priv->control_text = mx_label_new (); mx_table_add_actor (MX_TABLE (priv->control), CLUTTER_ACTOR (priv->control_text), 0, 0); clutter_actor_set_width (priv->control, CLUSTER_WIDTH); clutter_actor_add_child(actor, priv->control); clutter_actor_hide (priv->control); clutter_actor_set_reactive (priv->notifiers, TRUE); clutter_actor_set_reactive (actor, TRUE); mnb_input_manager_push_actor (actor, MNB_INPUT_LAYER_TOP); }
static void mpl_entry_init (MplEntry *self) { MplEntryPrivate *priv; ClutterActor *text; self->priv = priv = MPL_ENTRY_GET_PRIVATE (self); priv->entry = mx_entry_new (); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->entry); mx_stylable_set_style_class (MX_STYLABLE (priv->entry), "MplEntryEntry"); text = mx_entry_get_clutter_text (MX_ENTRY (priv->entry)); clutter_text_set_single_line_mode (CLUTTER_TEXT (text), TRUE); g_signal_connect (text, "text-changed", G_CALLBACK (text_changed_cb), self); priv->table = CLUTTER_ACTOR (mx_table_new ()); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->table); priv->clear_button = CLUTTER_ACTOR (mx_button_new ()); clutter_actor_hide (priv->clear_button); mx_table_insert_actor (MX_TABLE (priv->table), priv->clear_button, 0, 0); mx_stylable_set_style_class (MX_STYLABLE (priv->clear_button), "MplEntryClearButton"); set_clear_button_size (priv->clear_button); g_signal_connect (priv->clear_button, "clicked", G_CALLBACK (clear_button_clicked_cb), self); priv->search_button = CLUTTER_ACTOR (mx_button_new ()); mx_table_insert_actor (MX_TABLE (priv->table), priv->search_button, 0, 1); mx_stylable_set_style_class (MX_STYLABLE (priv->search_button), "MplEntryButton"); g_signal_connect (priv->search_button, "clicked", G_CALLBACK (search_button_clicked_cb), self); }
static ClutterActor * make_status (DawatiStatusPanel *status_panel) { ClutterActor *pane; ClutterActor *table; ClutterActor *label; status_panel->client = sw_client_new (); #if 0 pane = mps_feed_pane_new (status_panel->client, sw_client_get_service (status_panel->client, "twitter")); #endif table = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (table), 6); clutter_actor_set_name (table, "status-panel"); label = mx_label_new_with_text (_("Status")); clutter_actor_set_name (label, "status-panel-header-label"); mx_table_add_actor_with_properties (MX_TABLE (table), label, 0, 0, "x-expand", FALSE, "y-expand", FALSE, NULL); pane = mps_feed_switcher_new (status_panel->client); mx_table_add_actor_with_properties (MX_TABLE (table), pane, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); return table; }
static void penge_calendar_pane_init (PengeCalendarPane *self) { PengeCalendarPanePrivate *priv = GET_PRIVATE_REAL (self); JanaTime *now; JanaTime *on_the_next_hour; glong next_timeout_seconds; ClutterActor *label; ClutterActor *tasks_icon; ClutterActor *button; self->priv = priv; now = jana_ecal_utils_time_now_local (); /* Events header */ priv->events_header_table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->events_header_table), 8); mx_stylable_set_style_class (MX_STYLABLE (priv->events_header_table), "PengeEventsPaneHeader"); priv->calendar_tex = clutter_texture_new (); /* Need to fix the size to avoid being squashed */ clutter_actor_set_size (priv->calendar_tex, 27, 28); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), priv->calendar_tex, 0, 0, "x-expand", FALSE, "x-fill", FALSE, "y-expand", TRUE, "y-fill", FALSE, NULL); penge_calendar_pane_update_calendar_icon (self, now); label = mx_label_new_with_text (_("Appointments")); mx_stylable_set_style_class (MX_STYLABLE (label), "PengeEventsPaneTitle"); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), label, 0, 1, "y-expand", TRUE, "y-fill", FALSE, "x-expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); button = mx_button_new_with_label (_("Open")); g_signal_connect (button, "clicked", (GCallback)_events_open_button_clicked_cb, NULL); mx_table_insert_actor_with_properties (MX_TABLE (priv->events_header_table), button, 0, 2, "y-expand", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-expand", FALSE, NULL); /* Tasks header */ priv->tasks_header_table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->tasks_header_table), 8); mx_stylable_set_style_class (MX_STYLABLE (priv->tasks_header_table), "PengeTasksPaneHeader"); tasks_icon = mx_icon_new (); clutter_actor_set_name (tasks_icon, "tasks-icon"); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), tasks_icon, 0, 0, "x-expand", FALSE, "x-fill", FALSE, "y-expand", TRUE, "y-fill", FALSE, NULL); label = mx_label_new_with_text (_("Tasks")); mx_stylable_set_style_class (MX_STYLABLE (label), "PengeTasksPaneTitle"); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), label, 0, 1, "y-expand", TRUE, "y-fill", FALSE, "x-expand", TRUE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); button = mx_button_new_with_label (_("Open")); g_signal_connect (button, "clicked", (GCallback)_tasks_open_button_clicked_cb, NULL); mx_table_insert_actor_with_properties (MX_TABLE (priv->tasks_header_table), button, 0, 2, "y-expand", TRUE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-expand", FALSE, NULL); priv->events_pane = g_object_new (PENGE_TYPE_EVENTS_PANE, "time", now, NULL); priv->tasks_pane = g_object_new (PENGE_TYPE_TASKS_PANE, NULL); clutter_actor_set_parent (CLUTTER_ACTOR (priv->events_header_table), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->events_pane), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->tasks_header_table), CLUTTER_ACTOR (self)); clutter_actor_set_parent (CLUTTER_ACTOR (priv->tasks_pane), CLUTTER_ACTOR (self)); on_the_next_hour = jana_ecal_utils_time_now_local (); jana_time_set_minutes (on_the_next_hour, 0); jana_time_set_seconds (on_the_next_hour, 0); jana_utils_time_adjust (on_the_next_hour, 0, 0, 0, 1, 0, 0); jana_utils_time_diff (now, on_the_next_hour, NULL, NULL, NULL, NULL, NULL, &next_timeout_seconds); priv->refresh_timeout_id = g_timeout_add_seconds (next_timeout_seconds % (60 * 10), _first_refresh_timeout_cb, self); g_object_unref (now); g_object_unref (on_the_next_hour); }
void mnb_home_widget_set_edit_mode (MnbHomeWidget *self, gboolean edit_mode) { //if (edit_mode == self->priv->edit_mode) // return; DEBUG ("%d -> %d for widget %s", self->priv->edit_mode, edit_mode, self->priv->settings_path); self->priv->edit_mode = edit_mode; //g_object_notify (G_OBJECT (self), "edit-mode"); /* FIXME: should hold refs to the actors rather than destroy/recreate them? */ mx_bin_set_child (MX_BIN (self), NULL); /* FIXME: animate this */ if (edit_mode) { ClutterActor *table; table = mx_table_new (); mx_bin_set_child (MX_BIN (self), table); if (!STR_EMPTY (self->priv->module)) { ClutterActor *config, *remove; remove = mx_button_new_with_label ("x"); mx_table_insert_actor_with_properties (MX_TABLE (table), remove, 0, 1, "x-expand", FALSE, "y-expand", FALSE, "x-fill", FALSE, "y-fill", FALSE, NULL); g_signal_connect (remove, "clicked", G_CALLBACK (home_widget_remove_module), self); if (self->priv->app != NULL) config = dawati_home_plugins_app_get_configuration ( self->priv->app); else config = mx_label_new_with_text (_("Plugin missing")); if (CLUTTER_IS_ACTOR (config)) mx_table_insert_actor_with_properties (MX_TABLE (table), config, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); } else /* STR_EMPTY (self->priv->module) */ { ClutterActor *button; button = mx_button_new_with_label ("+"); mx_table_insert_actor (MX_TABLE (table), button, 0, 0); g_signal_connect (button, "clicked", G_CALLBACK (home_widget_add_module), self); } clutter_actor_show_all (table); } else /* !edit_mode */ { ClutterActor *widget = NULL; if (self->priv->app != NULL) { widget = dawati_home_plugins_app_get_widget (self->priv->app); if (!CLUTTER_IS_ACTOR (widget)) /* FIXME: make this better */ { widget = mx_label_new_with_text (_("Broken plugin")); } } else if (!STR_EMPTY (self->priv->module)) { widget = mx_label_new_with_text (_("Plugin missing")); } if (widget != NULL) mx_bin_set_child (MX_BIN (self), widget); } }
void scroll_grid_main (ClutterContainer *stage) { ClutterActor *scroll, *grid, *table, *label, *visible_entry, *stride_entry; int i; scroll = mx_scroll_view_new (); clutter_container_add_actor (stage, scroll); clutter_actor_set_position (scroll, 10, 10); clutter_actor_set_size (scroll, 400, 400); grid = mx_grid_new (); clutter_container_add_actor (CLUTTER_CONTAINER (scroll), grid); for (i = 1; i <= 200; i++) { ClutterActor *button; gchar *text; text = g_strdup_printf ("Button %d", i); button = mx_button_new_with_label (text); clutter_container_add_actor (CLUTTER_CONTAINER (grid), button); mx_widget_set_tooltip_text (MX_WIDGET (button), "test"); if (i == 1) g_signal_connect (button, "clicked", G_CALLBACK (swap_orientation), grid); g_free (text); } table = mx_table_new (); label = mx_label_new_with_text ("Make button visible:"); visible_entry = mx_entry_new (); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 0, "x-expand", FALSE, NULL); mx_table_insert_actor (MX_TABLE (table), visible_entry, 0, 1); label = mx_label_new_with_text ("Set max-stride:"); stride_entry = mx_entry_new (); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 1, 0, "x-expand", FALSE, NULL); mx_table_insert_actor (MX_TABLE (table), stride_entry, 1, 1); clutter_actor_set_position (table, 10, 420); clutter_actor_set_width (table, 400); clutter_container_add_actor (stage, table); g_signal_connect (mx_entry_get_clutter_text (MX_ENTRY (visible_entry)), "activate", G_CALLBACK (ensure_visible), grid); g_signal_connect (mx_entry_get_clutter_text (MX_ENTRY (stride_entry)), "activate", G_CALLBACK (set_max_stride), grid); }
static void mpd_storage_device_tile_init (MpdStorageDeviceTile *self) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); ClutterText *text; ClutterActor *separator; mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (self), true); priv->table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->table), 5); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->table, -1, "x-fill", true, NULL); /* 0 1 2 +--------------------------+ Table 0 | | Text | Open | 1 | Icon | Progress | Eject | +------+-----------+-------+ Vbox 2 | <message> .. Import data | +--------------------------+ 3 | ======================== | +--------------------------+ */ /* * Column 0: icon */ priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, MPD_STORAGE_DEVICE_TILE_ICON_SIZE, MPD_STORAGE_DEVICE_TILE_ICON_SIZE); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->icon, 0, 0, "row-span", 2, "column-span", 1, "x-align", MX_ALIGN_START, "x-expand", false, "x-fill", false, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 1 */ /* Text */ priv->label = mx_label_new (); clutter_actor_set_width (priv->label, 200.0); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label)); clutter_text_set_line_wrap (text, true); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD); clutter_text_set_single_line_mode (text, false); clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_END); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->label, 0, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* Progress */ priv->meter = mx_progress_bar_new (); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->meter, 1, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 2: buttons */ /* Open button */ priv->open = mx_button_new_with_label (_("Open")); g_signal_connect (priv->open, "clicked", G_CALLBACK (_open_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->open, 0, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_END, "y-expand", false, "y-fill", false, NULL); /* Eject button */ priv->eject = mx_button_new_with_label (_("Eject")); g_signal_connect (priv->eject, "clicked", G_CALLBACK (_eject_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->eject, 1, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Row 2 */ /* Import button */ priv->import = mx_button_new (); clutter_actor_set_name (priv->import, "import"); g_signal_connect (priv->import, "clicked", G_CALLBACK (_import_clicked_cb), self); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->import, -1, "expand", false, "x-align", MX_ALIGN_END, "x-fill", false, NULL); /* * 4th row: separator */ /* Separator */ separator = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (separator), "separator"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), separator, -1, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", true, "y-align", MX_ALIGN_START, "y-fill", false, NULL); }
static void startup_cb (MxApplication *app) { MxWindow *window; ClutterActor *stage, *toggle, *label, *table, *button, *icon; window = mx_application_create_window (app, "Test Window"); stage = (ClutterActor *)mx_window_get_clutter_stage (window); mx_window_set_icon_name (window, "window-new"); clutter_actor_set_size (stage, 480, 320); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 8); mx_table_set_row_spacing (MX_TABLE (table), 12); mx_window_set_child (window, table); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle small-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (small_screen_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 0, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle full-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (fullscreen_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 1, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 1, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle custom window icon"); g_signal_connect (toggle, "notify::active", G_CALLBACK (icon_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 2, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 2, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle user-resizable"); g_signal_connect (toggle, "notify::active", G_CALLBACK (resizable_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 3, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 3, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle toolbar"); g_signal_connect (toggle, "notify::active", G_CALLBACK (toolbar_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 4, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 4, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-right"); mx_icon_set_icon_size (MX_ICON (icon), 16); button = mx_button_new (); mx_bin_set_child (MX_BIN (button), icon); g_signal_connect (button, "clicked", G_CALLBACK (rotate_clicked_cb), window); clutter_container_add_actor ( CLUTTER_CONTAINER (mx_window_get_toolbar (window)), button); mx_bin_set_alignment (MX_BIN (mx_window_get_toolbar (window)), MX_ALIGN_END, MX_ALIGN_MIDDLE); clutter_actor_show (stage); }
int main (int argc, char **argv) { ClutterActor *stage = stage; ClutterActor *side_box; ClutterActor *button_box; ClutterActor *box; ClutterAnimation *anim; MashLightSet *light_set; MxStyle *style; GError *error = NULL; Data data; int i; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; style = mx_style_get_default (); if (!mx_style_load_from_file (style, "lights.css", &error)) { g_warning ("Error setting style: %s", error->message); g_clear_error (&error); } stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 800, 600); side_box = mx_table_new (); clutter_actor_set_name (side_box, "side-box"); clutter_container_add_actor (CLUTTER_CONTAINER (stage), side_box); clutter_actor_set_size (side_box, 300, clutter_actor_get_height (stage)); clutter_actor_set_x (side_box, clutter_actor_get_width (stage) - clutter_actor_get_width (side_box)); button_box = mx_table_new (); mx_table_add_actor (MX_TABLE (side_box), button_box, 0, 0); data.notebook = mx_notebook_new (); mx_table_add_actor (MX_TABLE (side_box), data.notebook, 1, 0); data.model = mash_model_new_from_file (MASH_DATA_NONE, argc > 1 ? argv[1] : "suzanne.ply", &error); if (data.model == NULL) { g_warning ("Error loading model: %s", error->message); g_clear_error (&error); return 1; } light_set = mash_light_set_new (); box = clutter_box_new (clutter_fixed_layout_new ()); clutter_actor_set_size (data.model, 400, 400); clutter_actor_set_position (data.model, 50.0, 100.0); clutter_container_add_actor (CLUTTER_CONTAINER (box), data.model); clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); g_signal_connect_swapped (box, "paint", G_CALLBACK (cogl_set_depth_test_enabled), GINT_TO_POINTER (TRUE)); g_signal_connect_data (box, "paint", G_CALLBACK (cogl_set_depth_test_enabled), GINT_TO_POINTER (FALSE), NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); data.light_marker_material = cogl_material_new (); { CoglColor color; cogl_color_set_from_4ub (&color, 255, 0, 0, 255); /* Use the layer state to ignore the vertex color from the shader so that the light marker won't itself be lit */ cogl_material_set_layer_combine_constant (data.light_marker_material, 0, &color); cogl_material_set_layer_combine (data.light_marker_material, 0, "RGBA = REPLACE(CONSTANT)", NULL); } clutter_actor_set_rotation (data.model, CLUTTER_Y_AXIS, 0.0f, clutter_actor_get_width (data.model) / 2.0f, 0.0f, 0.0f); anim = clutter_actor_animate (data.model, CLUTTER_LINEAR, 3000, "rotation-angle-y", 360.0f, NULL); clutter_animation_set_loop (anim, TRUE); for (i = 0; i < N_LIGHTS; i++) { ClutterActor *table = mx_table_new (); ClutterActor *button; static ClutterActor *(* constructors[N_LIGHTS]) (void) = { mash_directional_light_new, mash_point_light_new, mash_spot_light_new }; static const ClutterColor black = { 0, 0, 0, 255 }; data.lights[i] = constructors[i] (); button = mx_button_new_with_label (G_OBJECT_TYPE_NAME (data.lights[i])); mx_table_add_actor (MX_TABLE (button_box), button, i, 0); /* Default to disable all of the lights */ g_object_set (data.lights[i], "ambient", &black, "diffuse", &black, "specular", &black, NULL); data.notebook_buttons[i] = button; clutter_container_add_actor (CLUTTER_CONTAINER (box), data.lights[i]); mash_light_set_add_light (light_set, MASH_LIGHT (data.lights[i])); add_color_prop (table, "ambient light", G_OBJECT (data.lights[i]), "ambient"); add_color_prop (table, "diffuse light", G_OBJECT (data.lights[i]), "diffuse"); add_color_prop (table, "specular light", G_OBJECT (data.lights[i]), "specular"); if (MASH_IS_POINT_LIGHT (data.lights[i])) { add_float_prop (table, "constant attenuation", G_OBJECT (data.lights[i]), "constant-attenuation", 0.0f, 10.0f); add_float_prop (table, "linear attenuation", G_OBJECT (data.lights[i]), "linear-attenuation", 0.0f, 10.0f); add_float_prop (table, "quadratic attenuation", G_OBJECT (data.lights[i]), "quadratic-attenuation", 0.0f, 10.0f); } if (MASH_IS_SPOT_LIGHT (data.lights[i])) { clutter_actor_set_x (data.lights[i], 250); add_float_prop (table, "spot cutoff", G_OBJECT (data.lights[i]), "spot-cutoff", 0.0f, 90.0f); add_float_prop (table, "spot exponent", G_OBJECT (data.lights[i]), "spot-exponent", 0.0f, 128.0f); } clutter_container_add_actor (CLUTTER_CONTAINER (data.notebook), table); data.notebook_pages[i] = table; } { ClutterActor *button; ClutterActor *table; CoglHandle material; float maximum_shininess; material = mash_model_get_pipeline (MASH_MODEL (data.model)); /* Before version 1.3.10 on the 1.3 branch and 1.2.14 on the 1.2 branch Cogl would remap the shininess property to the range [0,1]. After this it is just a value greater or equal to zero (but GL imposes a limit of 128.0) */ if (clutter_check_version (1, 3, 9) || (clutter_major_version == 1 && clutter_minor_version == 2 && clutter_micro_version >= 13)) maximum_shininess = 128.0f; else maximum_shininess = 1.0f; cogl_material_set_shininess (material, maximum_shininess); button = mx_button_new_with_label ("Material"); data.notebook_buttons[i] = button; mx_table_add_actor (MX_TABLE (button_box), button, i, 0); table = mx_table_new (); data.notebook_pages[i] = table; clutter_container_add_actor (CLUTTER_CONTAINER (data.notebook), table); add_material_color_prop (table, "emission", material, cogl_material_set_emission, cogl_material_get_emission); add_material_color_prop (table, "diffuse", material, cogl_material_set_diffuse, cogl_material_get_diffuse); add_material_color_prop (table, "ambient", material, cogl_material_set_ambient, cogl_material_get_ambient); add_material_color_prop (table, "specular", material, cogl_material_set_specular, cogl_material_get_specular); add_material_float_prop (table, "shininess", material, 0.0f, maximum_shininess, cogl_material_set_shininess, cogl_material_get_shininess); } mash_model_set_light_set (MASH_MODEL (data.model), light_set); g_object_unref (light_set); for (i = 0; i < N_PAGES; i++) { g_signal_connect (data.notebook_buttons[i], "notify::toggled", G_CALLBACK (notebook_button_cb), &data); mx_button_set_is_toggle (MX_BUTTON (data.notebook_buttons[i]), TRUE); } mx_button_set_toggled (MX_BUTTON (data.notebook_buttons[0]), TRUE); g_signal_connect (stage, "motion-event", G_CALLBACK (motion_event_cb), &data); clutter_actor_show (stage); clutter_main (); cogl_handle_unref (data.light_marker_material); return 0; }
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 gboolean _create_settings_dialog (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; ClutterActor *dialog, *network_graphic; ClutterActor *network_tile, *dialog_layout, *dialog_label; ClutterActor *network_button; MxAction *close_dialog, *network_settings; dialog = mx_dialog_new (); mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog"); dialog_label = mx_label_new_with_text (_("Settings")); mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader"); /* Create actions for settings dialog */ network_settings = _action_new_from_desktop_file ("mex-networks.desktop"); close_dialog = mx_action_new_full ("close", _("Close"), G_CALLBACK (_close_dialog_cb), self); dialog_layout = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (dialog_layout), 10); mx_table_set_row_spacing (MX_TABLE (dialog_layout), 30); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (dialog_label), 0, 0); if (network_settings) { gchar *tmp; network_graphic = mx_image_new (); mx_stylable_set_style_class (MX_STYLABLE (network_graphic), "NetworkGraphic"); tmp = g_build_filename (mex_get_data_dir (), "style", "graphic-network.png", NULL); mx_image_set_from_file (MX_IMAGE (network_graphic), tmp, NULL); g_free (tmp); network_tile = mex_tile_new (); mex_tile_set_label (MEX_TILE (network_tile), _("Network")); mex_tile_set_important (MEX_TILE (network_tile), TRUE); network_button = mx_button_new (); mx_button_set_action (MX_BUTTON (network_button), network_settings); mx_bin_set_child (MX_BIN (network_tile), network_button); mx_bin_set_child (MX_BIN (network_button), network_graphic); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (network_tile), 1, 1); } if (!network_settings) { ClutterActor *no_settings; no_settings = mx_label_new_with_text (_("No settings helpers installed")); clutter_actor_destroy (priv->settings_button); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (no_settings), 1, 0); } mx_bin_set_child (MX_BIN (dialog), dialog_layout); mx_dialog_add_action (MX_DIALOG (dialog), close_dialog); priv->settings_dialog = g_object_ref (dialog); return TRUE; }
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 * _make_empty_people_tile (MnbPeoplePanel *people_panel) { ClutterActor *tile; ClutterActor *frame; ClutterActor *label; ClutterActor *tmp_text; ClutterActor *settings_launcher; ClutterActor *picture; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_name ((ClutterActor *)tile, "people-pane-no-people-tile"); /* title */ frame = mx_frame_new (); clutter_actor_set_name (frame, "people-no-people-message-bin"); label = mx_label_new_with_text (_("This is the People panel.")); clutter_actor_set_name (label, "people-no-people-message-title"); mx_bin_set_child (MX_BIN (frame), label); mx_table_insert_actor_with_properties (MX_TABLE (tile), frame, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE); /* message */ frame = mx_frame_new (); clutter_actor_set_name (frame, "people-no-people-message-bin"); label = mx_label_new_with_text (PLACEHOLDER_MESSAGE); clutter_actor_set_name (label, "people-no-people-message-label"); tmp_text = mx_label_get_clutter_text (MX_LABEL (label)); clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text), PANGO_WRAP_WORD_CHAR); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); clutter_actor_set_width (label, 500); mx_bin_set_child (MX_BIN (frame), label); mx_table_insert_actor_with_properties (MX_TABLE (tile), frame, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, "x-align", MX_ALIGN_START, NULL); mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE); settings_launcher = _make_settings_launcher (people_panel); clutter_actor_set_name (settings_launcher, "people-panel-settings-launcher-tile"); mx_table_insert_actor_with_properties (MX_TABLE (tile), settings_launcher, 2, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); picture = clutter_texture_new_from_file (PLACEHOLDER_IMAGE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (tile), picture, 3, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_END, NULL); return tile; }
static void penge_count_tile_init (PengeCountTile *self) { ClutterActor *tmp_text; PengeCountTilePrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->table = mx_table_new (); g_object_ref (priv->table); priv->count_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->count_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); g_object_set (G_OBJECT (priv->count_label), "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_MIDDLE, NULL); penge_count_tile_set_count (self, 0); clutter_actor_show (priv->count_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->count_label, 0, 0, "row-span", 2, "x-expand", FALSE, NULL); priv->message_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->message_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->message_label), "PengeCountMessageLabel"); clutter_actor_show (priv->message_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->message_label, 0, 1, "x-expand", TRUE, NULL); priv->account_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->account_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->account_label), "PengeCountAccountLabel"); clutter_actor_show (priv->account_label); mx_table_insert_actor_with_properties (MX_TABLE (priv->table), priv->account_label, 1, 1, "x-expand", TRUE, NULL); mx_table_set_column_spacing (MX_TABLE (priv->table), 12); clutter_actor_show (priv->table); clutter_actor_add_child ((self), priv->table); //mx_bin_set_fill ((self), TRUE, FALSE); }
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); }
static void penge_event_tile_init (PengeEventTile *self) { PengeEventTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *indicator_container, *indicator_overlay; GError *error = NULL; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), (ClutterActor *)priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); indicator_container = mx_stack_new (); clutter_actor_set_size (indicator_container, 20, 20); priv->calendar_indicator = clutter_cairo_texture_new (20, 20); clutter_actor_set_size (priv->calendar_indicator, 20, 20); indicator_overlay = clutter_texture_new_from_file (CALENDAR_INDICATOR_OVERLAY_MASK, &error); if (error != NULL) { g_critical (G_STRLOC ": Loading calendar colour overlay failed: %s", error->message); g_clear_error (&error); indicator_overlay = NULL; } else { clutter_actor_set_size (indicator_overlay, 20, 20); } clutter_container_add (CLUTTER_CONTAINER (indicator_container), priv->calendar_indicator, indicator_overlay, NULL); priv->time_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->time_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); mx_stylable_set_style_class (MX_STYLABLE (priv->time_label), "PengeEventTimeLabel"); priv->summary_label = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->summary_label), "PengeEventSummary"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->summary_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); /* Populate the table */ mx_table_add_actor (MX_TABLE (priv->inner_table), indicator_container, 0, 0); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->time_label, 0, 1); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->summary_label, 0, 2); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), indicator_container, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->time_label, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->summary_label, "x-expand", TRUE, "x-fill", TRUE, "y-expand", FALSE, "y-fill", FALSE, NULL); /* Setup spacing and padding */ mx_table_set_column_spacing (MX_TABLE (priv->inner_table), 6); g_signal_connect (self, "clicked", (GCallback)_button_clicked_cb, self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); }
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 penge_interesting_tile_init (PengeInterestingTile *self) { PengeInterestingTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *icon; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); priv->primary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->primary_text), "PengeInterestingTilePrimaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->primary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->primary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->secondary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->secondary_text), "PengeInterestingTileSecondaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->secondary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->secondary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, 28, 28); clutter_actor_hide (priv->icon); /* This gets added to ourself table after our body because of ordering */ priv->details_overlay = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->details_overlay), "PengeInterestingTileDetails"); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->details_overlay, 1, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), (ClutterActor *)priv->details_overlay, "x-expand", TRUE, "y-expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_END, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->primary_text, 0, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->primary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->secondary_text, 1, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->secondary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->icon, 0, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->icon, "row-span", 2, "y-expand", FALSE, "x-expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, NULL); priv->remove_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button), "PengeInterestingTileRemoveButton"); icon = (ClutterActor *)mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "PengeInterestingTileIcon"); mx_bin_set_child (MX_BIN (priv->remove_button), (ClutterActor *)icon); mx_table_add_actor_with_properties (MX_TABLE (priv->details_overlay), priv->remove_button, 0, 2, "row-span", 2, "x-expand", TRUE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect (priv->remove_button, "clicked", (GCallback)_remove_button_clicked, self); mx_table_set_column_spacing (MX_TABLE (priv->details_overlay), 4); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); clutter_actor_hide (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 0, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 0, NULL); }
static void mnb_home_new_widget_dialog_init (MnbHomeNewWidgetDialog *self) { ClutterActor *table, *itemview; MnbHomeNewWidgetDialogItemFactory *factory; MnbHomePluginsEngine *engine; const GList *l; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MNB_TYPE_HOME_NEW_WIDGET_DIALOG, MnbHomeNewWidgetDialogPrivate); /* set up model and view */ self->priv->items = clutter_list_model_new (ITEMS_N_COLUMNS, G_TYPE_STRING, "Module", /* ITEMS_MODULE */ G_TYPE_STRING, "Name", /* ITEMS_NAME */ G_TYPE_STRING, "Icon" /* ITEMS_ICON */); table = mx_table_new (); mx_bin_set_child (MX_BIN (self), table); factory = g_object_new (MNB_TYPE_HOME_NEW_WIDGET_DIALOG_ITEM_FACTORY, NULL); factory->dialog = self; itemview = mx_item_view_new (); mx_table_add_actor (MX_TABLE (table), itemview, 0, 1); mx_item_view_set_model (MX_ITEM_VIEW (itemview), self->priv->items); mx_item_view_set_factory (MX_ITEM_VIEW (itemview), MX_ITEM_FACTORY (factory)); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "module", ITEMS_MODULE); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "label", ITEMS_NAME); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "icon", ITEMS_ICON); clutter_actor_show_all (table); /* find plugins */ /* FIXME: should we monitor for new plugins on the fly? */ engine = mnb_home_plugins_engine_dup (); for (l = peas_engine_get_plugin_list (PEAS_ENGINE (engine)); l != NULL; l = g_list_next (l)) { PeasPluginInfo *info = l->data; char *icon; if (!peas_plugin_info_is_available (info, NULL)) continue; icon = g_build_filename ( peas_plugin_info_get_module_dir (info), peas_plugin_info_get_icon_name (info), NULL); clutter_model_append (self->priv->items, ITEMS_MODULE, peas_plugin_info_get_module_name (info), ITEMS_NAME, peas_plugin_info_get_name (info), ITEMS_ICON, icon, -1); g_free (icon); } /* add actions */ mx_dialog_add_action (MX_DIALOG (self), mx_action_new_full ("cancel", _("Cancel"), G_CALLBACK (home_new_widget_dialog_cancel), self)); g_object_unref (engine); g_object_unref (factory); }