static void penge_grid_view_init (PengeGridView *self) { PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE, NULL); mx_table_add_actor (MX_TABLE (self), priv->everything_pane, 0, 0); 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 (); _update_layout (self); }
static void add_float_prop_base (ClutterActor *table, const char *name, FloatProp *prop, float value) { int table_y = mx_table_get_row_count (MX_TABLE (table)); ClutterActor *label; ClutterActor *slider; label = mx_label_new_with_text (name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); slider = mx_slider_new (); mx_table_add_actor (MX_TABLE (table), slider, table_y, 1); prop->label = mx_label_new (); mx_table_add_actor (MX_TABLE (table), prop->label, table_y, 2); mx_slider_set_value (MX_SLIDER (slider), (value - prop->min) / (prop->max - prop->min)); update_float_prop_label (prop, value); g_signal_connect_data (slider, "notify::value", G_CALLBACK (float_prop_value_cb), prop, (GClosureNotify) float_prop_free, 0); }
static void mnb_launcher_button_init (MnbLauncherButton *self) { ClutterActor *label; self->priv = MNB_LAUNCHER_BUTTON_GET_PRIVATE (self); g_signal_connect (self, "leave-event", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "key-focus-out", G_CALLBACK (_leave_event_cb), NULL); g_signal_connect (self, "enter-event", G_CALLBACK (_enter_event_cb), NULL); self->priv->icon = NULL; mx_stylable_set_style_class (MX_STYLABLE (self), "contentTile"); /* "app" label */ self->priv->title = (MxLabel *) mx_label_new (); mx_label_set_x_align (MX_LABEL (self->priv->title), MX_ALIGN_MIDDLE); clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->title), FALSE); mx_table_insert_actor_with_properties (MX_TABLE (self), CLUTTER_ACTOR (self->priv->title), 1, 0, "x-align", MX_ALIGN_MIDDLE, "x-expand", TRUE, "x-fill", TRUE, "y-align", MX_ALIGN_MIDDLE, "y-expand", TRUE, "y-fill", TRUE, NULL); label = mx_label_get_clutter_text (self->priv->title); clutter_text_set_ellipsize (CLUTTER_TEXT (label), PANGO_ELLIPSIZE_END); clutter_text_set_line_alignment (CLUTTER_TEXT (label), PANGO_ALIGN_CENTER); clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (label), PANGO_WRAP_WORD_CHAR); /* "fav app" toggle */ self->priv->fav_toggle = g_object_ref_sink (CLUTTER_ACTOR (mx_button_new ())); mx_button_set_is_toggle (MX_BUTTON (self->priv->fav_toggle), TRUE); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fav_toggle), "mnb-launcher-button-fav-toggle"); clutter_actor_set_size (self->priv->fav_toggle, FAV_TOGGLE_SIZE, FAV_TOGGLE_SIZE); mx_table_insert_actor (MX_TABLE (self), CLUTTER_ACTOR (self->priv->fav_toggle), 0, 0); g_signal_connect (self->priv->fav_toggle, "notify::toggled", G_CALLBACK (fav_button_notify_toggled_cb), self); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); }
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 void mx_table_actor_removed (ClutterContainer *container, ClutterActor *actor) { MxTablePrivate *priv = MX_TABLE (container)->priv; gint rows, cols; MxTableChild *meta; ClutterActorIter iter; ClutterActor *child; if ((ClutterActor *)priv->last_focus == actor) priv->last_focus = NULL; /* update row/column count */ rows = 0; cols = 0; clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container)); while (clutter_actor_iter_next (&iter, &child)) { meta = (MxTableChild *) clutter_container_get_child_meta (container, child); rows = MAX (rows, meta->row + meta->row_span); cols = MAX (cols, meta->col + meta->col_span); } priv->n_rows = rows; priv->n_cols = cols; clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
static void update (MpdStorageDeviceTile *self) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); char *markup; int64_t size = -1; int64_t available_size = -1; markup = mpd_storage_device_tile_get_title (self); clutter_text_set_markup (GET_CLUTTER_TEXT (priv->label), markup); g_free (markup); if (priv->storage) { g_object_get (priv->storage, "size", &size, "available-size", &available_size, NULL); } if (size > -1 && available_size > -1) { unsigned int percentage = 100 - (double) available_size / size * 100; mx_progress_bar_set_progress (MX_PROGRESS_BAR (priv->meter), percentage / 100.); } else { g_object_set (priv->meter, "visible", false, NULL); mx_table_child_set_row_span (MX_TABLE (priv->table), priv->label, 2); } }
static void mx_table_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { MxTablePrivate *priv = MX_TABLE (gobject)->priv; switch (prop_id) { case PROP_COLUMN_SPACING: g_value_set_int (value, priv->col_spacing); break; case PROP_ROW_SPACING: g_value_set_int (value, priv->row_spacing); break; case PROP_COL_COUNT: g_value_set_int (value, priv->n_cols); break; case PROP_ROW_COUNT: g_value_set_int (value, priv->n_rows); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
/** * mx_table_get_column_count: * @table: A #MxTable * * Retrieve the current number of columns in @table * * Returns: the number of columns */ gint mx_table_get_column_count (MxTable *table) { g_return_val_if_fail (MX_IS_TABLE (table), -1); return MX_TABLE (table)->priv->n_cols; }
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; }
/** * mx_table_get_column_spacing * @table: a #MxTable * * Gets the amount of spacing between columns. * * Returns: the spacing between columns in device units */ gint mx_table_get_column_spacing (MxTable *table) { MxTablePrivate *priv; g_return_val_if_fail (MX_IS_TABLE (table), -1); priv = MX_TABLE (table)->priv; return priv->col_spacing; }
static void mx_table_finalize (GObject *gobject) { MxTablePrivate *priv = MX_TABLE (gobject)->priv; g_array_free (priv->columns, TRUE); g_array_free (priv->rows, TRUE); G_OBJECT_CLASS (mx_table_parent_class)->finalize (gobject); }
static void mx_table_get_preferred_height (ClutterActor *self, gfloat for_width, gfloat *min_height_p, gfloat *natural_height_p) { gfloat total_min_height, total_pref_height; MxTablePrivate *priv = MX_TABLE (self)->priv; gint i; MxPadding padding; DimensionData *rows; if (priv->n_rows < 1) { *min_height_p = 0; *natural_height_p = 0; return; } /* use min_widths to help allocation of height-for-width widgets */ mx_table_calculate_dimensions (MX_TABLE (self), for_width, -1); rows = &g_array_index (priv->rows, DimensionData, 0); mx_widget_get_padding (MX_WIDGET (self), &padding); /* start off with padding plus row spacing */ total_min_height = padding.top + padding.bottom + (priv->visible_rows - 1) * (float)(priv->row_spacing); total_pref_height = total_min_height; for (i = 0; i < priv->n_rows; i++) { total_min_height += rows[i].min_size; total_pref_height += rows[i].pref_size; } if (min_height_p) *min_height_p = total_min_height; if (natural_height_p) *natural_height_p = total_pref_height; }
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 mx_table_get_preferred_width (ClutterActor *self, gfloat for_height, gfloat *min_width_p, gfloat *natural_width_p) { gfloat total_min_width, total_pref_width; MxTablePrivate *priv = MX_TABLE (self)->priv; gint i; MxPadding padding; DimensionData *columns; if (priv->n_cols < 1) { *min_width_p = 0; *natural_width_p = 0; return; } /* use min_widths to help allocation of height-for-width widgets */ mx_table_calculate_dimensions (MX_TABLE (self), -1, for_height); columns = &g_array_index (priv->columns, DimensionData, 0); mx_widget_get_padding (MX_WIDGET (self), &padding); /* start off with padding plus row spacing */ total_min_width = padding.left + padding.right + (priv->visible_cols - 1) * (float)(priv->col_spacing); total_pref_width = total_min_width; for (i = 0; i < priv->n_cols; i++) { total_min_width += columns[i].min_size; total_pref_width += columns[i].pref_size; } if (min_width_p) *min_width_p = total_min_width; if (natural_width_p) *natural_width_p = total_pref_width; }
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); }
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 void mx_table_paint (ClutterActor *self) { MxTablePrivate *priv = MX_TABLE (self)->priv; ClutterActorIter iter; ClutterActor *child; /* make sure the background gets painted first */ CLUTTER_ACTOR_CLASS (mx_table_parent_class)->paint (self); clutter_actor_iter_init (&iter, self); while (clutter_actor_iter_next (&iter, &child)) { if (CLUTTER_ACTOR_IS_VISIBLE (child)) clutter_actor_paint (child); } if (_mx_debug (MX_DEBUG_LAYOUT)) { int i; float width, height; gfloat pos = 0; DimensionData *rows, *cols; rows = &g_array_index (priv->rows, DimensionData, 0); cols = &g_array_index (priv->columns, DimensionData, 0); clutter_actor_get_size (self, &width, &height); cogl_set_source_color4f (0.0, 0.0, 1.0, 0.7); for (i = 0; i < priv->n_rows; i++) { cogl_rectangle (0, pos, 10, pos + rows[i].final_size); pos += rows[i].final_size + priv->row_spacing; } cogl_set_source_color4f (1.0, 0.0, 0.0, 0.7); pos = 0; for (i = 0; i < priv->n_rows; i++) { cogl_rectangle (pos, 0, pos + cols[i].final_size, 10); pos += cols[i].final_size + priv->col_spacing; } } }
/* * ClutterContainer Implementation */ static void mx_table_actor_added (ClutterContainer *container, ClutterActor *actor) { MxTableChild *meta; meta = (MxTableChild *) clutter_container_get_child_meta (container, actor); /* default position of the actor is 0, 0 */ _mx_table_update_row_col (MX_TABLE (container), meta); clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
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 void create_network_row (MpdComputerTile *tile, const gchar *label_text, gint row) { MpdComputerTilePrivate *priv = tile->priv; ClutterActor *label, *toggle, *frame; label = mx_label_new_with_text (label_text); mx_table_add_actor_with_properties (MX_TABLE (tile), label, row, 0, "x-expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); frame = mx_frame_new (); toggle = mx_toggle_new (); mx_bin_set_child (MX_BIN (frame), toggle); mx_table_add_actor_with_properties (MX_TABLE (tile), frame, row, 1, "x-expand", FALSE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); priv->toggled_data[row].tile = tile; priv->toggled_data[row].row = row; g_signal_connect (toggle, "notify::active", G_CALLBACK (on_switch_toggled), &priv->toggled_data[row]); priv->rows[row].label = label; priv->rows[row].frame = frame; priv->rows[row].toggle = toggle; }
static void penge_apps_pane_init (PengeAppsPane *self) { PengeAppsPanePrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->manager = mpl_app_bookmark_manager_get_default (); g_signal_connect (priv->manager, "bookmarks-changed", (GCallback)_manager_bookmarks_changed_cb, self); priv->uris_to_actors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); mx_table_set_column_spacing (MX_TABLE (self), TILE_COLUMN_SPACING); mx_table_set_row_spacing (MX_TABLE (self), TILE_ROW_SPACING); penge_apps_pane_update (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 MxFocusable* mx_table_accept_focus (MxFocusable *focusable, MxFocusHint hint) { MxTablePrivate *priv = MX_TABLE (focusable)->priv; MxFocusable *return_focusable; GList* list, *l, *children; return_focusable = NULL; children = clutter_actor_get_children (CLUTTER_ACTOR (focusable)); /* find the first/last focusable widget */ switch (hint) { case MX_FOCUS_HINT_LAST: list = g_list_reverse (g_list_copy (children)); break; case MX_FOCUS_HINT_PRIOR: if (priv->last_focus) { list = g_list_copy (g_list_find (children, priv->last_focus)); if (list) break; } /* This intentionally runs into the next switch case */ default: case MX_FOCUS_HINT_FIRST: list = g_list_copy (children); break; } for (l = list; l; l = g_list_next (l)) { if (MX_IS_FOCUSABLE (l->data)) { return_focusable = mx_focusable_accept_focus (MX_FOCUSABLE (l->data), hint); if (return_focusable) break; } } g_list_free (list); g_list_free (children); return return_focusable; }
static void mx_table_allocate (ClutterActor *self, const ClutterActorBox *box, ClutterAllocationFlags flags) { MxTablePrivate *priv = MX_TABLE (self)->priv; CLUTTER_ACTOR_CLASS (mx_table_parent_class)->allocate (self, box, flags); if (priv->n_cols < 1 || priv->n_rows < 1) { return; }; mx_table_preferred_allocate (self, box, flags); }
static void mx_table_style_changed (MxWidget *widget, gpointer userdata) { MxTable *table = MX_TABLE (widget); MxTablePrivate *priv = table->priv; guint row_spacing, col_spacing; mx_stylable_get (MX_STYLABLE (widget), "x-mx-column-spacing", &col_spacing, "x-mx-row-spacing", &row_spacing, NULL); if (!priv->ignore_css_col_spacing) priv->col_spacing = col_spacing; if (!priv->ignore_css_row_spacing) priv->row_spacing = row_spacing; }
static void add_color_prop_base (ClutterActor *table, const char *name, ColorProp *prop, const ClutterColor *value) { int table_y = mx_table_get_row_count (MX_TABLE (table)); ClutterActor *label; static const char *color_names[] = { "red", "green", "blue" }; int i; label = mx_label_new_with_text (name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); prop->rect = clutter_rectangle_new (); clutter_rectangle_set_color (CLUTTER_RECTANGLE (prop->rect), value); clutter_actor_set_size (prop->rect, 20, 0); mx_table_add_actor (MX_TABLE (table), prop->rect, table_y++, 1); for (i = 0; i < G_N_ELEMENTS (color_names); i++) { ClutterActor *slider; char *label_name = g_strconcat (name, " ", color_names[i], NULL); ColorPropComp *prop_comp = g_slice_new (ColorPropComp); label = mx_label_new_with_text (label_name); mx_table_add_actor (MX_TABLE (table), label, table_y, 0); g_free (label_name); slider = mx_slider_new (); mx_table_add_actor (MX_TABLE (table), slider, table_y, 1); mx_slider_set_value (MX_SLIDER (slider), ((guint8 *) value)[i] / 255.0f); prop_comp->comp_num = i; prop_comp->prop = prop; prop_comp->label = mx_label_new (); mx_table_add_actor (MX_TABLE (table), prop_comp->label, table_y, 2); update_prop_comp_label (prop_comp, ((guint8 *) value)[i]); g_signal_connect_data (slider, "notify::value", G_CALLBACK (color_prop_value_cb), prop_comp, (GClosureNotify) color_prop_comp_free, 0); table_y++; } }
/** * mx_table_set_row_spacing * @table: a #MxTable * @spacing: spacing in pixels * * Sets the amount of spacing between rows. */ void mx_table_set_row_spacing (MxTable *table, gint spacing) { MxTablePrivate *priv; g_return_if_fail (MX_IS_TABLE (table)); g_return_if_fail (spacing >= 0); priv = MX_TABLE (table)->priv; if (priv->row_spacing != spacing) { priv->row_spacing = spacing; priv->ignore_css_row_spacing = TRUE; clutter_actor_queue_relayout (CLUTTER_ACTOR (table)); g_object_notify (G_OBJECT (table), "row-spacing"); } }
static void mx_table_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { MxTable *table = MX_TABLE (gobject); switch (prop_id) { case PROP_COLUMN_SPACING: mx_table_set_column_spacing (table, g_value_get_int (value)); break; case PROP_ROW_SPACING: mx_table_set_row_spacing (table, g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
static void penge_interesting_tile_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { PengeInterestingTilePrivate *priv = GET_PRIVATE (object); GError *error = NULL; const gchar *path; switch (property_id) { case PROP_BODY: if (priv->body) { clutter_container_remove_actor (CLUTTER_CONTAINER (priv->inner_table), priv->body); } priv->body = g_value_get_object (value); if (!priv->body) return; mx_table_add_actor_with_properties (MX_TABLE (priv->inner_table), priv->body, 0, 0, "y-align", MX_ALIGN_START, "x-align", MX_ALIGN_START, "y-fill", TRUE, "y-expand", TRUE, NULL); break; case PROP_ICON_PATH: path = g_value_get_string (value); if (path && !clutter_texture_set_from_file (CLUTTER_TEXTURE (priv->icon), path, &error)) { g_critical (G_STRLOC ": error setting icon texture from file: %s", error->message); g_clear_error (&error); } if (path) { clutter_actor_show (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 1, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 1, NULL); } else { 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); } break; case PROP_PRIMARY_TEXT: mx_label_set_text (MX_LABEL (priv->primary_text), g_value_get_string (value)); break; case PROP_SECONDARY_TEXT: mx_label_set_text (MX_LABEL (priv->secondary_text), g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }