Esempio n. 1
0
static void
ide_subprocess_supervisor_class_init (IdeSubprocessSupervisorClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->finalize = ide_subprocess_supervisor_finalize;

  signals [SPAWNED] =
    g_signal_new ("spawned",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (IdeSubprocessSupervisorClass, spawned),
                  NULL, NULL, NULL,
                  G_TYPE_NONE, 1, IDE_TYPE_SUBPROCESS);

  signals [SUPERVISE] =
    g_signal_new_class_handler ("supervise",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_subprocess_supervisor_real_supervise),
                                g_signal_accumulator_true_handled, NULL,
                                NULL,
                                G_TYPE_BOOLEAN, 1, IDE_TYPE_SUBPROCESS_LAUNCHER);

  signals [UNSUPERVISE] =
    g_signal_new_class_handler ("unsupervise",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_subprocess_supervisor_real_unsupervise),
                                g_signal_accumulator_true_handled, NULL,
                                NULL,
                                G_TYPE_BOOLEAN, 1, IDE_TYPE_SUBPROCESS_LAUNCHER);
}
Esempio n. 2
0
static void
ide_preferences_entry_class_init (IdePreferencesEntryClass *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->get_property = ide_preferences_entry_get_property;
  object_class->set_property = ide_preferences_entry_set_property;

  bin_class->matches = ide_preferences_entry_matches;

  signals [ACTIVATE] =
    g_signal_new_class_handler ("activate",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_preferences_entry_activate),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);

  signals [CHANGED] =
    g_signal_new_class_handler ("changed",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                NULL, NULL, NULL, NULL,
                                G_TYPE_NONE, 1, G_TYPE_STRING);

  widget_class->activate_signal = signals [ACTIVATE];

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-preferences-entry.ui");
  gtk_widget_class_bind_template_child_private (widget_class, IdePreferencesEntry, entry);
  gtk_widget_class_bind_template_child_private (widget_class, IdePreferencesEntry, title);

  properties [PROP_TITLE] =
    g_param_spec_string ("title",
                         "Title",
                         "Title",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  properties [PROP_TEXT] =
    g_param_spec_string ("text",
                         "Text",
                         "Text",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);
}
static void
gb_color_picker_document_monitor_class_init (GbColorPickerDocumentMonitorClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->finalize = gb_color_picker_document_monitor_finalize;
  object_class->get_property = gb_color_picker_document_monitor_get_property;
  object_class->set_property = gb_color_picker_document_monitor_set_property;

  properties [PROP_BUFFER] =
    g_param_spec_object ("buffer",
                         "Buffer",
                         "The GtkTextBuffer for the monitor.",
                         GTK_TYPE_TEXT_BUFFER,
                         (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, N_PROPS, properties);

  signals [COLOR_FOUND] =
    g_signal_new_class_handler ("color-found",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                NULL, NULL, NULL, NULL,
                                G_TYPE_NONE, 1, GSTYLE_TYPE_COLOR);
}
Esempio n. 4
0
static void
ide_git_vcs_class_init (IdeGitVcsClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->finalize = ide_git_vcs_finalize;
  object_class->dispose = ide_git_vcs_dispose;
  object_class->get_property = ide_git_vcs_get_property;

  g_object_class_override_property (object_class, PROP_BRANCH_NAME, "branch-name");
  g_object_class_override_property (object_class, PROP_WORKING_DIRECTORY, "working-directory");

  /**
   * IdeGitVcs::reloaded:
   * @self: An #IdeGitVfs
   * @repository: a #GgitRepository
   *
   * This signal is emitted when the git index has been reloaded. Various consumers may want to
   * reload their git objects upon this notification. Such an example would be the line diffs
   * that are rendered in the source view gutter.
   *
   * The @repository instance is to aide consumers in locating the repository and should not
   * be used directly except in very specific situations. The gutter change renderer uses this
   * instance in a threaded manner.
   */
  signals [RELOADED] =
    g_signal_new_class_handler ("reloaded",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_git_vcs_real_reloaded),
                                NULL, NULL, NULL,
                                G_TYPE_NONE, 1, GGIT_TYPE_REPOSITORY);
}
static void
gd_tagged_entry_class_init (GdTaggedEntryClass *klass)
{
    GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
    GtkEntryClass *eclass = GTK_ENTRY_CLASS (klass);
    GObjectClass *oclass = G_OBJECT_CLASS (klass);

    oclass->finalize = gd_tagged_entry_finalize;
    oclass->set_property = gd_tagged_entry_set_property;
    oclass->get_property = gd_tagged_entry_get_property;

    wclass->realize = gd_tagged_entry_realize;
    wclass->unrealize = gd_tagged_entry_unrealize;
    wclass->map = gd_tagged_entry_map;
    wclass->unmap = gd_tagged_entry_unmap;
    wclass->size_allocate = gd_tagged_entry_size_allocate;
    wclass->get_preferred_width = gd_tagged_entry_get_preferred_width;
    wclass->draw = gd_tagged_entry_draw;
    wclass->enter_notify_event = gd_tagged_entry_enter_notify;
    wclass->leave_notify_event = gd_tagged_entry_leave_notify;
    wclass->motion_notify_event = gd_tagged_entry_motion_notify;
    wclass->button_press_event = gd_tagged_entry_button_press_event;
    wclass->button_release_event = gd_tagged_entry_button_release_event;

    eclass->get_text_area_size = gd_tagged_entry_get_text_area_size;

    signals[SIGNAL_ACTION] =
        g_signal_new_class_handler ("action",
                                    GD_TYPE_TAGGED_ENTRY,
                                    G_SIGNAL_ACTION | G_SIGNAL_RUN_LAST,
                                    G_CALLBACK (gd_tagged_entry_action),
                                    NULL, NULL, NULL,
                                    G_TYPE_NONE,
                                    3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
    signals[SIGNAL_TAG_CLICKED] =
        g_signal_new ("tag-clicked",
                      GD_TYPE_TAGGED_ENTRY,
                      G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
                      0, NULL, NULL, NULL,
                      G_TYPE_NONE,
                      1, GD_TYPE_TAGGED_ENTRY_TAG);
    signals[SIGNAL_TAG_BUTTON_CLICKED] =
        g_signal_new ("tag-button-clicked",
                      GD_TYPE_TAGGED_ENTRY,
                      G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
                      0, NULL, NULL, NULL,
                      G_TYPE_NONE,
                      1, GD_TYPE_TAGGED_ENTRY_TAG);

    properties[PROP_TAG_BUTTON_VISIBLE] =
        g_param_spec_boolean ("tag-close-visible", "Tag close icon visibility",
                              "Whether the close button should be shown in tags.", TRUE,
                              G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);

    g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
Esempio n. 6
0
static void
ide_frame_class_init (IdeFrameClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);

  object_class->constructed = ide_frame_constructed;
  object_class->get_property = ide_frame_get_property;
  object_class->set_property = ide_frame_set_property;

  widget_class->destroy = ide_frame_destroy;
  widget_class->grab_focus = ide_frame_grab_focus;

  container_class->add = ide_frame_add;

  klass->agree_to_close_async = ide_frame_real_agree_to_close_async;
  klass->agree_to_close_finish = ide_frame_real_agree_to_close_finish;

  properties [PROP_HAS_VIEW] =
    g_param_spec_boolean ("has-page", NULL, NULL,
                          FALSE,
                          (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));

  properties [PROP_VISIBLE_CHILD] =
    g_param_spec_object ("visible-child",
                         "Visible Child",
                         "The current page to be displayed",
                         IDE_TYPE_PAGE,
                         (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, N_PROPS, properties);

  signals [CHNAGE_CURRENT_PAGE] =
    g_signal_new_class_handler ("change-current-page",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (ide_frame_change_current_page),
                                NULL, NULL,
                                g_cclosure_marshal_VOID__INT,
                                G_TYPE_NONE, 1, G_TYPE_INT);

  gtk_widget_class_set_css_name (widget_class, "ideframe");
  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/libide-gui/ui/ide-frame.ui");
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, empty_placeholder);
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, failed_state);
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, header);
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, stack);
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, top_stack);
  gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, event_box);

  g_type_ensure (IDE_TYPE_FRAME_HEADER);
  g_type_ensure (IDE_TYPE_FRAME_WRAPPER);
  g_type_ensure (IDE_TYPE_SHORTCUT_LABEL);
}
Esempio n. 7
0
static void
gtk_popup_button_class_init (GtkPopupButtonClass *klass)
{
	GObjectClass *object_class = (GObjectClass *) klass;
	object_class->dispose = gtk_popup_button_dispose;
	g_type_class_add_private (object_class, sizeof (GtkPopupButtonPrivate));
	
	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
	widget_class->button_press_event = gtk_popup_button_press_event;
	
	signals[SIGNAL_POPUP] = g_signal_new_class_handler ("popup",
			G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
			G_CALLBACK (gtk_popup_button_popup_real), NULL, NULL,
			g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GDK_TYPE_DEVICE);
	
	signals[SIGNAL_POPDOWN] = g_signal_new_class_handler ("popdown",
			G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
			G_CALLBACK (gtk_popup_button_popdown_real), NULL, NULL,
			g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void
ide_omni_search_display_class_init (IdeOmniSearchDisplayClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

  widget_class->grab_focus = ide_omni_search_display_grab_focus;

  object_class->dispose = ide_omni_search_display_dispose;
  object_class->get_property = ide_omni_search_display_get_property;
  object_class->set_property = ide_omni_search_display_set_property;

  properties [PROP_CONTEXT] =
    g_param_spec_object ("context",
                         "Context",
                         "The active search context.",
                         IDE_TYPE_SEARCH_CONTEXT,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);

  signals [ACTIVATE] = widget_class->activate_signal =
    g_signal_new_class_handler ("activate",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (ide_omni_search_display_activate),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);

  signals [RESULT_ACTIVATED] =
    g_signal_new_class_handler ("result-activated",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_omni_search_display_real_result_activated),
                                NULL, NULL, NULL,
                                G_TYPE_NONE,
                                1,
                                IDE_TYPE_SEARCH_RESULT);

  gtk_widget_class_set_css_name (widget_class, "omnisearchdisplay");
}
Esempio n. 9
0
static void
irc_context_default_init (IrcContextInterface *iface)
{
	iface->get_parent = irc_context_default_get_parent;
	iface->get_menu = irc_context_default_get_menu;

	g_object_interface_install_property (iface,
                   g_param_spec_string ("name", _("Name"), _("Name of context"),
                                NULL, G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));

  	g_object_interface_install_property (iface,
                   g_param_spec_object ("parent", _("Parent"), _("Parent context"),
                               IRC_TYPE_CONTEXT, G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));

  	g_object_interface_install_property (iface,
                   g_param_spec_boolean ("active", _("Active"), _("The context is considered active"),
                               TRUE, G_PARAM_READABLE));

	signals[SIGNAL_PRINT] = g_signal_new_class_handler ("print", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST|G_SIGNAL_NO_RECURSE,
													NULL, NULL, NULL,
													irc_marshal_VOID__STRING_INT64,
													G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT64);

	g_signal_new_class_handler ("activity", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST|G_SIGNAL_ACTION,
											NULL, NULL, NULL, irc_marshal_VOID__BOOLEAN,
											G_TYPE_NONE, 1, G_TYPE_BOOLEAN);

	/**
	 * IrcContext::command:
	 * @object: The #IrcContext for the event
	 * @words: Words split at spaces for event
	 * @words_eol: Strings starting at each space for the event
	 *
	 * Returns: %TRUE to stop signal, %FALSE to continue
	 */
	signals[SIGNAL_COMMAND] = g_signal_new_class_handler ("command", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST|G_SIGNAL_DETAILED|G_SIGNAL_NO_RECURSE,
										G_CALLBACK(handle_command), g_signal_accumulator_true_handled, NULL,
										irc_marshal_BOOLEAN__BOXED_BOXED,
										G_TYPE_BOOLEAN, 2, G_TYPE_STRV, G_TYPE_STRV);
}
static void
ide_preferences_spin_button_class_init (IdePreferencesSpinButtonClass *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 = ide_preferences_spin_button_finalize;
  object_class->get_property = ide_preferences_spin_button_get_property;
  object_class->set_property = ide_preferences_spin_button_set_property;

  bin_class->connect = ide_preferences_spin_button_connect;
  bin_class->disconnect = ide_preferences_spin_button_disconnect;
  bin_class->matches = ide_preferences_spin_button_matches;

  signals [ACTIVATE] =
    g_signal_new_class_handler ("activate",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (ide_preferences_spin_button_activate),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);

  widget_class->activate_signal = signals [ACTIVATE];

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-preferences-spin-button.ui");
  gtk_widget_class_bind_template_child (widget_class, IdePreferencesSpinButton, spin_button);
  gtk_widget_class_bind_template_child (widget_class, IdePreferencesSpinButton, subtitle);
  gtk_widget_class_bind_template_child (widget_class, IdePreferencesSpinButton, title);

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

  properties [PROP_SUBTITLE] =
    g_param_spec_string ("subtitle",
                         "subtitle",
                         "subtitle",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  properties [PROP_TITLE] =
    g_param_spec_string ("title",
                         "title",
                         "title",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);
}
Esempio n. 11
0
static void
egg_search_bar_class_init (EggSearchBarClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

  object_class->finalize = egg_search_bar_finalize;
  object_class->get_property = egg_search_bar_get_property;
  object_class->set_property = egg_search_bar_set_property;

  widget_class->hierarchy_changed = egg_search_bar_hierarchy_changed;

  properties [PROP_SEARCH_MODE_ENABLED] =
    g_param_spec_boolean ("search-mode-enabled",
                          "Search Mode Enabled",
                          "Search Mode Enabled",
                          FALSE,
                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  properties [PROP_SHOW_CLOSE_BUTTON] =
    g_param_spec_boolean ("show-close-button",
                          "Show Close Button",
                          "Show Close Button",
                          FALSE,
                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);

  signals [ACTIVATE] =
    g_signal_new ("activate",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                  0, NULL, NULL, NULL, G_TYPE_NONE, 0);

  signals [REVEAL] =
    g_signal_new_class_handler ("reveal",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (egg_search_bar_reveal),
                                NULL, NULL, NULL, G_TYPE_NONE, 0);

  gtk_widget_class_set_css_name (widget_class, "eggsearchbar");
}
Esempio n. 12
0
static void
gwy_scroller_class_init(GwyScrollerClass *klass)
{
    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
    GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);

    g_type_class_add_private(klass, sizeof(Scroller));

    gobject_class->dispose = gwy_scroller_dispose;
    gobject_class->finalize = gwy_scroller_finalize;
    gobject_class->get_property = gwy_scroller_get_property;
    gobject_class->set_property = gwy_scroller_set_property;

    widget_class->get_preferred_width = gwy_scroller_get_preferred_width;
    widget_class->get_preferred_height = gwy_scroller_get_preferred_height;
    widget_class->size_allocate = gwy_scroller_size_allocate;
    widget_class->scroll_event = gwy_scroller_scroll_event;

    container_class->add = gwy_scroller_add;
    container_class->remove = gwy_scroller_remove;
    container_class->child_type = gwy_scroller_child_type;
    gtk_container_class_handle_border_width(container_class);

    properties[PROP_HADJUSTMENT]
        = g_param_spec_object("hadjustment",
                              "Horizontal adjustment",
                              "Adjustment for the horizontal position",
                              GTK_TYPE_ADJUSTMENT,
                              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

    properties[PROP_VADJUSTMENT]
        = g_param_spec_object("vadjustment",
                              "Vertical adjustment",
                              "Adjustment for the vertical position",
                              GTK_TYPE_ADJUSTMENT,
                              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

    for (guint i = 1; i < N_PROPS; i++)
        g_object_class_install_property(gobject_class, i, properties[i]);

    /**
     * GwyScroller::scroll-child:
     * @gwyscroller: The #GwyScroller which received the signal.
     * @arg1: #GtkScrollType describing how much to scroll.
     * @arg2: %TRUE to scroll horizontally, %FALSE to scroll vertically.
     *
     * The ::scroll-child signal is a
     * <link linkend="keybinding-signals">keybinding signal</link>
     * which gets emitted when a keybinding that scrolls is pressed.
     * The horizontal or vertical adjustment is updated which triggers a
     * signal that the scroller child may listen to and scroll itself.
     */
    signals[SGNL_SCROLL_CHILD]
        = g_signal_new_class_handler("scroll-child",
                                     G_OBJECT_CLASS_TYPE(klass),
                                     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                     G_CALLBACK(gwy_scroller_scroll_child),
                                     NULL, NULL,
                                     _gwy_cclosure_marshal_BOOLEAN__ENUM_BOOLEAN,
                                     G_TYPE_BOOLEAN, 2,
                                     GTK_TYPE_SCROLL_TYPE, G_TYPE_BOOLEAN);

    GtkBindingSet *binding_set = gtk_binding_set_by_class(klass);

    add_scroll_binding(binding_set, GDK_KEY_Left, GDK_CONTROL_MASK,
                       GTK_SCROLL_STEP_BACKWARD, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_Right, GDK_CONTROL_MASK,
                       GTK_SCROLL_STEP_FORWARD, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_Up, GDK_CONTROL_MASK,
                       GTK_SCROLL_STEP_BACKWARD, FALSE);
    add_scroll_binding(binding_set, GDK_KEY_Down, GDK_CONTROL_MASK,
                       GTK_SCROLL_STEP_FORWARD, FALSE);

    add_scroll_binding(binding_set, GDK_KEY_Page_Up, GDK_CONTROL_MASK,
                       GTK_SCROLL_PAGE_BACKWARD, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_Page_Down, GDK_CONTROL_MASK,
                       GTK_SCROLL_PAGE_FORWARD, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_Page_Up, 0,
                       GTK_SCROLL_PAGE_BACKWARD, FALSE);
    add_scroll_binding(binding_set, GDK_KEY_Page_Down, 0,
                       GTK_SCROLL_PAGE_FORWARD, FALSE);

    add_scroll_binding(binding_set, GDK_KEY_Home, GDK_CONTROL_MASK,
                       GTK_SCROLL_START, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_End, GDK_CONTROL_MASK,
                       GTK_SCROLL_END, TRUE);
    add_scroll_binding(binding_set, GDK_KEY_Home, 0,
                       GTK_SCROLL_START, FALSE);
    add_scroll_binding(binding_set, GDK_KEY_End, 0,
                       GTK_SCROLL_END, FALSE);
}
Esempio n. 13
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");
}
Esempio n. 14
0
static void
ide_workbench_class_init (IdeWorkbenchClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

  object_class->constructed = ide_workbench_constructed;
  object_class->finalize = ide_workbench_finalize;
  object_class->get_property = ide_workbench_get_property;
  object_class->set_property = ide_workbench_set_property;

  widget_class->delete_event = ide_workbench_delete_event;

  /**
   * IdeWorkbench:context:
   *
   * The #IdeWorkbench:context property contains the #IdeContext for the loaded
   * project. Loading a project consists of creating an #IdeContext, so there
   * is a 1:1 mapping between "loaded project" and an #IdeContext.
   *
   * The #IdeContext contains many of the important components of a project.
   * For example, it contains the #IdeVcs representing the active version
   * control system and an #IdeBuildSystem representing the current build
   * system.
   *
   * The creation of #IdeWorkbenchAddin addins are deferred until this property
   * has been set.
   */
  properties [PROP_CONTEXT] =
    g_param_spec_object ("context",
                         "Context",
                         "Context",
                         IDE_TYPE_CONTEXT,
                         (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));

  /**
   * IdeWorkbench:visible-perspective:
   *
   * This property contains the #IdePerspective that is currently selected.
   * Connect to the "notify::visible-perspective" signal to be notified when
   * the perspective has been changed.
   */
  properties [PROP_VISIBLE_PERSPECTIVE] =
    g_param_spec_object ("visible-perspective",
                         "visible-Perspective",
                         "visible-Perspective",
                         IDE_TYPE_PERSPECTIVE,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  /**
   * IdeWorkbench:disable-greeter:
   *
   * This property is used internally by Builder to avoid creating the
   * greeter when opening a new workspace that is only for loading a
   * project.
   *
   * This should not be used by application plugins.
   */
  properties [PROP_DISABLE_GREETER] =
    g_param_spec_boolean ("disable-greeter",
                          "Disable Greeter",
                          "If the greeter should be disabled when creating the workbench",
                          FALSE,
                          (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));

  /**
   * IdeWorkbench:visible-perspective-name:
   *
   * This property is just like #IdeWorkbench:visible-perspective except that
   * it contains the name of the perspective as a string.
   */
  properties [PROP_VISIBLE_PERSPECTIVE_NAME] =
    g_param_spec_string ("visible-perspective-name",
                         "visible-Perspective-name",
                         "visible-Perspective-name",
                         NULL,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);

  signals [ACTION] =
    g_signal_new_class_handler ("action",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
                                G_CALLBACK (ide_widget_action_with_string),
                                NULL, NULL, NULL,
                                G_TYPE_NONE,
                                3,
                                G_TYPE_STRING,
                                G_TYPE_STRING,
                                G_TYPE_STRING);

  /**
   * IdeWorkbench::set-perspective:
   * @self: An #IdeWorkbench
   * @name: the name of the perspective
   *
   * This signal is meant for keybindings to change the current perspective.
   */
  signals [SET_PERSPECTIVE] =
    g_signal_new_class_handler ("set-perspective",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
                                G_CALLBACK (ide_workbench_set_visible_perspective_name),
                                NULL, NULL, NULL,
                                G_TYPE_NONE, 1, G_TYPE_STRING);

  signals [UNLOAD] =
    g_signal_new ("unload",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  0,
                  NULL, NULL,
                  NULL,
                  G_TYPE_NONE,
                  1, IDE_TYPE_CONTEXT);

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-workbench.ui");
  gtk_widget_class_bind_template_child (widget_class, IdeWorkbench, header_bar);
  gtk_widget_class_bind_template_child (widget_class, IdeWorkbench, header_size_group);
  gtk_widget_class_bind_template_child (widget_class, IdeWorkbench, header_stack);
  gtk_widget_class_bind_template_child (widget_class, IdeWorkbench, perspective_menu_button);
  gtk_widget_class_bind_template_child (widget_class, IdeWorkbench, perspectives_stack);
}
static void
rb_visualizer_page_class_init (RBVisualizerPageClass *klass)
{
    GObjectClass *object_class = G_OBJECT_CLASS (klass);
    RBDisplayPageClass *page_class = RB_DISPLAY_PAGE_CLASS (klass);

    object_class->constructed = impl_constructed;
    object_class->get_property = impl_get_property;
    object_class->set_property = impl_set_property;
    object_class->dispose = impl_dispose;

    page_class->selected = impl_selected;
    page_class->deselected = impl_deselected;
    page_class->show_popup = impl_show_popup;

    g_object_class_install_property (object_class,
                                     PROP_SINK,
                                     g_param_spec_object ("sink",
                                             "sink",
                                             "gstreamer sink element",
                                             GST_TYPE_ELEMENT,
                                             G_PARAM_READABLE));
    g_object_class_install_property (object_class,
                                     PROP_POPUP,
                                     g_param_spec_object ("popup",
                                             "popup",
                                             "popup menu",
                                             GTK_TYPE_WIDGET,
                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
    g_object_class_install_property (object_class,
                                     PROP_FULLSCREEN_ACTION,
                                     g_param_spec_object ("fullscreen-action",
                                             "fullscreen action",
                                             "GtkToggleAction for fullscreen",
                                             GTK_TYPE_TOGGLE_ACTION,
                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

    signals[START] = g_signal_new ("start",
                                   RB_TYPE_VISUALIZER_PAGE,
                                   G_SIGNAL_RUN_LAST,
                                   0,
                                   NULL, NULL,
                                   g_cclosure_marshal_VOID__VOID,
                                   G_TYPE_NONE,
                                   0);
    signals[STOP] = g_signal_new ("stop",
                                  RB_TYPE_VISUALIZER_PAGE,
                                  G_SIGNAL_RUN_LAST,
                                  0,
                                  NULL, NULL,
                                  g_cclosure_marshal_VOID__VOID,
                                  G_TYPE_NONE,
                                  0);
    signals[FULLSCREEN] = g_signal_new_class_handler ("toggle-fullscreen",
                          RB_TYPE_VISUALIZER_PAGE,
                          G_SIGNAL_RUN_LAST,
                          G_CALLBACK (toggle_fullscreen),
                          NULL, NULL,
                          g_cclosure_marshal_VOID__VOID,
                          G_TYPE_NONE,
                          0);
}
static void
gst_insert_bin_class_init (GstInsertBinClass * klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GstElementClass *gstelement_class = (GstElementClass *) klass;

  GST_DEBUG_CATEGORY_INIT (insert_bin_debug, "insertbin", 0, "Insert Bin");

  g_type_class_add_private (klass, sizeof (GstInsertBinPrivate));

  gst_element_class_add_static_pad_template (gstelement_class,
      &gst_insert_bin_src_template);
  gst_element_class_add_static_pad_template (gstelement_class,
      &gst_insert_bin_sink_template);
  gst_element_class_set_static_metadata (gstelement_class, "Insert Bin",
      "Generic/Bin/Filter", "Auto-links filter style elements insertally",
      "Olivier Crete <*****@*****.**>");

  gobject_class->dispose = gst_insert_bin_dispose;

  /**
   * GstInsertBin::prepend:
   * @element: the #GstElement to add
   * @callback: the callback to call when the element has been added or not, or
   *  %NULL
   * @user_data: The data to pass to the callback
   * @user_data2: The user data of the signal (ignored)
   *
   * This action signal adds the filter like element before any other element
   * in the bin.
   *
   * Same as gst_insert_bin_prepend()
   */
  signals[SIG_PREPEND] = g_signal_new_class_handler ("prepend",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_insert_bin_prepend),
      NULL, NULL, NULL,
      G_TYPE_NONE, 3, GST_TYPE_ELEMENT, G_TYPE_POINTER, G_TYPE_POINTER);

  /**
   * GstInsertBin::append:
   * @element: the #GstElement to add
   * @callback: the callback to call when the element has been added or not, or
   *  %NULL
   * @user_data: The data to pass to the callback
   * @user_data2: The user data of the signal (ignored)
   *
   * This action signal adds the filter like element after any other element
   * in the bin.
   *
   * Same as gst_insert_bin_append()
   */
  signals[SIG_APPEND] = g_signal_new_class_handler ("append",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_insert_bin_append),
      NULL, NULL, NULL,
      G_TYPE_NONE, 3, GST_TYPE_ELEMENT, G_TYPE_POINTER, G_TYPE_POINTER);

  /**
   * GstInsertBin::insert-before:
   * @element: the #GstElement to add
   * @sibling: the #GstElement to add @element before
   * @callback: the callback to call when the element has been added or not, or
   *  %NULL
   * @user_data: The data to pass to the callback
   * @user_data2: The user data of the signal (ignored)
   *
   * This action signal adds the filter like element before the @sibling
   * element in the bin.
   *
   * Same as gst_insert_bin_insert_before()
   */
  signals[SIG_INSERT_BEFORE] = g_signal_new_class_handler ("insert-before",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_insert_bin_insert_before),
      NULL, NULL, NULL,
      G_TYPE_NONE, 4, GST_TYPE_ELEMENT, GST_TYPE_ELEMENT,
      G_TYPE_POINTER, G_TYPE_POINTER);

  /**
   * GstInsertBin::insert-after:
   * @element: the #GstElement to add
   * @sibling: the #GstElement to add @element after
   * @callback: the callback to call when the element has been added or not, or
   *  %NULL
   * @user_data: The data to pass to the callback
   * @user_data2: The user data of the signal (ignored)
   *
   * This action signal adds the filter like element after the @sibling
   * element in the bin.
   * element in the bin.
   *
   * Same as gst_insert_bin_insert_after()
   */
  signals[SIG_INSERT_AFTER] = g_signal_new_class_handler ("insert-after",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_insert_bin_insert_after),
      NULL, NULL, NULL,
      G_TYPE_NONE, 4, GST_TYPE_ELEMENT, GST_TYPE_ELEMENT,
      G_TYPE_POINTER, G_TYPE_POINTER);


  /**
   * GstInsertBin::remove:
   * @element: the #GstElement to remove
   * @callback: the callback to call when the element has been removed or not,
   * or %NULL
   * @user_data: The data to pass to the callback
   * @user_data2: The user data of the signal (ignored)
   *
   * This action signal removed the filter like element from the bin.
   *
   * Same as gst_insert_bin_remove()
   */
  signals[SIG_REMOVE] = g_signal_new_class_handler ("remove",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_insert_bin_remove),
      NULL, NULL, NULL,
      G_TYPE_NONE, 3, GST_TYPE_ELEMENT, G_TYPE_POINTER, G_TYPE_POINTER);
}
Esempio n. 17
0
{
  class->bar = test_a_bar;

  bar_signal_id = g_signal_new ("bar",
				TEST_TYPE_A,
				G_SIGNAL_RUN_LAST,
				G_STRUCT_OFFSET (TestAClass, bar),
				NULL, NULL,
				g_cclosure_marshal_VOID__VOID,
				G_TYPE_NONE, 0, NULL);

  baz_signal_id = g_signal_new_class_handler ("baz",
                                              TEST_TYPE_A,
                                              G_SIGNAL_RUN_LAST,
                                              G_CALLBACK (test_a_baz),
                                              NULL, NULL,
                                              g_cclosure_marshal_STRING__OBJECT_POINTER,
                                              G_TYPE_STRING, 2,
                                              G_TYPE_OBJECT,
                                              G_TYPE_POINTER);
}

static void
test_a_interface_init (TestIClass *iface)
{
  g_signal_override_class_closure (foo_signal_id,
				   TEST_TYPE_A,
				   g_cclosure_new (G_CALLBACK (test_a_foo),
						   NULL, NULL));
}
Esempio n. 18
0
static void
gst_base_camera_src_class_init (GstBaseCameraSrcClass * klass)
{
  GObjectClass *gobject_class;
  GstElementClass *gstelement_class;

  GST_DEBUG_CATEGORY_INIT (base_camera_src_debug, "base_camera_src", 0,
      "Base camera src");

  gobject_class = G_OBJECT_CLASS (klass);
  gstelement_class = GST_ELEMENT_CLASS (klass);

  gobject_class->dispose = gst_base_camera_src_dispose;
  gobject_class->finalize = (GObjectFinalizeFunc) gst_base_camera_src_finalize;
  gobject_class->set_property = gst_base_camera_src_set_property;
  gobject_class->get_property = gst_base_camera_src_get_property;

  g_object_class_install_property (gobject_class, PROP_MODE,
      g_param_spec_enum ("mode", "Mode",
          "The capture mode (still image capture or video recording)",
          GST_TYPE_CAMERABIN_MODE, MODE_IMAGE,
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_ZOOM,
      g_param_spec_float ("zoom", "Zoom",
          "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, G_MAXFLOAT,
          DEFAULT_ZOOM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_MAX_ZOOM,
      g_param_spec_float ("max-zoom", "Maximum zoom level (note: may change "
          "depending on resolution/implementation)",
          "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, G_MAXFLOAT,
          MAX_ZOOM, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));

  /**
   * GstBaseCameraSrc:post-previews:
   *
   * When %TRUE, preview images should be posted to the bus when
   * captures are made
   */
  g_object_class_install_property (gobject_class, PROP_POST_PREVIEW,
      g_param_spec_boolean ("post-previews", "Post Previews",
          "If capture preview images should be posted to the bus",
          DEFAULT_POST_PREVIEW, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_PREVIEW_CAPS,
      g_param_spec_boxed ("preview-caps", "Preview caps",
          "The caps of the preview image to be posted (NULL means ANY)",
          GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_PREVIEW_FILTER,
      g_param_spec_object ("preview-filter", "Preview filter",
          "A custom preview filter to process preview image data",
          GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  /**
   * GstBaseCameraSrc:ready-for-capture:
   *
   * When TRUE new capture can be prepared. If FALSE capturing is ongoing
   * and starting a new capture immediately is not possible.
   *
   * Note that calling start-capture from the notify callback of this property
   * will cause a deadlock. If you need to react like this on the notify
   * function, please schedule a new thread to do it. If you're using glib's
   * mainloop you can use g_idle_add() for example.
   */
  g_object_class_install_property (gobject_class, PROP_READY_FOR_CAPTURE,
      g_param_spec_boolean ("ready-for-capture", "Ready for capture",
          "Informs this element is ready for starting another capture",
          TRUE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));


  /* Signals */
  basecamerasrc_signals[START_CAPTURE_SIGNAL] =
      g_signal_new_class_handler ("start-capture",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_base_camera_src_start_capture),
      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);

  basecamerasrc_signals[STOP_CAPTURE_SIGNAL] =
      g_signal_new_class_handler ("stop-capture",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
      G_CALLBACK (gst_base_camera_src_stop_capture),
      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);

  gstelement_class->change_state = gst_base_camera_src_change_state;

  gst_element_class_set_details_simple (gstelement_class,
      "Base class for camerabin src bin", "Source/Video",
      "Abstracts capture device for camerabin2", "Rob Clark <*****@*****.**>");
}
static void
gtk_scale_button_class_init (GtkScaleButtonClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  GtkBindingSet *binding_set;

  g_type_class_add_private (klass, sizeof (GtkScaleButtonPrivate));

  gobject_class->constructor = gtk_scale_button_constructor;
  gobject_class->finalize = gtk_scale_button_finalize;
  gobject_class->dispose = gtk_scale_button_dispose;
  gobject_class->set_property = gtk_scale_button_set_property;
  gobject_class->get_property = gtk_scale_button_get_property;

  widget_class->button_press_event = gtk_scale_button_press;
  widget_class->key_release_event = gtk_scale_button_key_release;
  widget_class->scroll_event = gtk_scale_button_scroll;
  widget_class->screen_changed = gtk_scale_button_screen_changed;

  /**
   * GtkScaleButton:orientation:
   *
   * The orientation of the #GtkScaleButton's popup window.
   *
   * Since: 2.14
   **/
  g_object_class_install_property (gobject_class,
				   PROP_ORIENTATION,
				   g_param_spec_enum ("orientation",
                                                      P_("Orientation"),
                                                      P_("The orientation of the scale"),
                                                      GTK_TYPE_ORIENTATION,
                                                      GTK_ORIENTATION_VERTICAL,
                                                      GTK_PARAM_READWRITE));

  g_object_class_install_property (gobject_class,
				   PROP_VALUE,
				   g_param_spec_double ("value",
							P_("Value"),
							P_("The value of the scale"),
							-G_MAXDOUBLE,
							G_MAXDOUBLE,
							0,
							GTK_PARAM_READWRITE));

  g_object_class_install_property (gobject_class,
				   PROP_SIZE,
				   g_param_spec_enum ("size",
						      P_("Icon size"),
						      P_("The icon size"),
						      GTK_TYPE_ICON_SIZE,
						      GTK_ICON_SIZE_SMALL_TOOLBAR,
						      GTK_PARAM_READWRITE));

  g_object_class_install_property (gobject_class,
                                   PROP_ADJUSTMENT,
                                   g_param_spec_object ("adjustment",
							P_("Adjustment"),
							P_("The GtkAdjustment that contains the current value of this scale button object"),
                                                        GTK_TYPE_ADJUSTMENT,
                                                        GTK_PARAM_READWRITE));

  /**
   * GtkScaleButton:icons:
   *
   * The names of the icons to be used by the scale button.
   * The first item in the array will be used in the button
   * when the current value is the lowest value, the second
   * item for the highest value. All the subsequent icons will
   * be used for all the other values, spread evenly over the
   * range of values.
   *
   * If there's only one icon name in the @icons array, it will
   * be used for all the values. If only two icon names are in
   * the @icons array, the first one will be used for the bottom
   * 50% of the scale, and the second one for the top 50%.
   *
   * It is recommended to use at least 3 icons so that the
   * #GtkScaleButton reflects the current value of the scale
   * better for the users.
   *
   * Since: 2.12
   */
  g_object_class_install_property (gobject_class,
                                   PROP_ICONS,
                                   g_param_spec_boxed ("icons",
                                                       P_("Icons"),
                                                       P_("List of icon names"),
                                                       G_TYPE_STRV,
                                                       GTK_PARAM_READWRITE));

  /**
   * GtkScaleButton::value-changed:
   * @button: the object which received the signal
   * @value: the new value
   *
   * The ::value-changed signal is emitted when the value field has
   * changed.
   *
   * Since: 2.12
   */
  signals[VALUE_CHANGED] =
    g_signal_new (I_("value-changed"),
		  G_TYPE_FROM_CLASS (klass),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkScaleButtonClass, value_changed),
		  NULL, NULL,
		  _gtk_marshal_VOID__DOUBLE,
		  G_TYPE_NONE, 1, G_TYPE_DOUBLE);

  /**
   * GtkScaleButton::popup:
   * @button: the object which received the signal
   *
   * The ::popup signal is a
   * <link linkend="keybinding-signals">keybinding signal</link>
   * which gets emitted to popup the scale widget.
   *
   * The default bindings for this signal are Space, Enter and Return.
   *
   * Since: 2.12
   */
  signals[POPUP] =
    g_signal_new_class_handler (I_("popup"),
                                G_OBJECT_CLASS_TYPE (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gtk_scale_button_popup),
                                NULL, NULL,
                                g_cclosure_marshal_VOID__VOID,
                                G_TYPE_NONE, 0);

  /**
   * GtkScaleButton::popdown:
   * @button: the object which received the signal
   *
   * The ::popdown signal is a
   * <link linkend="keybinding-signals">keybinding signal</link>
   * which gets emitted to popdown the scale widget.
   *
   * The default binding for this signal is Escape.
   *
   * Since: 2.12
   */
  signals[POPDOWN] =
    g_signal_new_class_handler (I_("popdown"),
                                G_OBJECT_CLASS_TYPE (klass),
                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                G_CALLBACK (gtk_scale_button_popdown),
                                NULL, NULL,
                                g_cclosure_marshal_VOID__VOID,
                                G_TYPE_NONE, 0);

  /* Key bindings */
  binding_set = gtk_binding_set_by_class (widget_class);

  gtk_binding_entry_add_signal (binding_set, GDK_space, 0,
				"popup", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0,
				"popup", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_Return, 0,
				"popup", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0,
				"popup", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0,
				"popup", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
				"popdown", 0);
}
Esempio n. 20
0
static void
gb_view_stack_class_init (GbViewStackClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);

  object_class->constructed = gb_view_stack_constructed;
  object_class->finalize = gb_view_stack_finalize;
  object_class->get_property = gb_view_stack_get_property;
  object_class->set_property = gb_view_stack_set_property;

  widget_class->destroy = gb_view_stack_destroy;
  widget_class->grab_focus = gb_view_stack_grab_focus;
  widget_class->hierarchy_changed = gb_view_stack_hierarchy_changed;

  container_class->add = gb_view_stack_add;
  container_class->remove = gb_view_stack_real_remove;

  gParamSpecs [PROP_ACTIVE_VIEW] =
    g_param_spec_object ("active-view",
                         _("Active View"),
                         _("The active view."),
                         GB_TYPE_VIEW,
                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);

  gSignals [EMPTY] =
    g_signal_new_class_handler ("empty",
                                G_TYPE_FROM_CLASS (klass),
                                G_SIGNAL_RUN_LAST,
                                G_CALLBACK (gb_view_stack_real_empty),
                                NULL, NULL, NULL,
                                G_TYPE_NONE,
                                0);

  gSignals [SPLIT] = g_signal_new ("split",
                                   G_TYPE_FROM_CLASS (klass),
                                   G_SIGNAL_RUN_LAST,
                                   0,
                                   NULL, NULL, NULL,
                                   G_TYPE_NONE,
                                   2,
                                   GB_TYPE_VIEW,
                                   GB_TYPE_VIEW_GRID_SPLIT);

  GB_WIDGET_CLASS_TEMPLATE (klass, "gb-view-stack.ui");
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, close_button);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, controls_stack);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, document_button);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, go_backward);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, go_forward);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, modified_label);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, popover);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, stack);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, title_label);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, views_button);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, views_listbox);
  GB_WIDGET_CLASS_BIND (klass, GbViewStack, views_popover);
}