Esempio n. 1
0
void
feed_list_node_rename (nodePtr node)
{
	GtkWidget	*nameentry;
	
	if (!nodenamedialog || !G_IS_OBJECT (nodenamedialog))
		nodenamedialog = liferea_dialog_new (NULL, "nodenamedialog");

	nameentry = liferea_dialog_lookup (nodenamedialog, "nameentry");
	gtk_entry_set_text (GTK_ENTRY (nameentry), node_get_title (node));
	g_signal_connect (G_OBJECT (nodenamedialog), "response", 
	                  G_CALLBACK (on_nodenamedialog_response), node);
	gtk_widget_show (nodenamedialog);
}
Esempio n. 2
0
void
ide_settings_bind (IdeSettings        *self,
                   const gchar        *key,
                   gpointer            object,
                   const gchar        *property,
                   GSettingsBindFlags  flags)
{
  g_return_if_fail (IDE_IS_SETTINGS (self));
  g_return_if_fail (key != NULL);
  g_return_if_fail (G_IS_OBJECT (object));
  g_return_if_fail (property != NULL);

  egg_settings_sandwich_bind (self->settings_sandwich, key, object, property, flags);
}
Esempio n. 3
0
GObject *
seahorse_object_model_get_row_key (SeahorseObjectModel *self, GtkTreeIter *iter)
{
    SeahorseObjectRow *skrow;

    g_return_val_if_fail (SEAHORSE_IS_OBJECT_MODEL (self), NULL);
    g_return_val_if_fail (self->data_column >= 0, NULL);

    gtk_tree_model_get (GTK_TREE_MODEL (self), iter, self->data_column, &skrow, -1);
    if (!skrow)
        return NULL;
    g_assert (G_IS_OBJECT (skrow->object));
    return skrow->object;
}
Esempio n. 4
0
void
spice_foreign_menu_listener_accept_async (GObject *listener,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data)
{
    g_return_if_fail(G_IS_OBJECT(listener));

#ifdef G_OS_WIN32
    spice_named_pipe_listener_accept_async (SPICE_NAMED_PIPE_LISTENER (listener), cancellable, callback, user_data);
#else
    g_socket_listener_accept_async (G_SOCKET_LISTENER (listener), cancellable, callback, user_data);
#endif
}
Esempio n. 5
0
static void
iface_print_string (TestIface   *tiobj,
		    const gchar *string)
{
  TestIfaceClass *iface;

  g_return_if_fail (TEST_IS_IFACE (tiobj));
  g_return_if_fail (G_IS_OBJECT (tiobj)); /* ensured through prerequisite */

  iface = TEST_IFACE_GET_CLASS (tiobj);
  g_object_ref (tiobj);
  iface->print_string (tiobj, string);
  g_object_unref (tiobj);
}
static void
_midgard_query_constraint_group_dispose (GObject *object)
{
	MidgardQueryConstraintGroup *self = MIDGARD_QUERY_CONSTRAINT_GROUP (object);
	GSList *self_constraints = MIDGARD_QUERY_CONSTRAINT_GROUP (self)->priv->constraints;
	GSList *l = NULL;
	for (l = self_constraints; l != NULL; l = l->next) {
		if (l->data && G_IS_OBJECT (l->data)) {
			g_object_unref(l->data);
			l->data = NULL;
		}
	}
	parent_class->dispose (object);
}
Esempio n. 7
0
/**
 * gst_controller_new:
 * @object: the object of which some properties should be controlled
 * @...: %NULL terminated list of property names that should be controlled
 *
 * Creates a new GstController for the given object's properties
 *
 * Returns: the new controller.
 */
GstController *
gst_controller_new (GObject * object, ...)
{
  GstController *self;
  va_list var_args;

  g_return_val_if_fail (G_IS_OBJECT (object), NULL);

  va_start (var_args, object);
  self = gst_controller_new_valist (object, var_args);
  va_end (var_args);

  return self;
}
Esempio n. 8
0
gboolean
gimp_config_dump (GObject              *gimp,
                  GimpConfigDumpFormat  format)
{
  GOutputStream    *output;
  GimpConfigWriter *writer;
  GimpConfig       *rc;

  g_return_val_if_fail (G_IS_OBJECT (gimp), FALSE);

  rc = g_object_new (GIMP_TYPE_RC,
                     "gimp", gimp,
                     NULL);

#ifdef G_OS_WIN32
  output = g_win32_output_stream_new ((gpointer) 1, FALSE);
#else
  output = g_unix_output_stream_new (1, FALSE);
#endif

  writer = gimp_config_writer_new_stream (output, NULL, NULL);

  switch (format)
    {
    case GIMP_CONFIG_DUMP_NONE:
      break;

    case GIMP_CONFIG_DUMP_GIMPRC:
      gimp_config_writer_comment (writer,
                                  "Dump of the GIMP default configuration");
      gimp_config_writer_linefeed (writer);
      gimp_config_serialize_properties (rc, writer);
      gimp_config_writer_linefeed (writer);
      break;

    case GIMP_CONFIG_DUMP_GIMPRC_SYSTEM:
      dump_gimprc_system (rc, writer, output);
      break;

    case GIMP_CONFIG_DUMP_GIMPRC_MANPAGE:
      dump_gimprc_manpage (rc, writer, output);
      break;
    }

  gimp_config_writer_finish (writer, NULL, NULL);
  g_object_unref (output);
  g_object_unref (rc);

  return TRUE;
}
Esempio n. 9
0
/**
 * g_value_init_from_instance:
 * @value: An uninitialized #GValue structure.
 * @instance: (type GObject.TypeInstance): the instance
 *
 * Initializes and sets @value from an instantiatable type via the
 * value_table's collect_value() function.
 *
 * Note: The @value will be initialised with the exact type of
 * @instance.  If you wish to set the @value's type to a different GType
 * (such as a parent class GType), you need to manually call
 * g_value_init() and g_value_set_instance().
 *
 * Since: 2.42
 */
void
g_value_init_from_instance (GValue  *value,
                            gpointer instance)
{
  g_return_if_fail (value != NULL && G_VALUE_TYPE(value) == 0);

  if (G_IS_OBJECT (instance))
    {
      /* Fast-path.
       * If G_IS_OBJECT() succeeds we know:
       * * that instance is present and valid
       * * that it is a GObject, and therefore we can directly
       *   use the collect implementation (g_object_ref) */
      value_meminit (value, G_TYPE_FROM_INSTANCE (instance));
      value->data[0].v_pointer = g_object_ref (instance);
    }
  else
    {  
      GType g_type;
      GTypeValueTable *value_table;
      GTypeCValue cvalue;
      gchar *error_msg;

      g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));

      g_type = G_TYPE_FROM_INSTANCE (instance);
      value_table = g_type_value_table_peek (g_type);
      g_return_if_fail (strcmp (value_table->collect_format, "p") == 0);

      memset (&cvalue, 0, sizeof (cvalue));
      cvalue.v_pointer = instance;

      /* setup and collect */
      value_meminit (value, g_type);
      value_table->value_init (value);
      error_msg = value_table->collect_value (value, 1, &cvalue, 0);
      if (error_msg)
        {
          g_warning ("%s: %s", G_STRLOC, error_msg);
          g_free (error_msg);

          /* we purposely leak the value here, it might not be
           * in a sane state if an error condition occoured
           */
          value_meminit (value, g_type);
          value_table->value_init (value);
        }
    }
}
Esempio n. 10
0
/**
 * Set an object property
 * @param filter_param A RSFilterParam
 * @param name The name of the property
 * @param value An object to store. Refcount will be incremented by one
 */
void
rs_filter_param_set_object(RSFilterParam *filter_param, const gchar *name, gpointer object)
{
	GValue *val;

	g_return_if_fail(RS_IS_FILTER_PARAM(filter_param));
	g_return_if_fail(name != NULL);
	g_return_if_fail(name[0] != '\0');
	g_return_if_fail(G_IS_OBJECT(object));

	val = new_value(G_OBJECT_TYPE(object));
	g_value_set_object(val, object);

	rs_filter_param_set_gvalue(filter_param, name, val);
}
Esempio n. 11
0
EXPORT_C
#endif

gboolean
gst_object_set_controller (GObject * object, GstController * controller)
{
  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
  g_return_val_if_fail (controller, FALSE);

  if (!g_object_get_qdata (object, priv_gst_controller_key)) {
    g_object_set_qdata (object, priv_gst_controller_key, controller);
    return (TRUE);
  }
  return (FALSE);
}
Esempio n. 12
0
GList*
seahorse_object_list_remove (GList *original, gpointer object)
{
	GList *at;
	
	g_return_val_if_fail (G_IS_OBJECT (object), original);
	
	at = g_list_find (original, object);
	if (at != NULL) {
		g_object_unref (object);
		return g_list_delete_link (original, at); 
	}
	
	return original;
}
void
nautilus_undo_transaction_unregister_object (GObject *object)
{
	GList *list;

	g_return_if_fail (G_IS_OBJECT (object));

	/* Remove atoms from each transaction on the list. */
	list = g_object_get_data (object, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
	if (list != NULL) {
		g_list_foreach (list, remove_atoms_cover, object);	
		g_list_free (list);
		g_object_set_data (object, NAUTILUS_UNDO_TRANSACTION_LIST_DATA, NULL);
	}
}
Esempio n. 14
0
void
nautilus_undo_attach_undo_manager (GObject *object,
				   NautilusUndoManager *manager)
{
	g_return_if_fail (G_IS_OBJECT (object));

	if (manager == NULL) {
		g_object_set_data (object, NAUTILUS_UNDO_MANAGER_DATA, NULL);
	} else {
		g_object_ref (manager);
		g_object_set_data_full
			(object, NAUTILUS_UNDO_MANAGER_DATA,
			 manager, g_object_unref);
	}
}
Esempio n. 15
0
gboolean
ui_folder_add (void)
{
	GtkWidget	*foldernameentry;
	
	if (!newfolderdialog || !G_IS_OBJECT (newfolderdialog))
		newfolderdialog = liferea_dialog_new (NULL, "newfolderdialog");

	foldernameentry = liferea_dialog_lookup (newfolderdialog, "foldertitleentry");
	gtk_entry_set_text (GTK_ENTRY (foldernameentry), "");
		
	gtk_widget_show (newfolderdialog);
	
	return TRUE;
}
Esempio n. 16
0
    //----- clean up when shut down
    void gx_destroy_event()
    {
      (void)gx_child_process::ChildProcess::instance()->gx_terminate_child_procs();

      gx_jack::NO_CONNECTION = 1;

      checky = (float)kEngineOff;

      GtkRegler::gtk_regler_destroy();

      if (G_IS_OBJECT(gx_gui::ib))
        g_object_unref(gx_gui::ib);

      if (G_IS_OBJECT(gx_gui::ibr))
        g_object_unref(gx_gui::ibr);

      if (G_IS_OBJECT(gx_gui::tribeimage))
        g_object_unref(gx_gui::tribeimage);

     /* if (G_IS_OBJECT(gx_gui::_image))
        g_object_unref(gx_gui::_image);*/

      gtk_main_quit();
    }
Esempio n. 17
0
EXPORT_C
#endif

GstControlSource *
gst_object_get_control_source (GObject * object, gchar * property_name)
{
  GstController *ctrl = NULL;

  g_return_val_if_fail (G_IS_OBJECT (object), NULL);

  if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
    return gst_controller_get_control_source (ctrl, property_name);
  }
  return NULL;
}
Esempio n. 18
0
EXPORT_C
#endif

GstClockTime
gst_object_suggest_next_sync (GObject * object)
{
  GstController *ctrl = NULL;

  g_return_val_if_fail (G_IS_OBJECT (object), GST_CLOCK_TIME_NONE);

  if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
    return gst_controller_suggest_next_sync (ctrl);
  }
  return (GST_CLOCK_TIME_NONE);
}
Esempio n. 19
0
void
athena_undo_attach_undo_manager (GObject *object,
				   AthenaUndoManager *manager)
{
	g_return_if_fail (G_IS_OBJECT (object));

	if (manager == NULL) {
		g_object_set_data (object, ATHENA_UNDO_MANAGER_DATA, NULL);
	} else {
		g_object_ref (manager);
		g_object_set_data_full
			(object, ATHENA_UNDO_MANAGER_DATA,
			 manager, g_object_unref);
	}
}
Esempio n. 20
0
static void 
midgard_dbobject_dispose (GObject *object)
{
	MidgardDBObject *self = MIDGARD_DBOBJECT (object);
	if (self->dbpriv->datamodel && G_IS_OBJECT (self->dbpriv->datamodel))
		g_object_unref(self->dbpriv->datamodel);

	self->dbpriv->row = -1;

	MidgardMetadata *metadata = MGD_DBOBJECT_METADATA (self);
	if (metadata && G_IS_OBJECT (metadata)) {
		g_object_unref (metadata);
		MGD_DBOBJECT_METADATA (self) = NULL;
	}

	/* Nullify connection's pointer. */
	MidgardConnection *mgd = MIDGARD_DBOBJECT (self)->dbpriv->mgd;
	if (mgd != NULL && G_IS_OBJECT (mgd)) {
		g_object_weak_unref (G_OBJECT(self->dbpriv->mgd), __weak_ref_notify, self);	
		MIDGARD_DBOBJECT (self)->dbpriv->mgd = NULL;
	}

	parent_class->dispose (object);
}
Esempio n. 21
0
static void
cell_destroyed (gpointer data)
{
	GalA11yECell * cell;

	g_return_if_fail (GAL_A11Y_IS_E_CELL (data));
	cell = GAL_A11Y_E_CELL (data);

	g_return_if_fail (cell->item && G_IS_OBJECT (cell->item));

	if (cell->item) {
		g_object_unref (cell->item);
		cell->item = NULL;
	}

}
Esempio n. 22
0
static void
service_online_state_changed_cb (GObject *service,
				 GParamSpec *param,
				 GObject *menu_item)
{
	EMenuItemSensitivityData *data;

	g_return_if_fail (G_IS_OBJECT (service));
	g_return_if_fail (GTK_IS_WIDGET (menu_item));

	data = g_new0 (EMenuItemSensitivityData, 1);
	data->service = g_object_ref (service);
	data->menu_item = g_object_ref (menu_item);

	g_idle_add_full (G_PRIORITY_HIGH_IDLE, update_menu_item_sensitivity_cb, data, free_menu_item_sensitivity_data);
}
static void
_midgard_sql_query_constraint_dispose (GObject *object)
{	
	parent_class->dispose (object);

	MidgardSqlQueryConstraint *self = (MidgardSqlQueryConstraint *) object;
	if (self->priv->column) {
		g_object_unref (self->priv->column);
		self->priv->column = NULL;
	}

	if (self->priv->holder && G_IS_OBJECT (self->priv->holder)) {
		g_object_unref (self->priv->holder);
		self->priv->holder = NULL;
	}
}
Esempio n. 24
0
EXPORT_C
#endif

GstController *
gst_object_control_properties (GObject * object, ...)
{
  GstController *ctrl;
  va_list var_args;

  g_return_val_if_fail (G_IS_OBJECT (object), NULL);

  va_start (var_args, object);
  ctrl = gst_controller_new_valist (object, var_args);
  va_end (var_args);
  return (ctrl);
}
Esempio n. 25
0
EXPORT_C
#endif

GstClockTime
gst_object_get_control_rate (GObject * object)
{
  GstController *ctrl;
  GstClockTime control_rate = GST_CLOCK_TIME_NONE;

  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);

  if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
    g_object_get (ctrl, "control-rate", &control_rate, NULL);
  }
  return (control_rate);
}
Esempio n. 26
0
CatchTask *
catch_task_new (gpointer            source_object,
                GAsyncReadyCallback callback,
                gpointer            user_data)
{
   CatchTask *task;

   g_return_val_if_fail(G_IS_OBJECT(source_object), NULL);

   task = g_object_new(CATCH_TYPE_TASK, NULL);
   task->priv->source_object = g_object_ref(source_object);
   task->priv->callback = callback;
   task->priv->callback_data = user_data;

   return task;
}
Esempio n. 27
0
void
evd_dbus_agent_set_object_vtable (GObject             *object,
                                  EvdDBusAgentVTable  *vtable,
                                  gpointer             user_data)
{
  ObjectData *data;

  g_return_if_fail (G_IS_OBJECT (object));

  data = evd_dbus_agent_get_object_data (object);
  if (data == NULL)
    data = evd_dbus_agent_setup_object_data (object);

  data->vtable = vtable;
  data->vtable_user_data = user_data;
}
Esempio n. 28
0
GimpObject *
gimp_create_display (Gimp      *gimp,
                     GimpImage *image,
                     GimpUnit   unit,
                     gdouble    scale,
                     GObject   *monitor)
{
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
  g_return_val_if_fail (monitor == NULL || G_IS_OBJECT (monitor), NULL);

  if (gimp->gui.display_create)
    return gimp->gui.display_create (gimp, image, unit, scale, monitor);

  return NULL;
}
Esempio n. 29
0
static BOOL tsmf_gstreamer_buffer_level(ITSMFDecoder* decoder)
{
	TSMFGstreamerDecoder* mdecoder = (TSMFGstreamerDecoder *) decoder;
	DEBUG_TSMF("");

	if (!mdecoder)
		return FALSE;

	guint clbuff = 0;

	if (G_IS_OBJECT(mdecoder->queue))
		g_object_get(mdecoder->queue, "current-level-buffers", &clbuff, NULL);

	DEBUG_TSMF("%s buffer level %u", get_type(mdecoder), clbuff);
	return clbuff;
}
Esempio n. 30
0
/**
 * gst_object_uncontrol_properties:
 * @object: the object of which some properties should not be controlled anymore
 * @...: %NULL terminated list of property names that should be controlled
 *
 * Convenience function for GObject
 *
 * Removes the given element's properties from it's controller
 *
 * Returns: %FALSE if one of the given property names isn't handled by the
 * controller, %TRUE otherwise
 * Since: 0.9
 */
gboolean
gst_object_uncontrol_properties (GObject * object, ...)
{
  gboolean res = FALSE;
  GstController *ctrl;

  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);

  if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
    va_list var_args;

    va_start (var_args, object);
    res = gst_controller_remove_properties_valist (ctrl, var_args);
    va_end (var_args);
  }
  return (res);
}