static void update_tile (HardDriveStatusTile * tile) { HardDriveStatusTilePrivate *priv = HARD_DRIVE_STATUS_TILE_GET_PRIVATE (tile); AtkObject *accessible; gchar *markup = NULL; gchar *available; gchar *capacity; compute_usage (tile); available = size_bytes_to_string (priv->available_bytes); capacity = size_bytes_to_string (priv->capacity_bytes); markup = g_strdup_printf (_("Home: %s Free / %s"), available, capacity); gtk_label_set_text (GTK_LABEL (NAMEPLATE_TILE (tile)->subheader), markup); accessible = gtk_widget_get_accessible (GTK_WIDGET (tile)); if (markup) atk_object_set_description (accessible, markup); g_free (available); g_free (capacity); g_free (markup); }
static GObject * nameplate_tile_constructor (GType type, guint n_param, GObjectConstructParam * param) { GObject *g_obj = (*G_OBJECT_CLASS (nameplate_tile_parent_class)->constructor) (type, n_param, param); nameplate_tile_setup (NAMEPLATE_TILE (g_obj)); return g_obj; }
static void nameplate_tile_finalize (GObject * g_object) { NameplateTile *np_tile; NameplateTilePrivate *priv; np_tile = NAMEPLATE_TILE (g_object); priv = NAMEPLATE_TILE_GET_PRIVATE (np_tile); (*G_OBJECT_CLASS (nameplate_tile_parent_class)->finalize) (g_object); }
static void nameplate_tile_get_property (GObject * g_object, guint prop_id, GValue * value, GParamSpec * param_spec) { NameplateTile *np_tile = NAMEPLATE_TILE (g_object); switch (prop_id) { case PROP_NAMEPLATE_IMAGE: g_value_set_object (value, np_tile->image); break; case PROP_NAMEPLATE_HEADER: g_value_set_object (value, np_tile->header); break; case PROP_NAMEPLATE_SUBHEADER: g_value_set_object (value, np_tile->subheader); break; default: break; } }
static void nameplate_tile_set_property (GObject * g_object, guint prop_id, const GValue * value, GParamSpec * param_spec) { NameplateTile *this = NAMEPLATE_TILE (g_object); NameplateTilePrivate *priv = NAMEPLATE_TILE_GET_PRIVATE (this); GObject *widget_obj = NULL; switch (prop_id) { case PROP_NAMEPLATE_IMAGE: case PROP_NAMEPLATE_HEADER: case PROP_NAMEPLATE_SUBHEADER: widget_obj = g_value_get_object (value); break; default: break; } switch (prop_id) { case PROP_NAMEPLATE_IMAGE: if (GTK_IS_WIDGET (widget_obj)) { if (GTK_IS_WIDGET (this->image)) gtk_widget_destroy (this->image); this->image = GTK_WIDGET (widget_obj); gtk_container_add (priv->image_ctnr, this->image); gtk_widget_show_all (this->image); } else if (GTK_IS_WIDGET (this->image)) gtk_widget_destroy (this->image); break; case PROP_NAMEPLATE_HEADER: if (GTK_IS_WIDGET (widget_obj)) { if (GTK_IS_WIDGET (this->header)) gtk_widget_destroy (this->header); this->header = GTK_WIDGET (widget_obj); gtk_container_add (priv->header_ctnr, this->header); gtk_widget_show_all (this->header); } else if (GTK_IS_WIDGET (this->header)) gtk_widget_destroy (this->header); break; case PROP_NAMEPLATE_SUBHEADER: if (GTK_IS_WIDGET (widget_obj)) { if (GTK_IS_WIDGET (this->subheader)) gtk_widget_destroy (this->subheader); this->subheader = GTK_WIDGET (widget_obj); gtk_container_add (priv->subheader_ctnr, this->subheader); gtk_widget_show_all (this->subheader); } else if (GTK_IS_WIDGET (this->subheader)) gtk_widget_destroy (this->subheader); break; default: break; } }