當前位置: 首頁>>代碼示例>>C++>>正文


C++ G_OBJECT_TYPE函數代碼示例

本文整理匯總了C++中G_OBJECT_TYPE函數的典型用法代碼示例。如果您正苦於以下問題:C++ G_OBJECT_TYPE函數的具體用法?C++ G_OBJECT_TYPE怎麽用?C++ G_OBJECT_TYPE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了G_OBJECT_TYPE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ges_project_try_updating_id

gchar *
ges_project_try_updating_id (GESProject * project, GESAsset * asset,
    GError * error)
{
  gchar *new_id = NULL;

  g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
  g_return_val_if_fail (GES_IS_ASSET (asset), NULL);
  g_return_val_if_fail (error, NULL);

  GST_DEBUG_OBJECT (project, "Try to proxy %s", ges_asset_get_id (asset));
  if (ges_asset_request_id_update (asset, &new_id, error) == FALSE) {
    GST_DEBUG_OBJECT (project, "Type: %s can not be proxied for id: %s",
        g_type_name (G_OBJECT_TYPE (asset)), ges_asset_get_id (asset));

    return NULL;
  }

  if (new_id == NULL)
    g_signal_emit (project, _signals[MISSING_URI_SIGNAL], 0, error, asset,
        &new_id);

  if (new_id) {
    if (!ges_asset_set_proxy (asset, new_id)) {
      g_free (new_id);
      new_id = NULL;
    }
  }

  g_hash_table_remove (project->priv->loading_assets, ges_asset_get_id (asset));

  return new_id;
}
開發者ID:vliaskov,項目名稱:PitiviGes,代碼行數:33,代碼來源:ges-project.c

示例2: notify

static void
notify (GObject *object, GParamSpec *pspec)
{
	PropertiesChangedInfo *info;
	GValue *value;

	/* Ignore properties that shouldn't be exported */
	if (pspec->flags & NM_PROPERTY_PARAM_NO_EXPORT)
		return;

	info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED);
	if (!info) {
		info = properties_changed_info_new ();
		g_object_set_data_full (object, NM_DBUS_PROPERTY_CHANGED, info, properties_changed_info_destroy);
		info->signal_id = g_signal_lookup ("properties-changed", G_OBJECT_TYPE (object));
		g_assert (info->signal_id);
	}

	value = g_slice_new0 (GValue);
	g_value_init (value, pspec->value_type);
	g_object_get_property (object, pspec->name, value);
	g_hash_table_insert (info->hash, uscore_to_wincaps (pspec->name), value);

	if (!info->idle_id)
		info->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, properties_changed, object, idle_id_reset);
}
開發者ID:T100012,項目名稱:NetworkManager,代碼行數:26,代碼來源:nm-properties-changed-signal.c

示例3: e_extensible_list_extensions

/**
 * e_extensible_list_extensions:
 * @extensible: an #EExtensible
 * @extension_type: the type of extensions to list
 *
 * Returns a list of #EExtension objects bound to @extensible whose
 * types are ancestors of @extension_type.  For a complete list of
 * extension objects bound to @extensible, pass %E_TYPE_EXTENSION.
 *
 * The list itself should be freed with g_list_free().  The extension
 * objects are owned by @extensible and should not be unreferenced.
 *
 * Returns: a list of extension objects derived from @extension_type
 *
 * Since: 3.4
 **/
GList *
e_extensible_list_extensions (EExtensible *extensible,
                              GType extension_type)
{
	GPtrArray *extensions;
	GList *list = NULL;
	guint ii;

	g_return_val_if_fail (E_IS_EXTENSIBLE (extensible), NULL);
	g_return_val_if_fail (IS_AN_EXTENSION_TYPE (extension_type), NULL);

	e_extensible_load_extensions (extensible);

	extensions = extensible_get_extensions (extensible);
	g_return_val_if_fail (extensions != NULL, NULL);

	for (ii = 0; ii < extensions->len; ii++) {
		GObject *object;

		object = g_ptr_array_index (extensions, ii);
		if (g_type_is_a (G_OBJECT_TYPE (object), extension_type))
			list = g_list_prepend (list, object);
	}

	return g_list_reverse (list);
}
開發者ID:gcampax,項目名稱:evolution-data-server,代碼行數:42,代碼來源:e-extensible.c

示例4: st_scroll_view_add

static void
st_scroll_view_add (ClutterContainer *container,
                    ClutterActor     *actor)
{
  StScrollView *self = ST_SCROLL_VIEW (container);
  StScrollViewPrivate *priv = self->priv;

  if (ST_IS_SCROLLABLE (actor))
    {
      priv->child = actor;

      /* chain up to StBin::add() */
      st_scroll_view_parent_iface->add (container, actor);

      st_scrollable_set_adjustments (ST_SCROLLABLE (actor),
                                     priv->hadjustment, priv->vadjustment);
    }
  else
    {
      g_warning ("Attempting to add an actor of type %s to "
                 "a StScrollView, but the actor does "
                 "not implement StScrollable.",
                 g_type_name (G_OBJECT_TYPE (actor)));
    }
}
開發者ID:aldatsa,項目名稱:Cinnamon,代碼行數:25,代碼來源:st-scroll-view.c

示例5: gtk_dialog_add_action_widget

/* Outputs source to add a child widget to a hbuttonbox. We need to check if
   the hbuttonbox is a GtkDialog action area, and if it is we use the special
   gtk_dialog_add_action_widget() function to add it. */
void
gb_hbutton_box_write_add_child_source (GtkWidget * parent,
                                       const gchar *parent_name,
                                       GtkWidget *child,
                                       GbWidgetWriteSourceData * data)
{
    if (gb_hbutton_box_is_dialog_action_area (parent)
            && G_OBJECT_TYPE (child) == GTK_TYPE_BUTTON)
    {
        gint response_id;
        char *response_name, *dialog_name;

        response_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (child), GladeDialogResponseIDKey));
        response_name = gb_dialog_response_id_to_string (response_id);

        dialog_name = (char*) gtk_widget_get_name (parent->parent->parent);
        dialog_name = source_create_valid_identifier (dialog_name);

        source_add (data,
                    "  gtk_dialog_add_action_widget (GTK_DIALOG (%s), %s, %s);\n",
                    dialog_name, data->wname, response_name);

        g_free (dialog_name);
    }
    else
    {
        /* Use the standard gtk_container_add(). */
        source_add (data, "  gtk_container_add (GTK_CONTAINER (%s), %s);\n",
                    parent_name, data->wname);
    }
}
開發者ID:jubalh,項目名稱:deadbeef,代碼行數:34,代碼來源:gbhbuttonbox.c

示例6: gb_slider_add_child

static void
gb_slider_add_child (GtkBuildable *buildable,
                     GtkBuilder   *builder,
                     GObject      *child,
                     const gchar  *type)
{
  GbSliderPosition position = GB_SLIDER_NONE;

  g_assert (GTK_IS_BUILDABLE (buildable));
  g_assert (GTK_IS_BUILDER (builder));
  g_assert (G_IS_OBJECT (child));

  if (!GTK_IS_WIDGET (child))
    {
      g_warning ("Child \"%s\" must be of type GtkWidget.",
                 g_type_name (G_OBJECT_TYPE (child)));
      return;
    }

  if (ide_str_equal0 (type, "bottom"))
    position = GB_SLIDER_BOTTOM;
  else if (ide_str_equal0 (type, "top"))
    position = GB_SLIDER_TOP;
  else if (ide_str_equal0 (type, "left"))
    position = GB_SLIDER_LEFT;
  else if (ide_str_equal0 (type, "right"))
    position = GB_SLIDER_RIGHT;

  gtk_container_add_with_properties (GTK_CONTAINER (buildable), GTK_WIDGET (child),
                                     "position", position,
                                     NULL);
}
開發者ID:MaX121,項目名稱:gnome-builder,代碼行數:32,代碼來源:gb-slider.c

示例7: gfbgraph_connectable_default_parse_connected_data

/**
 * gfbgraph_connectable_default_parse_connected_data:
 * @self: a #GFBGraphConnectable.
 * @payload: a const #gchar with the response string from the Facebook Graph API.
 * @error: (allow-none): a #GError or %NULL.
 *
 * In most cases, #GFBGraphConnectable implementers can use this function in order to parse
 * the response when a gfbgraph_node_get_connection_nodes() is executed and the
 * gfbgraph_connectable_parse_connected_data() was called.
 *
 * Normally, Facebook Graph API returns the connections in the same way, using JSON objects,
 * with a root object called "data".
 *
 * Returns: (element-type GFBGraphNode) (transfer full): a newly-allocated #GList of #GFBGraphNode with the same #GType as @self.
 **/
GList*
gfbgraph_connectable_default_parse_connected_data (GFBGraphConnectable *self, const gchar *payload, GError **error)
{
        GList *nodes_list = NULL;
        JsonParser *jparser;
        GType node_type;

        node_type = G_OBJECT_TYPE (self);

        jparser = json_parser_new ();
        if (json_parser_load_from_data (jparser, payload, -1, error)) {
                JsonNode *root_jnode;
                JsonObject *main_jobject;
                JsonArray *nodes_jarray;
                int i = 0;

                root_jnode = json_parser_get_root (jparser);
                main_jobject = json_node_get_object (root_jnode);
                nodes_jarray = json_object_get_array_member (main_jobject, "data");
                for (i = 0; i < json_array_get_length (nodes_jarray); i++) {
                        JsonNode *jnode;
                        GFBGraphNode *node;

                        jnode = json_array_get_element (nodes_jarray, i);
                        node = GFBGRAPH_NODE (json_gobject_deserialize (node_type, jnode));
                        nodes_list = g_list_append (nodes_list, node);
                }
        }

        g_clear_object (&jparser);

        return nodes_list;
}
開發者ID:alvaropg,項目名稱:gfbgraph,代碼行數:48,代碼來源:gfbgraph-connectable.c

示例8: ATTR_PRINTF_FORMAT

ATTR_PRINTF_FORMAT (2,3) gchar *
_lp_event_to_string (lp_Event *event, const gchar *fmt, ...)
{
  va_list args;
  gchar *suffix = NULL;
  gchar *str;
  gint n;

  va_start (args, fmt);
  n = g_vasprintf (&suffix, fmt, args);
  g_assert_nonnull (suffix);
  g_assert (n >= 0);
  va_end (args);

  str = g_strdup_printf ("\
%s at %p\n\
  source: %s at %p\n\
  mask: 0x%x\n\
%s\
",                       G_OBJECT_TYPE_NAME (event),
                         G_TYPE_CHECK_INSTANCE_CAST (event,
                                                     G_OBJECT_TYPE (event),
                                                     gpointer),
                         LP_IS_SCENE (event->priv->source) ? "lp_Scene"
                         : LP_IS_MEDIA (event->priv->source) ? "lp_Media"
                         : "unknown",
                         event->priv->source,
                         (guint) event->priv->mask,
                         suffix);
  g_assert_nonnull (str);
  g_free (suffix);

  return str;
}
開發者ID:TeleMidia,項目名稱:LibPlay,代碼行數:34,代碼來源:lp-event.c

示例9: get_ancestors

static gboolean
get_ancestors (GtkWidget  *widget,
               GType       widget_type,
               GtkWidget **ancestor,
               GtkWidget **below)
{
  GtkWidget *a, *b;

  a = NULL;
  b = widget;
  while (b != NULL)
    {
      a = gtk_widget_get_parent (b);
      if (!a)
        return FALSE;
      if (g_type_is_a (G_OBJECT_TYPE (a), widget_type))
        break;
      b = a;
    }

  *below = b;
  *ancestor = a;

  return TRUE;
}
開發者ID:Sidnioulz,項目名稱:SandboxGtk,代碼行數:25,代碼來源:gtkmenusectionbox.c

示例10: netstatus_connect_signal_while_alive

void
netstatus_connect_signal_while_alive (gpointer    object,
                                      const char *detailed_signal,
                                      GCallback   func,
                                      gpointer    func_data,
                                      gpointer    alive_object)
{
  GClosure *closure;
  GType     type;
  guint     signal_id = 0;
  GQuark    detail = 0;
  
  type = G_OBJECT_TYPE (object);

  if (!g_signal_parse_name (detailed_signal, type, &signal_id, &detail, FALSE))
    {
      g_warning (G_STRLOC ": unable to parse signal \"%s\" for type \"%s\"",
                 detailed_signal, g_type_name (type));
      return;
    }

  closure = g_cclosure_new (func, func_data, NULL);
  g_object_watch_closure (G_OBJECT (alive_object), closure);
  g_signal_connect_closure_by_id (object, signal_id, detail, closure, FALSE);
}
開發者ID:geekless,項目名稱:waterline,代碼行數:25,代碼來源:netstatus-util.c

示例11: _bus_stop_stream_cb

static gboolean
_bus_stop_stream_cb (GstBus *bus, GstMessage *message, gpointer user_data)
{
  FsStreamTransmitter *st = user_data;
  GstState oldstate, newstate, pending;

  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_STATE_CHANGED ||
      G_OBJECT_TYPE (GST_MESSAGE_SRC (message)) != GST_TYPE_PIPELINE)
    return bus_error_callback (bus, message, user_data);

  gst_message_parse_state_changed (message, &oldstate, &newstate, &pending);

  if (newstate != GST_STATE_PLAYING)
    return TRUE;

  if (pending != GST_STATE_VOID_PENDING)
    ts_fail ("New state playing, but pending is %d", pending);

  GST_DEBUG ("Stopping stream transmitter");

  fs_stream_transmitter_stop (st);
  g_object_unref (st);

  GST_DEBUG ("Stopped stream transmitter");

  g_atomic_int_set(&running, FALSE);
  g_main_loop_quit (loop);

  return TRUE;
}
開發者ID:pexip,項目名稱:farstream,代碼行數:30,代碼來源:rawudp.c

示例12: gst_is_gl_memory_pbo

/**
 * gst_is_gl_memory_pbo:
 * @mem:a #GstMemory
 * 
 * Returns: whether the memory at @mem is a #GstGLMemoryPBO
 *
 * Since: 1.8
 */
gboolean
gst_is_gl_memory_pbo (GstMemory * mem)
{
  return mem != NULL && mem->allocator != NULL
      && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
      GST_TYPE_GL_MEMORY_PBO_ALLOCATOR);
}
開發者ID:Haifen,項目名稱:gst-plugins-bad,代碼行數:15,代碼來源:gstglmemorypbo.c

示例13: gtk_tool_button_create_menu_proxy

static gboolean
gtk_tool_button_create_menu_proxy (GtkToolItem *item)
{
  GtkToolButton *button = GTK_TOOL_BUTTON (item);
  GtkWidget *menu_item;
  GtkWidget *menu_image = NULL;
  GtkStockItem stock_item;
  gboolean use_mnemonic = TRUE;
  const char *label;

  if (_gtk_tool_item_create_menu_proxy (item))
    return TRUE;
 
  if (GTK_IS_LABEL (button->priv->label_widget))
    {
      label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
      use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget));
    }
  else if (button->priv->label_text)
    {
      label = button->priv->label_text;
      use_mnemonic = button->priv->use_underline;
    }
  else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
    {
      label = stock_item.label;
    }
  else
    {
      label = "";
    }
  
  if (use_mnemonic)
    menu_item = gtk_image_menu_item_new_with_mnemonic (label);
  else
    menu_item = gtk_image_menu_item_new_with_label (label);

  if (GTK_IS_IMAGE (button->priv->icon_widget))
    {
      menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget),
					  gtk_widget_get_settings (GTK_WIDGET (button)));
    }
  else if (button->priv->stock_id)
    {
      menu_image = gtk_image_new_from_stock (button->priv->stock_id, GTK_ICON_SIZE_MENU);
    }

  if (menu_image)
    gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image);

  g_signal_connect_closure_by_id (menu_item,
				  g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
				  g_cclosure_new_object_swap (G_CALLBACK (gtk_button_clicked),
							      G_OBJECT (GTK_TOOL_BUTTON (button)->priv->button)),
				  FALSE);

  gtk_tool_item_set_proxy_menu_item (GTK_TOOL_ITEM (button), MENU_ID, menu_item);
  
  return TRUE;
}
開發者ID:ystk,項目名稱:debian-gtk-2.0,代碼行數:60,代碼來源:gtktoolbutton.c

示例14: mcd_dbus_get_interfaces

void
mcd_dbus_get_interfaces (TpSvcDBusProperties *self, const gchar *name,
			 GValue *value)
{
    McdInterfaceData *iface_data, *id;
    GPtrArray *a_ifaces;
    GType type;

    DEBUG ("called");

    a_ifaces = g_ptr_array_new ();

    for (type = G_OBJECT_TYPE (self); type != 0; type = g_type_parent (type))
    {
	iface_data = g_type_get_qdata (type, MCD_INTERFACES_QUARK);
	if (!iface_data) continue;

	for (id = iface_data; id->get_type; id++)
        {
            if (id->optional &&
                !mcd_dbus_is_active_optional_interface (self,
                                                        id->get_type ()))
            {
                DEBUG ("skipping inactive optional iface %s", id->interface);
                continue;
            }

	    g_ptr_array_add (a_ifaces, g_strdup (id->interface));
        }
    }
    g_ptr_array_add (a_ifaces, NULL);

    g_value_init (value, G_TYPE_STRV);
    g_value_take_boxed (value, g_ptr_array_free (a_ifaces, FALSE));
}
開發者ID:freedesktop-unofficial-mirror,項目名稱:telepathy__telepathy-mission-control,代碼行數:35,代碼來源:mcd-dbusprop.c

示例15: rg_m_get_style_by_paths

static VALUE
rg_m_get_style_by_paths(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
    VALUE settings, widget_path, class_path, klass;
    GtkStyle* style;
    GType gtype;
    const gchar* name;

    rb_scan_args(argc, argv, "13", &settings, &widget_path, &class_path, &klass);

    style = gtk_rc_get_style_by_paths(GTK_SETTINGS(RVAL2GOBJ(settings)),
                                      NIL_P(widget_path) ? NULL : RVAL2CSTR(widget_path),
                                      NIL_P(class_path) ? NULL : RVAL2CSTR(class_path),
                                      NIL_P(klass) ? G_TYPE_NONE : CLASS2GTYPE(klass));

    if (style){
        gtype = G_OBJECT_TYPE(style);
        name = G_OBJECT_TYPE_NAME(style);
        if (! rb_const_defined_at(mGtk, rb_intern(name))){
            G_DEF_CLASS(gtype, (gchar*)name, mGtk);
        }
        return GOBJ2RVAL(style);
    }
    return Qnil;
}
開發者ID:Vasfed,項目名稱:ruby-gnome2,代碼行數:25,代碼來源:rbgtkrc.c


注:本文中的G_OBJECT_TYPE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。