示例#1
0
static void
rg_graph_init (RgGraph *self)
{
  RgGraphPrivate *priv = rg_graph_get_instance_private (self);

  priv->renderers = g_ptr_array_new_with_free_func (g_object_unref);

  priv->table_signals = egg_signal_group_new (RG_TYPE_TABLE);

  egg_signal_group_connect_object (priv->table_signals,
                                   "notify::value-max",
                                   G_CALLBACK (gtk_widget_queue_resize),
                                   self,
                                   G_CONNECT_SWAPPED);

  egg_signal_group_connect_object (priv->table_signals,
                                   "notify::value-min",
                                   G_CALLBACK (gtk_widget_queue_resize),
                                   self,
                                   G_CONNECT_SWAPPED);

  egg_signal_group_connect_object (priv->table_signals,
                                   "notify::timespan",
                                   G_CALLBACK (gtk_widget_queue_resize),
                                   self,
                                   G_CONNECT_SWAPPED);

  egg_signal_group_connect_object (priv->table_signals,
                                   "changed",
                                   G_CALLBACK (rg_graph__table_changed),
                                   self,
                                   G_CONNECT_SWAPPED);
}
static void
ide_git_buffer_change_monitor_init (IdeGitBufferChangeMonitor *self)
{
  EGG_COUNTER_INC (instances);

  self->signal_group = egg_signal_group_new (IDE_TYPE_BUFFER);
  egg_signal_group_connect_object (self->signal_group,
                                   "insert-text",
                                   G_CALLBACK (ide_git_buffer_change_monitor__buffer_insert_text_after_cb),
                                   self,
                                   G_CONNECT_SWAPPED | G_CONNECT_AFTER);
  egg_signal_group_connect_object (self->signal_group,
                                   "delete-range",
                                   G_CALLBACK (ide_git_buffer_change_monitor__buffer_delete_range_cb),
                                   self,
                                   G_CONNECT_SWAPPED);
  egg_signal_group_connect_object (self->signal_group,
                                   "delete-range",
                                   G_CALLBACK (ide_git_buffer_change_monitor__buffer_delete_range_after_cb),
                                   self,
                                   G_CONNECT_SWAPPED | G_CONNECT_AFTER);
  egg_signal_group_connect_object (self->signal_group,
                                   "changed",
                                   G_CALLBACK (ide_git_buffer_change_monitor__buffer_changed_after_cb),
                                   self,
                                   G_CONNECT_SWAPPED | G_CONNECT_AFTER);

  self->vcs_signal_group = egg_signal_group_new (IDE_TYPE_GIT_VCS);
  egg_signal_group_connect_object (self->vcs_signal_group,
                                   "reloaded",
                                   G_CALLBACK (ide_git_buffer_change_monitor__vcs_reloaded_cb),
                                   self,
                                   G_CONNECT_SWAPPED);
}
static void
ide_highlight_engine_init (IdeHighlightEngine *self)
{
    self->settings = g_settings_new ("org.gnome.builder.code-insight");
    self->enabled = g_settings_get_boolean (self->settings, "semantic-highlighting");
    self->signal_group = egg_signal_group_new (IDE_TYPE_BUFFER);

    egg_signal_group_connect_object (self->signal_group,
                                     "insert-text",
                                     G_CALLBACK (ide_highlight_engine__buffer_insert_text_cb),
                                     self,
                                     G_CONNECT_SWAPPED | G_CONNECT_AFTER);

    egg_signal_group_connect_object (self->signal_group,
                                     "delete-range",
                                     G_CALLBACK (ide_highlight_engine__buffer_delete_range_cb),
                                     self,
                                     G_CONNECT_SWAPPED | G_CONNECT_AFTER);

    egg_signal_group_connect_object (self->signal_group,
                                     "notify::language",
                                     G_CALLBACK (ide_highlight_engine__notify_language_cb),
                                     self,
                                     G_CONNECT_SWAPPED);

    egg_signal_group_connect_object (self->signal_group,
                                     "notify::style-scheme",
                                     G_CALLBACK (ide_highlight_engine__notify_style_scheme_cb),
                                     self,
                                     G_CONNECT_SWAPPED);

    g_signal_connect_object (self->signal_group,
                             "bind",
                             G_CALLBACK (ide_highlight_engine__bind_buffer_cb),
                             self,
                             G_CONNECT_SWAPPED);

    g_signal_connect_object (self->signal_group,
                             "unbind",
                             G_CALLBACK (ide_highlight_engine__unbind_buffer_cb),
                             self,
                             G_CONNECT_SWAPPED);

    g_signal_connect_object (self->settings,
                             "changed::semantic-highlighting",
                             G_CALLBACK (ide_highlight_engine_settings_changed),
                             self,
                             G_CONNECT_SWAPPED);
}
示例#4
0
/**
 * egg_state_machine_connect_object: (skip)
 * @self: A #EggStateMachine.
 * @state: The state the signal connection should exist within
 * @source: the source object to connect to
 * @detailed_signal: The detailed signal of @source to connect.
 * @callback: (scope notified) (closure user_data): The callback to execute upon signal emission.
 * @user_data: The user data for @callback.
 * @flags: signal connection flags.
 *
 * Connects to the @detailed_signal of @source only when the current
 * state of the state machine is @state.
 */
void
egg_state_machine_connect_object (EggStateMachine *self,
                                  const gchar     *state,
                                  gpointer         source,
                                  const gchar     *detailed_signal,
                                  GCallback        callback,
                                  gpointer         user_data,
                                  GConnectFlags    flags)
{
  EggState *state_obj;
  EggSignalGroup *signals;

  g_return_if_fail (EGG_IS_STATE_MACHINE (self));
  g_return_if_fail (state != NULL);
  g_return_if_fail (G_IS_OBJECT (source));
  g_return_if_fail (detailed_signal != NULL);
  g_return_if_fail (callback != NULL);

  state_obj = egg_state_machine_get_state_obj (self, state);

  if (!(signals = g_hash_table_lookup (state_obj->signals, source)))
    {
      signals = egg_signal_group_new (G_OBJECT_TYPE (source));
      g_hash_table_insert (state_obj->signals, source, signals);

      g_object_weak_ref (source,
                         egg_state_machine__signal_source_weak_notify,
                         self);
    }

  egg_signal_group_connect_object (signals, detailed_signal, callback, user_data, flags);
}
static void
ide_xml_highlighter_init (IdeXmlHighlighter *self)
{
  self->signal_group = egg_signal_group_new (IDE_TYPE_BUFFER);
  egg_signal_group_connect_object (self->signal_group,
                                   "cursor-moved",
                                   G_CALLBACK (ide_xml_highlighter_cursor_moved_cb),
                                   self,
                                   0);

  g_signal_connect_object (self->signal_group,
                           "bind",
                           G_CALLBACK (ide_xml_highlighter_bind_buffer_cb),
                           self,
                           G_CONNECT_SWAPPED);

  g_signal_connect_object (self->signal_group,
                           "unbind",
                           G_CALLBACK (ide_xml_highlighter_unbind_buffer_cb),
                           self,
                           G_CONNECT_SWAPPED);
}
示例#6
0
static void
egg_search_bar_init (EggSearchBar *self)
{
  EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self);
  GtkStyleContext *style_context;
  GtkBox *box;

  priv->window_signals = egg_signal_group_new (GTK_TYPE_WINDOW);
  egg_signal_group_connect_object (priv->window_signals,
                                   "key-press-event",
                                   G_CALLBACK (toplevel_key_press_event_before),
                                   self,
                                   G_CONNECT_SWAPPED);
  egg_signal_group_connect_object (priv->window_signals,
                                   "key-press-event",
                                   G_CALLBACK (toplevel_key_press_event_after),
                                   self,
                                   G_CONNECT_SWAPPED | G_CONNECT_AFTER);

  priv->revealer =
    g_object_new (GTK_TYPE_REVEALER,
                  "transition-type", GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN,
                  "visible", TRUE,
                  NULL);
  /* outer box used for styling */
  box =
    g_object_new (GTK_TYPE_BOX,
                  "orientation", GTK_ORIENTATION_HORIZONTAL,
                  "visible", TRUE,
                  NULL);
  priv->box =
    g_object_new (GTK_TYPE_BOX,
                  "hexpand", TRUE,
                  "margin-bottom", 3,
                  "margin-end", 6,
                  "margin-start", 6,
                  "margin-top", 3,
                  "orientation", GTK_ORIENTATION_HORIZONTAL,
                  "visible", TRUE,
                  NULL);
  priv->entry =
    g_object_connect (g_object_new (GTK_TYPE_SEARCH_ENTRY,
                                    "placeholder-text", _("Search"),
                                    "visible", TRUE,
                                    NULL),
                      "swapped_object_signal::activate", egg_search_bar__entry_activate, self,
                      NULL);
  priv->close_button =
    g_object_new (GTK_TYPE_BUTTON,
                  "child", g_object_new (GTK_TYPE_IMAGE,
                                         "icon-name", "window-close-symbolic",
                                         "visible", TRUE,
                                         NULL),
                  "visible", FALSE,
                  NULL);

  style_context = gtk_widget_get_style_context (GTK_WIDGET (box));
  gtk_style_context_add_class (style_context, "search-bar");

  gtk_container_add (GTK_CONTAINER (priv->revealer), GTK_WIDGET (box));
  gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->box));
  gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->revealer));
  gtk_container_add_with_properties (GTK_CONTAINER (priv->box),
                                     GTK_WIDGET (priv->close_button),
                                     "fill", FALSE,
                                     "pack-type", GTK_PACK_END,
                                     NULL);
  gtk_box_set_center_widget (priv->box, GTK_WIDGET (priv->entry));
}