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 void mnb_launcher_button_init (MnbLauncherButton *self) { ClutterActor *label; self->priv = MNB_LAUNCHER_BUTTON_GET_PRIVATE (self); g_signal_connect (self, "leave-event", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "key-focus-out", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "enter-event", G_CALLBACK (_enter_event_cb), NULL); self->priv->icon = NULL; mx_stylable_set_style_class (MX_STYLABLE (self), "contentTile"); /* "app" label */ self->priv->title = (MxLabel *) mx_label_new (); mx_label_set_x_align (MX_LABEL (self->priv->title), MX_ALIGN_MIDDLE); clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->title), FALSE); mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (self->priv->title), 1, 0, "x-align", MX_ALIGN_MIDDLE, "x-expand", TRUE, "x-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, "y-expand", TRUE, "y-fill", TRUE, NULL); label = mx_label_get_clutter_text (self->priv->title); clutter_text_set_ellipsize (CLUTTER_TEXT (label), PANGO_ELLIPSIZE_END); clutter_text_set_line_alignment (CLUTTER_TEXT (label), PANGO_ALIGN_CENTER); clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (label), PANGO_WRAP_WORD_CHAR); /* "fav app" toggle */ self->priv->fav_toggle = g_object_ref_sink (CLUTTER_ACTOR (mx_button_new ())); mx_button_set_is_toggle (MX_BUTTON (self->priv->fav_toggle), TRUE); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fav_toggle), "mnb-launcher-button-fav-toggle"); clutter_actor_set_size (self->priv->fav_toggle, FAV_TOGGLE_SIZE, FAV_TOGGLE_SIZE); mx_table_insert_actor (MX_TABLE (self), CLUTTER_ACTOR (self->priv->fav_toggle), 0, 0); g_signal_connect (self->priv->fav_toggle, "notify::toggled", G_CALLBACK (fav_button_notify_toggled_cb), self); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); }
void mnb_launcher_button_set_icon (MnbLauncherButton *self, const gchar *icon_file, gint icon_size) { MxTextureCache *texture_cache; GError *error = NULL; if (self->priv->icon_file) { g_free (self->priv->icon_file); self->priv->icon_file = NULL; } if (self->priv->icon) { clutter_actor_destroy (self->priv->icon); self->priv->icon = NULL; } self->priv->icon_file = g_strdup (icon_file); self->priv->icon_size = icon_size; error = NULL; texture_cache = mx_texture_cache_get_default (); self->priv->icon = mx_texture_cache_get_actor (texture_cache, self->priv->icon_file); if (error) { g_warning (G_STRLOC "%s", error->message); g_clear_error (&error); } if (self->priv->icon) { if (self->priv->icon_size > -1) { clutter_actor_set_size (self->priv->icon, self->priv->icon_size, self->priv->icon_size); } mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (self->priv->icon), 0, 0, "x-align", MX_ALIGN_MIDDLE, "x-expand", FALSE, "x-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-expand", FALSE, "y-fill", FALSE, NULL); } }
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 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 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 penge_grid_view_init (PengeGridView *self) { PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self); GError *error = NULL; self->priv = priv; priv->header_label = mx_label_new_with_text ("Myzone"); clutter_actor_set_name (priv->header_label, "myzone-panel-header-label"); mx_table_insert_actor_with_properties (MX_TABLE (self), priv->header_label, 0, 0, "x-expand", FALSE, "y-expand", FALSE, "column-span", 3, NULL); priv->calendar_pane = g_object_new (PENGE_TYPE_CALENDAR_PANE, NULL); clutter_actor_set_width (priv->calendar_pane, 280); mx_table_insert_actor (MX_TABLE (self), priv->calendar_pane, 1, 0); priv->email_pane = g_object_new (PENGE_TYPE_EMAIL_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->email_pane, 2, 0); priv->favourite_apps_pane = g_object_new (PENGE_TYPE_APPS_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->favourite_apps_pane, 3, 0); priv->div_tex = clutter_texture_new_from_file (V_DIV_LINE, &error); if (!priv->div_tex) { g_warning (G_STRLOC ": Error loading vertical divider: %s", error->message); g_clear_error (&error); } else { mx_table_insert_actor (MX_TABLE (self), priv->div_tex, 1, 1); } priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->everything_pane, 1, 2); mx_table_set_row_spacing (MX_TABLE (self), 6); mx_table_set_column_spacing (MX_TABLE (self), 6); /* * Create a background and parent it to the grid. We paint and allocate this * in the overridden vfuncs */ priv->background = g_object_new (PENGE_TYPE_VIEW_BACKGROUND, NULL); clutter_actor_set_parent (priv->background, (ClutterActor *)self); clutter_actor_show (priv->background); priv->background_fade = clutter_texture_new_from_file (FADE_BG, NULL); clutter_actor_set_parent (priv->background_fade, (ClutterActor *)self); clutter_actor_show (priv->background_fade); priv->gconf_client = gconf_client_get_default (); priv->show_calendar_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR, _gconf_show_calendar_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR); } priv->show_email_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL, _gconf_show_email_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL); } }
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 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); }
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 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; }