Esempio n. 1
0
static void
nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class)
{
	GObjectClass *object_class = G_OBJECT_CLASS (config_class);
	NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class);

	g_type_class_add_private (config_class, sizeof (NMDhcp4ConfigPrivate));

	exported_object_class->export_path = NM_DBUS_PATH "/DHCP4Config/%u";
	exported_object_class->export_on_construction = TRUE;

	/* virtual methods */
	object_class->get_property = get_property;
	object_class->finalize = finalize;

	/* properties */
	g_object_class_install_property
		(object_class, PROP_OPTIONS,
		 g_param_spec_variant (NM_DHCP4_CONFIG_OPTIONS, "", "",
		                       G_VARIANT_TYPE ("a{sv}"),
		                       NULL,
		                       G_PARAM_READABLE |
		                       G_PARAM_STATIC_STRINGS));

	nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class),
	                                        NMDBUS_TYPE_DHCP4_CONFIG_SKELETON,
	                                        NULL);
}
static void
replay_edge_create_event_class_init(ReplayEdgeCreateEventClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS(klass);
  ReplayEventClass *event_class = REPLAY_EVENT_CLASS(klass);

  object_class->get_property = replay_edge_create_event_get_property;
  object_class->set_property = replay_edge_create_event_set_property;
  object_class->finalize = replay_edge_create_event_finalize;
  event_class->get_node_id = replay_edge_create_event_get_node_id;

  g_object_class_install_property(object_class,
                                  PROP_ID,
                                  g_param_spec_string("id",
                                                      "id",
                                                      "Human readable id of the object",
                                                      "no-id-set",
                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property(object_class,
                                  PROP_DIRECTED,
                                  g_param_spec_boolean("directed",
                                                      "directed",
                                                      "Human readable directed of the object",
                                                     FALSE,
                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property(object_class,
                                  PROP_TAIL,
                                  g_param_spec_string("tail",
                                                      "tail",
                                                      "Human readable tail of the object",
                                                      "no-tail-set",
                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property(object_class,
                                  PROP_HEAD,
                                  g_param_spec_string("head",
                                                      "head",
                                                      "Human readable head of the object",
                                                      "no-head-set",
                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property(object_class,
                                  PROP_PROPS,
                                  g_param_spec_variant("props",
                                                       "props",
                                                       "The properties of the object",
                                                       G_VARIANT_TYPE_VARDICT,
                                                       g_variant_new("a{sv}", NULL),
                                                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

  g_type_class_add_private(klass, sizeof(ReplayEdgeCreateEventPrivate));
}
Esempio n. 3
0
/* OlLyricSourceCandidate */
static void
ol_lyric_source_candidate_class_init (OlLyricSourceCandidateClass *klass)
{
  GObjectClass *object_class;
  object_class = G_OBJECT_CLASS (klass);
  object_class->get_property = ol_lyric_source_candidate_get_property;
  object_class->set_property = ol_lyric_source_candidate_set_property;
  object_class->finalize = ol_lyric_source_candidate_finalize;
  g_type_class_add_private (klass, sizeof (OlLyricSourceCandidatePrivate));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_TITLE,
                                   g_param_spec_string ("title",
                                                        ("Title"),
                                                        ("Title"),
                                                        "",
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_ARTIST,
                                   g_param_spec_string ("artist",
                                                        ("Artist"),
                                                        ("Artist"),
                                                        "",
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_ALBUM,
                                   g_param_spec_string ("album",
                                                        ("Album"),
                                                        ("Album"),
                                                        "",
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_COMMENT,
                                   g_param_spec_string ("comment",
                                                        ("Comment"),
                                                        ("Comment"),
                                                        "",
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_SOURCEID,
                                   g_param_spec_string ("sourceid",
                                                        ("SourceId"),
                                                        ("Source ID"),
                                                        "",
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
  g_object_class_install_property (object_class,
                                   CANDIDATE_PROP_DOWNLOADINFO,
                                   g_param_spec_variant ("downloadinfo",
                                                         ("Download Info"),
                                                         ("Download Info"),
                                                         G_VARIANT_TYPE_ANY,
                                                         NULL,
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
Esempio n. 4
0
static void
gtk_actionable_default_init (GtkActionableInterface *iface)
{
  g_object_interface_install_property (iface,
    g_param_spec_string ("action-name", P_("Action name"),
                         P_("The name of the associated action, like 'app.quit'"),
                         NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_interface_install_property (iface,
    g_param_spec_variant ("action-target", P_("Action target value"),
                          P_("The parameter for action invocations"),
                          G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
Esempio n. 5
0
static void
setting_class_init (SettingClass *klass)
{
  GObjectClass *gobject_class;

  gobject_class = G_OBJECT_CLASS (klass);
  gobject_class->finalize = setting_finalize;
  gobject_class->constructed = setting_constructed;
  gobject_class->set_property = setting_set_property;
  gobject_class->get_property = setting_get_property;

  g_object_class_install_property (gobject_class,
                                   PROP_DAEMON,
                                   g_param_spec_object ("daemon",
                                                        NULL,
                                                        NULL,
                                                        TYPE_DAEMON,
                                                        G_PARAM_WRITABLE |
                                                        G_PARAM_CONSTRUCT_ONLY |
                                                        G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class,
                                   PROP_CONFIGURATION,
                                   g_param_spec_variant ("configuration",
                                                         NULL,
                                                         NULL,
                                                         G_VARIANT_TYPE_VARDICT,
                                                         NULL,
                                                         G_PARAM_WRITABLE |
                                                         G_PARAM_CONSTRUCT_ONLY |
                                                         G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class,
                                   PROP_OBJECT_PATH,
                                   g_param_spec_string ("object-path",
                                                        NULL,
                                                        NULL,
                                                        "",
                                                        G_PARAM_READABLE |
                                                        G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class,
                                   PROP_UUID,
                                   g_param_spec_string ("uuid",
                                                        NULL,
                                                        NULL,
                                                        "",
                                                        G_PARAM_READABLE |
                                                        G_PARAM_STATIC_STRINGS));
}
Esempio n. 6
0
static void
workman_attribute_class_init(WorkmanAttributeClass *klass)
{
    GObjectClass *g_klass = G_OBJECT_CLASS(klass);
    GParamSpec *pspec;

    g_klass->finalize = workman_attribute_finalize;
    g_klass->set_property = workman_attribute_set_property;
    g_klass->get_property = workman_attribute_get_property;

    pspec = g_param_spec_string("name",
                                "Name",
                                "The attribute name",
                                NULL,
                                G_PARAM_READWRITE |
                                G_PARAM_CONSTRUCT_ONLY |
                                G_PARAM_STATIC_STRINGS);
    g_object_class_install_property(g_klass, PROP_NAME, pspec);

    pspec = g_param_spec_variant("value",
                                 "Value",
                                 "The attribute value",
                                 G_VARIANT_TYPE_MAYBE,
                                 NULL,
                                 G_PARAM_READWRITE |
                                 G_PARAM_CONSTRUCT_ONLY |
                                 G_PARAM_STATIC_STRINGS);
    g_object_class_install_property(g_klass, PROP_VALUE, pspec);

    pspec = g_param_spec_boolean("writable",
                                 "Writable",
                                 "Whether the attribute's value is writable",
                                 FALSE,
                                 G_PARAM_READWRITE |
                                 G_PARAM_CONSTRUCT_ONLY |
                                 G_PARAM_STATIC_STRINGS);
    g_object_class_install_property(g_klass, PROP_WRITABLE, pspec);

    pspec = g_param_spec_flags("state",
                               "State",
                               "The object's WorkmanState",
                               WORKMAN_TYPE_STATE,
                               0,
                               G_PARAM_READWRITE |
                               G_PARAM_CONSTRUCT_ONLY |
                               G_PARAM_STATIC_STRINGS);
    g_object_class_install_property(g_klass, PROP_STATE, pspec);

    g_type_class_add_private(klass, sizeof(WorkmanAttributePrivate));
}
Esempio n. 7
0
static void
ncm_matrix_class_init (NcmMatrixClass *klass)
{
  GObjectClass* object_class = G_OBJECT_CLASS (klass);

  object_class->set_property = &_ncm_matrix_set_property;
  object_class->get_property = &_ncm_matrix_get_property;
  object_class->dispose      = &_ncm_matrix_dispose;
  object_class->finalize     = &_ncm_matrix_finalize;

  g_object_class_install_property (object_class, PROP_VALS,
                                   g_param_spec_variant ("values", NULL, "values",
                                                         G_VARIANT_TYPE_ARRAY, NULL,
                                                         G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB));
}
static void
nm_lldp_listener_class_init (NMLldpListenerClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS (klass);

	g_type_class_add_private (klass, sizeof (NMLldpListenerPrivate));

	object_class->dispose = dispose;
	object_class->finalize = finalize;
	object_class->get_property = get_property;

	g_object_class_install_property
		(object_class, PROP_NEIGHBORS,
		 g_param_spec_variant (NM_LLDP_LISTENER_NEIGHBORS, "", "",
		                       G_VARIANT_TYPE ("aa{sv}"),
		                       NULL,
		                       G_PARAM_READABLE |
		                       G_PARAM_STATIC_STRINGS));
}
g_application_command_line_class_init (GApplicationCommandLineClass *class)
{
    GObjectClass *object_class = G_OBJECT_CLASS (class);

    object_class->get_property = g_application_command_line_get_property;
    object_class->set_property = g_application_command_line_set_property;
    object_class->finalize = g_application_command_line_finalize;
    object_class->constructed = g_application_command_line_constructed;

    class->printerr_literal = g_application_command_line_real_printerr_literal;
    class->print_literal = g_application_command_line_real_print_literal;

    g_object_class_install_property (object_class, PROP_ARGUMENTS,
                                     g_param_spec_variant ("arguments",
                                             P_("Commandline arguments"),
                                             P_("The commandline that caused this ::command-line signal emission"),
                                             G_VARIANT_TYPE_BYTESTRING_ARRAY, NULL,
                                             G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
                                             G_PARAM_STATIC_STRINGS));

    g_object_class_install_property (object_class, PROP_PLATFORM_DATA,
                                     g_param_spec_variant ("platform-data",
                                             P_("Platform data"),
                                             P_("Platform-specific data for the commandline"),
                                             G_VARIANT_TYPE ("a{sv}"), NULL,
                                             G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
                                             G_PARAM_STATIC_STRINGS));

    g_object_class_install_property (object_class, PROP_IS_REMOTE,
                                     g_param_spec_boolean ("is-remote",
                                             P_("Is remote"),
                                             P_("TRUE if this is a remote commandline"),
                                                       G_TYPE_VARIANT_TYPE,
                                                       G_PARAM_READABLE |
                                                       G_PARAM_STATIC_STRINGS));

  /**
   * GSimpleAction:state:
   *
   * The state of the action, or %NULL if the action is stateless.
   *
   * Since: 2.28
   **/
  g_object_class_install_property (object_class, PROP_STATE,
                                   g_param_spec_variant ("state",
                                                         P_("State"),
                                                         P_("The state the action is in"),
                                                         G_VARIANT_TYPE_ANY,
                                                         NULL,
                                                         G_PARAM_CONSTRUCT |
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_STATIC_STRINGS));

  g_type_class_add_private (class, sizeof (GSimpleActionPrivate));
}

/**
 * g_simple_action_set_enabled:
 * @simple: a #GSimpleAction
 * @enabled: whether the action is enabled
 *
 * Sets the action as enabled or not.
 *
 * An action must be enabled in order to be activated or in order to
Esempio n. 11
0
static void
gb_color_picker_prefs_palette_row_class_init (GbColorPickerPrefsPaletteRowClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  IdePreferencesBinClass *bin_class = IDE_PREFERENCES_BIN_CLASS (klass);

  object_class->finalize = gb_color_picker_prefs_palette_row_finalize;
  object_class->get_property = gb_color_picker_prefs_palette_row_get_property;
  object_class->set_property = gb_color_picker_prefs_palette_row_set_property;

  bin_class->connect = gb_color_picker_prefs_palette_row_connect;
  bin_class->disconnect = gb_color_picker_prefs_palette_row_disconnect;

  properties [PROP_IS_EDITING] =
    g_param_spec_boolean ("is-editing",
                          "is-editing",
                          "Whether the row is currently in edit mode or not",
                          FALSE,
                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  properties [PROP_TARGET] =
    g_param_spec_variant ("target",
                          "Target",
                          "Target",
                          G_VARIANT_TYPE_STRING,
                          NULL,
                          (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  properties [PROP_KEY] =
    g_param_spec_string ("key",
                         "Key",
                         "Key",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  properties[PROP_NEEDS_ATTENTION] =
    g_param_spec_boolean ("needs-attention",
                          "Needs Attention",
                          "Whether this row needs attention",
                         FALSE,
                         (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));

  properties [PROP_PALETTE_NAME] =
    g_param_spec_string ("palette-name",
                         "Palette name",
                         "Palette name",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));

  signals [ACTIVATED] =
    g_signal_new_class_handler ("activated",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (gb_color_picker_prefs_palette_row_activate),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);
  signals [CLOSED] =
    g_signal_new ("closed",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  0,
                  NULL, NULL, NULL,
                  G_TYPE_NONE,
                  1,
                  G_TYPE_POINTER);

  signals [NAME_CHANGED] =
    g_signal_new ("name-changed",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  0,
                  NULL, NULL, NULL,
                  G_TYPE_NONE,
                  2,
                  G_TYPE_POINTER,
                  G_TYPE_POINTER);

  signals [EDIT] =
    g_signal_new_class_handler ("edit",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gb_color_picker_prefs_palette_row_edit),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);

  widget_class->activate_signal = signals [ACTIVATED];

  g_object_class_install_properties (object_class, N_PROPS, properties);

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/plugins/color-picker-plugin/gtk/color-picker-palette-row.ui");
  gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, image);
  gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, event_box);
  gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, palette_name);

  gtk_widget_class_set_css_name (widget_class, "colorpickerpaletterow");
}
static void
gb_preferences_switch_class_init (GbPreferencesSwitchClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

  object_class->finalize = gb_preferences_switch_finalize;
  object_class->set_property = gb_preferences_switch_set_property;

  widget_class->button_release_event = gb_preferences_switch_button_release_event;
  widget_class->draw = gb_preferences_switch_draw;
  widget_class->enter_notify_event = gb_preferences_switch_enter_notify_event;
  widget_class->leave_notify_event = gb_preferences_switch_leave_notify_event;

  gParamSpecs [PROP_TITLE] =
    g_param_spec_string ("title",
                         _("Title"),
                         _("The title of the switch."),
                         NULL,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_DESCRIPTION] =
    g_param_spec_string ("description",
                         _("Description"),
                         _("The description for the switch."),
                         NULL,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_IS_RADIO] =
    g_param_spec_boolean ("is-radio",
                          _("Is Radio"),
                          _("If a radio button should be used."),
                          FALSE,
                          (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_SETTINGS] =
    g_param_spec_object ("settings",
                         _("Settings"),
                         _("The GSettings for the setting."),
                         G_TYPE_SETTINGS,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_SETTINGS_SCHEMA_KEY] =
    g_param_spec_string ("settings-schema-key",
                         _("Settings Schema Key"),
                         _("The settings schema key."),
                         NULL,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_SETTINGS_SCHEMA_VALUE] =
    g_param_spec_variant ("settings-schema-value",
                          _("Settings Schema Value"),
                          _("An action-target for the settings action."),
                          G_VARIANT_TYPE_ANY,
                          NULL,
                          (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  gParamSpecs [PROP_SIZE_GROUP] =
    g_param_spec_object ("size-group",
                         _("Size Group"),
                         _("The sizing group for the control."),
                         GTK_TYPE_SIZE_GROUP,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);

  GB_WIDGET_CLASS_TEMPLATE (klass, "gb-preferences-switch.ui");

  GB_WIDGET_CLASS_BIND (klass, GbPreferencesSwitch, controls_box);
  GB_WIDGET_CLASS_BIND (klass, GbPreferencesSwitch, description_label);
  GB_WIDGET_CLASS_BIND (klass, GbPreferencesSwitch, settings_radio);
  GB_WIDGET_CLASS_BIND (klass, GbPreferencesSwitch, settings_switch);
  GB_WIDGET_CLASS_BIND (klass, GbPreferencesSwitch, title_label);
}
/* XXX Historical note, originally I tried (ab)using override properties
 *     in ESourceCamel, which redirected to the equivalent CamelSettings
 *     property.  Seemed to work at first, and I was proud of my clever
 *     hack, but it turns out g_object_class_list_properties() excludes
 *     override properties.  So the ESourceCamel properties were being
 *     skipped in source_load_from_key_file() (e-source.c). */
static GParamSpec *
param_spec_clone (GParamSpec *pspec)
{
	GParamSpec *clone;
	GParamFlags flags;
	const gchar *name, *nick, *blurb;

	name = g_param_spec_get_name (pspec);
	nick = g_param_spec_get_nick (pspec);
	blurb = g_param_spec_get_blurb (pspec);
	flags = (pspec->flags & ~(G_PARAM_STATIC_STRINGS));

	if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) {
		GParamSpecBoolean *pspec_boolean = G_PARAM_SPEC_BOOLEAN (pspec);

		clone = g_param_spec_boolean (name, nick, blurb,
			pspec_boolean->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_CHAR (pspec)) {
		GParamSpecChar *pspec_char = G_PARAM_SPEC_CHAR (pspec);

		clone = g_param_spec_char (name, nick, blurb,
			pspec_char->minimum,
			pspec_char->maximum,
			pspec_char->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_UCHAR (pspec)) {
		GParamSpecUChar *pspec_uchar = G_PARAM_SPEC_UCHAR (pspec);

		clone = g_param_spec_uchar (name, nick, blurb,
			pspec_uchar->minimum,
			pspec_uchar->maximum,
			pspec_uchar->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_INT (pspec)) {
		GParamSpecInt *pspec_int = G_PARAM_SPEC_INT (pspec);

		clone = g_param_spec_int (name, nick, blurb,
			pspec_int->minimum,
			pspec_int->maximum,
			pspec_int->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_UINT (pspec)) {
		GParamSpecUInt *pspec_uint = G_PARAM_SPEC_UINT (pspec);

		clone = g_param_spec_uint (name, nick, blurb,
			pspec_uint->minimum,
			pspec_uint->maximum,
			pspec_uint->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_LONG (pspec)) {
		GParamSpecLong *pspec_long = G_PARAM_SPEC_LONG (pspec);

		clone = g_param_spec_long (name, nick, blurb,
			pspec_long->minimum,
			pspec_long->maximum,
			pspec_long->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_ULONG (pspec)) {
		GParamSpecULong *pspec_ulong = G_PARAM_SPEC_ULONG (pspec);

		clone = g_param_spec_ulong (name, nick, blurb,
			pspec_ulong->minimum,
			pspec_ulong->maximum,
			pspec_ulong->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_INT64 (pspec)) {
		GParamSpecInt64 *pspec_int64 = G_PARAM_SPEC_INT64 (pspec);

		clone = g_param_spec_int64 (name, nick, blurb,
			pspec_int64->minimum,
			pspec_int64->maximum,
			pspec_int64->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_UINT64 (pspec)) {
		GParamSpecUInt64 *pspec_uint64 = G_PARAM_SPEC_UINT64 (pspec);

		clone = g_param_spec_uint64 (name, nick, blurb,
			pspec_uint64->minimum,
			pspec_uint64->maximum,
			pspec_uint64->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_FLOAT (pspec)) {
		GParamSpecFloat *pspec_float = G_PARAM_SPEC_FLOAT (pspec);

		clone = g_param_spec_float (name, nick, blurb,
			pspec_float->minimum,
			pspec_float->maximum,
			pspec_float->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) {
		GParamSpecDouble *pspec_double = G_PARAM_SPEC_DOUBLE (pspec);

		clone = g_param_spec_double (name, nick, blurb,
			pspec_double->minimum,
			pspec_double->maximum,
			pspec_double->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_ENUM (pspec)) {
		GParamSpecEnum *pspec_enum = G_PARAM_SPEC_ENUM (pspec);

		clone = g_param_spec_enum (name, nick, blurb,
			pspec->value_type,
			pspec_enum->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
		GParamSpecFlags *pspec_flags = G_PARAM_SPEC_FLAGS (pspec);

		clone = g_param_spec_flags (name, nick, blurb,
			pspec->value_type,
			pspec_flags->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_STRING (pspec)) {
		GParamSpecString *pspec_string = G_PARAM_SPEC_STRING (pspec);

		clone = g_param_spec_string (name, nick, blurb,
			pspec_string->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_PARAM (pspec)) {
		clone = g_param_spec_param (name, nick, blurb,
			pspec->value_type,
			flags);
	} else if (G_IS_PARAM_SPEC_BOXED (pspec)) {
		clone = g_param_spec_boxed (name, nick, blurb,
			pspec->value_type,
			flags);
	} else if (G_IS_PARAM_SPEC_POINTER (pspec)) {
		clone = g_param_spec_pointer (name, nick, blurb, flags);
	} else if (G_IS_PARAM_SPEC_OBJECT (pspec)) {
		clone = g_param_spec_object (name, nick, blurb,
			pspec->value_type,
			flags);
	} else if (G_IS_PARAM_SPEC_UNICHAR (pspec)) {
		GParamSpecUnichar *pspec_unichar = G_PARAM_SPEC_UNICHAR (pspec);

		clone = g_param_spec_unichar (name, nick, blurb,
			pspec_unichar->default_value,
			flags);
	} else if (G_IS_PARAM_SPEC_GTYPE (pspec)) {
		GParamSpecGType *pspec_gtype = G_PARAM_SPEC_GTYPE (pspec);

		clone = g_param_spec_gtype (name, nick, blurb,
			pspec_gtype->is_a_type,
			flags);
	} else if (G_IS_PARAM_SPEC_VARIANT (pspec)) {
		GParamSpecVariant *pspec_variant = G_PARAM_SPEC_VARIANT (pspec);

		clone = g_param_spec_variant (name, nick, blurb,
			pspec_variant->type,
			pspec_variant->default_value,
			flags);
	} else {
		g_warn_if_reached ();
	}

	return clone;
}
Esempio n. 14
0
void
g_action_default_init (GActionInterface *iface)
{
  /**
   * GAction:name:
   *
   * The name of the action.  This is mostly meaningful for identifying
   * the action once it has been added to a #GActionGroup. It is immutable.
   *
   * Since: 2.28
   **/
  g_object_interface_install_property (iface,
                                       g_param_spec_string ("name",
                                                            P_("Action Name"),
                                                            P_("The name used to invoke the action"),
                                                            NULL,
                                                            G_PARAM_READABLE |
                                                            G_PARAM_STATIC_STRINGS));

  /**
   * GAction:parameter-type:
   *
   * The type of the parameter that must be given when activating the
   * action. This is immutable, and may be %NULL if no parameter is needed when
   * activating the action.
   *
   * Since: 2.28
   **/
  g_object_interface_install_property (iface,
                                       g_param_spec_boxed ("parameter-type",
                                                           P_("Parameter Type"),
                                                           P_("The type of GVariant passed to activate()"),
                                                           G_TYPE_VARIANT_TYPE,
                                                           G_PARAM_READABLE |
                                                           G_PARAM_STATIC_STRINGS));

  /**
   * GAction:enabled:
   *
   * If @action is currently enabled.
   *
   * If the action is disabled then calls to g_action_activate() and
   * g_action_change_state() have no effect.
   *
   * Since: 2.28
   **/
  g_object_interface_install_property (iface,
                                       g_param_spec_boolean ("enabled",
                                                             P_("Enabled"),
                                                             P_("If the action can be activated"),
                                                             TRUE,
                                                             G_PARAM_READABLE |
                                                             G_PARAM_STATIC_STRINGS));

  /**
   * GAction:state-type:
   *
   * The #GVariantType of the state that the action has, or %NULL if the
   * action is stateless. This is immutable.
   *
   * Since: 2.28
   **/
  g_object_interface_install_property (iface,
                                       g_param_spec_boxed ("state-type",
                                                           P_("State Type"),
                                                           P_("The type of the state kept by the action"),
                                                           G_TYPE_VARIANT_TYPE,
                                                           G_PARAM_READABLE |
                                                           G_PARAM_STATIC_STRINGS));

  /**
   * GAction:state:
   *
   * The state of the action, or %NULL if the action is stateless.
   *
   * Since: 2.28
   **/
  g_object_interface_install_property (iface,
                                       g_param_spec_variant ("state",
                                                             P_("State"),
                                                             P_("The state the action is in"),
                                                             G_VARIANT_TYPE_ANY,
                                                             NULL,
                                                             G_PARAM_READABLE |
                                                             G_PARAM_STATIC_STRINGS));
}
static void
tp_tls_certificate_rejection_class_init (
    TpTLSCertificateRejectionClass *klass)
{
  GObjectClass *oclass = G_OBJECT_CLASS (klass);
  GParamSpec *spec;

  oclass->get_property = tp_tls_certificate_rejection_get_property;
  oclass->set_property = tp_tls_certificate_rejection_set_property;
  oclass->dispose = tp_tls_certificate_rejection_dispose;
  oclass->finalize = tp_tls_certificate_rejection_finalize;

  /**
   * TpTLSCertificateRejection:reason:
   *
   * #TpTLSCertificateRejectReason representing the reason of the rejection
   *
   * Since: 0.19.0
   */
  spec = g_param_spec_uint ("reason", "reason",
      "TpTLSCertificateRejectReason",
      TP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN,
      TP_NUM_TLS_CERTIFICATE_REJECT_REASONS,
      TP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN,
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (oclass, PROP_REASON, spec);

  /**
   * TpTLSCertificateRejection:dbus-error:
   *
   * The D-Bus error name of the rejection
   *
   * Since: 0.19.0
   */
  spec = g_param_spec_string ("dbus-error", "dbus-error",
      "DBus error",
      NULL,
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (oclass, PROP_DBUS_ERROR, spec);

  /**
   * TpTLSCertificateRejection:details:
   *
   * A #G_VARIANT_TYPE_VARDICT containing the details of the rejection
   *
   * Since: 0.19.0
   */
  spec = g_param_spec_variant ("details", "details",
      "GVariant",
      G_VARIANT_TYPE_VARDICT, NULL,
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (oclass, PROP_DETAILS, spec);

  /**
   * TpTLSCertificateRejection:error:
   *
   * a #GError (likely to be in the %TP_ERROR domain) indicating the reason
   * of the rejection
   *
   * Since: 0.19.0
   */
  spec = g_param_spec_boxed ("error", "error",
      "GError",
      G_TYPE_ERROR,
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (oclass, PROP_ERROR, spec);

  g_type_class_add_private (klass, sizeof (TpTLSCertificateRejectionPriv));
}
Esempio n. 16
0
static void playerctl_player_class_init (PlayerctlPlayerClass *klass) {
  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);

  gobject_class->set_property = playerctl_player_set_property;
  gobject_class->get_property = playerctl_player_get_property;
  gobject_class->constructed = playerctl_player_constructed;
  gobject_class->dispose = playerctl_player_dispose;
  gobject_class->finalize = playerctl_player_finalize;

  obj_properties[PROP_PLAYER_NAME] =
    g_param_spec_string("player-name",
        "Player name",
        "The name of the player mpris player",
        NULL, /* default */
        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);

  obj_properties[PROP_STATUS] =
    g_param_spec_string("status",
        "Player status",
        "The play status of the player",
        NULL, /* default */
        G_PARAM_READABLE);

  obj_properties[PROP_VOLUME] =
    g_param_spec_double("volume",
        "Player volume",
        "The volume level of the player",
        0,
        100,
        0,
        G_PARAM_READWRITE);

  obj_properties[PROP_METADATA] =
    g_param_spec_variant("metadata",
        "Player metadata",
        "The metadata of the currently playing track",
        G_VARIANT_TYPE_VARIANT,
        NULL,
        G_PARAM_READABLE);

  g_object_class_install_properties(gobject_class, N_PROPERTIES, obj_properties);

#if 0
  /* not implemented yet */
  connection_signals[PROPERTIES_CHANGED] = g_signal_new(
      "properties-changed",                 /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_LAST,                    /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VARIANT,     /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      1,                                    /* n_params */
      G_TYPE_VARIANT);
#endif

  connection_signals[PLAY] = g_signal_new(
      "play",                               /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_FIRST,                   /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VOID,        /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      0);                                   /* n_params */

  connection_signals[PAUSE] = g_signal_new(
      "pause",                              /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_FIRST,                   /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VOID,        /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      0);                                   /* n_params */

  connection_signals[STOP] = g_signal_new(
      "stop",                               /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_FIRST,                   /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VOID,        /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      0);                                   /* n_params */

  connection_signals[METADATA] = g_signal_new(
      "metadata",                           /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_FIRST,                   /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VARIANT,     /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      1,                                    /* n_params */
      G_TYPE_VARIANT);

  connection_signals[EXIT] = g_signal_new(
      "exit",                               /* signal_name */
      PLAYERCTL_TYPE_PLAYER,                /* itype */
      G_SIGNAL_RUN_FIRST,                   /* signal_flags */
      0,                                    /* class_offset */
      NULL,                                 /* accumulator */
      NULL,                                 /* accu_data */
      g_cclosure_marshal_VOID__VOID,        /* c_marshaller */
      G_TYPE_NONE,                          /* return_type */
      0);                                   /* n_params */
}
static void
tp_stream_tube_channel_class_init (TpStreamTubeChannelClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GParamSpec *param_spec;

  gobject_class->constructed = tp_stream_tube_channel_constructed;
  gobject_class->get_property = tp_stream_tube_channel_get_property;
  gobject_class->dispose = tp_stream_tube_channel_dispose;

  /**
   * TpStreamTubeChannel:service:
   *
   * A string representing the service name that will be used over the tube.
   *
   * Since: 0.13.2
   */
  param_spec = g_param_spec_string ("service", "Service",
      "The service of the stream tube",
      NULL,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (gobject_class, PROP_SERVICE, param_spec);

  /**
   * TpStreamTubeChannel:parameters:
   *
   * A string to #GValue #GHashTable representing the parameters of the tube.
   *
   * Will be %NULL for outgoing tubes until the tube has been offered.
   *
   * In high-level language bindings, use
   * #TpStreamTubeChannel:parameters-vardict or
   * tp_stream_tube_channel_dup_parameters_vardict() to get the same
   * information in a more convenient format.
   *
   * Since: 0.13.2
   */
  param_spec = g_param_spec_boxed ("parameters", "Parameters",
      "The parameters of the stream tube",
      TP_HASH_TYPE_STRING_VARIANT_MAP,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (gobject_class, PROP_PARAMETERS, param_spec);

  /**
   * TpStreamTubeChannel:parameters-vardict:
   *
   * A %G_VARIANT_TYPE_VARDICT representing the parameters of the tube.
   *
   * Will be %NULL for outgoing tubes until the tube has been offered.
   *
   * Since: 0.19.10
   */
  param_spec = g_param_spec_variant ("parameters-vardict", "Parameters",
      "The parameters of the stream tube",
      G_VARIANT_TYPE_VARDICT, NULL,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (gobject_class, PROP_PARAMETERS_VARDICT,
      param_spec);

  /**
   * TpStreamTubeChannel::incoming:
   * @self: the #TpStreamTubeChannel
   * @tube_connection: the #TpStreamTubeConnection for the connection
   *
   * The ::incoming signal is emitted on offered Tubes when a new incoming
   * connection is made from a remote user (one accepting the Tube).
   *
   * Consumers of this signal must take their own references to
   * @tube_connection
   */
  _signals[INCOMING] = g_signal_new ("incoming",
      G_OBJECT_CLASS_TYPE (klass),
      G_SIGNAL_RUN_LAST,
      0, NULL, NULL, NULL,
      G_TYPE_NONE,
      1, TP_TYPE_STREAM_TUBE_CONNECTION);

  g_type_class_add_private (gobject_class, sizeof (TpStreamTubeChannelPrivate));
}