当前位置: 首页>>代码示例>>C++>>正文


C++ GPOINTER_TO_INT函数代码示例

本文整理汇总了C++中GPOINTER_TO_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ GPOINTER_TO_INT函数的具体用法?C++ GPOINTER_TO_INT怎么用?C++ GPOINTER_TO_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GPOINTER_TO_INT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gtr_confirm_remove

void
gtr_confirm_remove (GtkWindow  * parent,
                    TrCore     * core,
                    GSList     * torrent_ids,
                    gboolean     delete_files)
{
    GSList * l;
    GtkWidget * d;
    GString * primary_text;
    GString * secondary_text;
    struct delete_data * dd;
    int connected = 0;
    int incomplete = 0;
    const int count = g_slist_length (torrent_ids);

    if (!count)
        return;

    dd = g_new0 (struct delete_data, 1);
    dd->core = core;
    dd->torrent_ids = torrent_ids;
    dd->delete_files = delete_files;

    for (l=torrent_ids; l!=NULL; l=l->next)
    {
        const int id = GPOINTER_TO_INT (l->data);
        tr_torrent * tor = gtr_core_find_torrent (core, id);
        const tr_stat * stat = tr_torrentStat (tor);
        if (stat->leftUntilDone) ++incomplete;
        if (stat->peersConnected) ++connected;
    }

    primary_text = g_string_new (NULL);

    if (!delete_files)
    {
        g_string_printf (primary_text, ngettext ("Remove Torrent?",
                                                 "Remove %d Torrents?",
                                                 count), count);
    }
    else
    {
        g_string_printf (primary_text, ngettext ("Delete this torrent's downloaded files?",
                                                 "Delete these %d torrents' downloaded files?",
                                                 count), count);
    }

    secondary_text = g_string_new (NULL);

    if (!incomplete && !connected)
    {
        g_string_assign (secondary_text, ngettext (
                "Once removed, continuing the transfer will require the torrent file or magnet link.",
                "Once removed, continuing the transfers will require the torrent files or magnet links.",
                count));
    }
    else if (count == incomplete)
    {
        g_string_assign (secondary_text, ngettext ("This torrent has not finished downloading.",
                                                   "These torrents have not finished downloading.",
                                                   count));
    }
    else if (count == connected)
    {
        g_string_assign (secondary_text, ngettext ("This torrent is connected to peers.",
                                                   "These torrents are connected to peers.",
                                                   count));
    }
    else
    {
        if (connected)
            g_string_append (secondary_text, ngettext ("One of these torrents is connected to peers.",
                                                       "Some of these torrents are connected to peers.",
                                                       connected));
        if (connected && incomplete)
            g_string_append (secondary_text, "\n");

        if (incomplete)
            g_string_assign (secondary_text, ngettext ("One of these torrents has not finished downloading.",
                                                       "Some of these torrents have not finished downloading.",
                                                       incomplete));
    }

    d = gtk_message_dialog_new_with_markup (parent,
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_MESSAGE_QUESTION,
                                            GTK_BUTTONS_NONE,
                                            "<big><b>%s</b></big>",
                                            primary_text->str);
    if (secondary_text->len)
        gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (d),
                                                    "%s", secondary_text->str);
    gtk_dialog_add_buttons (GTK_DIALOG (d),
                            _("_Cancel"), GTK_RESPONSE_CANCEL,
                          (delete_files ? _("_Delete"):
                              _("Remove")), GTK_RESPONSE_ACCEPT,
                            NULL);

    gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_CANCEL);

//.........这里部分代码省略.........
开发者ID:Cleiton-Floss,项目名称:transmissionGTK3,代码行数:101,代码来源:dialogs.c

示例2: mex_proxy_controller_changed_cb

static void
mex_proxy_controller_changed_cb (GController          *controller,
                                 GControllerAction     action,
                                 GControllerReference *ref,
                                 MexProxy             *proxy)
{
  gint i, n_indices;
  MexContent *content;

  MexProxyPrivate *priv = proxy->priv;

  n_indices = g_controller_reference_get_n_indices (ref);

  switch (action)
    {
    case G_CONTROLLER_ADD:
      for (i = 0; i < n_indices; i++)
        {
          gint content_index = g_controller_reference_get_index_uint (ref, i);
          content = mex_model_get_content (priv->model, content_index);

          mex_proxy_add_content (proxy, content);
        }
      break;

    case G_CONTROLLER_REMOVE:
      {
        gint length, fillin = 0, start_fillin;
        GList *positions = NULL, *position;

        for (i = 0; i < n_indices; i++)
          {
            gint content_index = g_controller_reference_get_index_uint (ref, i);
            if (content_index >= priv->limit)
              positions = g_list_insert_sorted_with_data (positions,
                                                          GINT_TO_POINTER (content_index),
                                                          _insert_position,
                                                          NULL);
            else
              fillin++;
            content = mex_model_get_content (priv->model, content_index);
            mex_proxy_remove_content (proxy, content);
          }

        position = positions;
        length = mex_model_get_length (priv->model);
        start_fillin = priv->limit;
        for (i = 0;
             i < MIN (fillin, (length - (gint) priv->limit));
             i++)
          {
            if ((position != NULL) &&
                (start_fillin == GPOINTER_TO_INT (position->data)))
              {
                while ((position != NULL) &&
                       (start_fillin == GPOINTER_TO_INT (position->data)))
                  {
                    start_fillin++;
                    if (start_fillin > GPOINTER_TO_INT (position->data))
                      position = position->next;
                  }
              }
            content = mex_model_get_content (priv->model, start_fillin);
            mex_proxy_add_content (proxy, content);
            start_fillin++;
          }
        g_list_free (positions);
      }
      break;

    case G_CONTROLLER_UPDATE:
      /* Should be no need for this, GBinding sorts it out for us :) */
      break;

    case G_CONTROLLER_CLEAR:
      mex_proxy_clear (proxy);
      break;

    case G_CONTROLLER_REPLACE:
      mex_proxy_clear (proxy);
      i = 0;
      while ((content = mex_model_get_content (priv->model, i++)))
        mex_proxy_add_content (proxy, content);
      break;

    case G_CONTROLLER_INVALID_ACTION:
      g_warning (G_STRLOC ": Proxy controller has issued an error");
      break;

    default:
      g_warning (G_STRLOC ": Unhandled action");
      break;
    }
}
开发者ID:dudochkin-victor,项目名称:mex,代码行数:94,代码来源:mex-proxy.c

示例3: gimp_scanner_parse_color

/**
 * gimp_scanner_parse_color:
 * @scanner:
 * @dest:
 *
 * Return value:
 *
 * Since: GIMP 2.4
 **/
gboolean
gimp_scanner_parse_color (GScanner *scanner,
                          GimpRGB  *dest)
{
  guint      scope_id;
  guint      old_scope_id;
  GTokenType token;
  GimpRGB    color = { 0.0, 0.0, 0.0, 1.0 };

  scope_id = g_quark_from_static_string ("gimp_scanner_parse_color");
  old_scope_id = g_scanner_set_scope (scanner, scope_id);

  if (! g_scanner_scope_lookup_symbol (scanner, scope_id, "color-rgb"))
    {
      g_scanner_scope_add_symbol (scanner, scope_id,
                                  "color-rgb", GINT_TO_POINTER (COLOR_RGB));
      g_scanner_scope_add_symbol (scanner, scope_id,
                                  "color-rgba", GINT_TO_POINTER (COLOR_RGBA));
      g_scanner_scope_add_symbol (scanner, scope_id,
                                  "color-hsv", GINT_TO_POINTER (COLOR_HSV));
      g_scanner_scope_add_symbol (scanner, scope_id,
                                  "color-hsva", GINT_TO_POINTER (COLOR_HSVA));
    }

  token = G_TOKEN_LEFT_PAREN;

  while (g_scanner_peek_next_token (scanner) == token)
    {
      token = g_scanner_get_next_token (scanner);

      switch (token)
        {
        case G_TOKEN_LEFT_PAREN:
          token = G_TOKEN_SYMBOL;
          break;

        case G_TOKEN_SYMBOL:
          {
            gdouble  col[4]     = { 0.0, 0.0, 0.0, 1.0 };
            gint     n_channels = 4;
            gboolean is_hsv     = FALSE;
            gint     i;

            switch (GPOINTER_TO_INT (scanner->value.v_symbol))
              {
              case COLOR_RGB:
                n_channels = 3;
                /* fallthrough */
              case COLOR_RGBA:
                break;

              case COLOR_HSV:
                n_channels = 3;
                /* fallthrough */
              case COLOR_HSVA:
                is_hsv = TRUE;
                break;
              }

            token = G_TOKEN_FLOAT;

            for (i = 0; i < n_channels; i++)
              {
                if (! gimp_scanner_parse_float (scanner, &col[i]))
                  goto finish;
              }

            if (is_hsv)
              {
                GimpHSV hsv;

                gimp_hsva_set (&hsv, col[0], col[1], col[2], col[3]);
                gimp_hsv_clamp (&hsv);

                gimp_hsv_to_rgb (&hsv, &color);
              }
            else
              {
                gimp_rgba_set (&color, col[0], col[1], col[2], col[3]);
                gimp_rgb_clamp (&color);
              }

            token = G_TOKEN_RIGHT_PAREN;
          }
          break;

        case G_TOKEN_RIGHT_PAREN:
          token = G_TOKEN_NONE; /* indicates success */
          goto finish;

        default: /* do nothing */
//.........这里部分代码省略.........
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:101,代码来源:gimpscanner.c

示例4: gsb_reconcile_config_fill

/**
 * fill the reconcile list,
 * sort each reconcile in its account
 *
 * \param
 *
 * \return
 * */
void gsb_reconcile_config_fill ( void )
{
    GtkTreeModel *model;
    GSList *tmp_list;
	GrisbiWinEtat *w_etat;

    if (!reconcile_treeview)
		return;

	w_etat = (GrisbiWinEtat *) grisbi_win_get_w_etat ();
    model = gtk_tree_view_get_model ( GTK_TREE_VIEW (reconcile_treeview));
    gtk_tree_store_clear (GTK_TREE_STORE(model));

    /* we make a tree_model containing the accounts,
     * and for each account, all the reconciles */
    tmp_list = gsb_data_account_get_list_accounts ();
    while (tmp_list)
    {
	gint account_number;
	GtkTreeIter account_iter;
	GList *reconcile_list;

	account_number = gsb_data_account_get_no_account (tmp_list -> data);

	gtk_tree_store_append ( GTK_TREE_STORE (model),
				&account_iter,
				NULL );
	gtk_tree_store_set ( GTK_TREE_STORE (model),
			     &account_iter,
			     RECONCILIATION_NAME_COLUMN, gsb_data_account_get_name (account_number),
			     RECONCILIATION_WEIGHT_COLUMN, 800,
			     RECONCILIATION_ACCOUNT_COLUMN, account_number,
			     -1 );

	/* for each account, get the concerned reconciles */
	reconcile_list = gsb_data_reconcile_get_sort_reconcile_list (account_number);
    if (w_etat->reconcile_sort)
		reconcile_list = g_list_reverse (reconcile_list);

	while (reconcile_list)
	{
	    gint reconcile_number;

	    reconcile_number = GPOINTER_TO_INT (reconcile_list->data);

	    if (gsb_data_reconcile_get_account (reconcile_number) == account_number)
	    {
		GtkTreeIter reconcile_iter;
		gchar *init_date, *final_date;
		gchar *init_balance, *final_balance;

		init_date = gsb_format_gdate (gsb_data_reconcile_get_init_date (reconcile_number));
		final_date = gsb_format_gdate (gsb_data_reconcile_get_final_date (reconcile_number));
		init_balance = utils_real_get_string (gsb_data_reconcile_get_init_balance (reconcile_number));
		final_balance = utils_real_get_string (gsb_data_reconcile_get_final_balance (reconcile_number));

		gtk_tree_store_append ( GTK_TREE_STORE (model),
					&reconcile_iter,
					&account_iter );
		gtk_tree_store_set ( GTK_TREE_STORE (model),
				     &reconcile_iter,
				     RECONCILIATION_NAME_COLUMN, gsb_data_reconcile_get_name (reconcile_number),
				     RECONCILIATION_WEIGHT_COLUMN, 400,
				     RECONCILIATION_INIT_DATE_COLUMN, init_date,
				     RECONCILIATION_FINAL_DATE_COLUMN, final_date,
				     RECONCILIATION_INIT_BALANCE_COLUMN, init_balance,
				     RECONCILIATION_FINAL_BALANCE_COLUMN, final_balance,
				     RECONCILIATION_RECONCILE_COLUMN, reconcile_number,
				     RECONCILIATION_ACCOUNT_COLUMN, account_number,
				     -1 );
		g_free (init_date);
		g_free (final_date);
		g_free (init_balance);
		g_free (final_balance);
	    }
	    reconcile_list = reconcile_list -> next;
	}

	tmp_list = tmp_list -> next;
    }
}
开发者ID:grisbi,项目名称:grisbi,代码行数:89,代码来源:gsb_reconcile_config.c

示例5: wnck_selector_insert_window

static void
wnck_selector_insert_window (WnckSelector *selector, WnckWindow *window)
{
  GtkWidget     *item;
  WnckScreen    *screen;
  WnckWorkspace *workspace;
  int            workspace_n;
  int            i;

  screen = wnck_selector_get_screen (selector);
  workspace = wnck_window_get_workspace (window);

  if (!workspace && !wnck_window_is_pinned (window))
    return;

  item = wnck_selector_create_window (selector, window);

  if (!workspace || workspace == wnck_screen_get_active_workspace (screen))
    {
      /* window is pinned or in the current workspace
       * => insert before the separator */
      GList *l, *children;

      i = 0;

      children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
      for (l = children; l; l = l->next)
        {
          if (GTK_IS_SEPARATOR_MENU_ITEM (l->data))
            break;
          i++;
        }
      g_list_free (children);

      gtk_menu_shell_insert (GTK_MENU_SHELL (selector->priv->menu),
                             item, i);
    }
  else
    {
      workspace_n = wnck_workspace_get_number (workspace);

      if (workspace_n == wnck_screen_get_workspace_count (screen) - 1)
        /* window is in last workspace => just append */
        gtk_menu_shell_append (GTK_MENU_SHELL (selector->priv->menu), item);
      else
        {
          /* insert just before the next workspace item */
          GList *l, *children;

          i = 0;

          children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
          for (l = children; l; l = l->next)
            {
              int j;
              j = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (l->data),
                                                      "wnck-selector-workspace-n"));
              if (j - 1 == workspace_n + 1)
                break;
              i++;
            }
          g_list_free (children);

          gtk_menu_shell_insert (GTK_MENU_SHELL (selector->priv->menu),
                                 item, i);
        }
    }
}
开发者ID:Akenyshka,项目名称:libwnck,代码行数:68,代码来源:selector.c

示例6: plug_in_proc_arg_deserialize

static GTokenType
plug_in_proc_arg_deserialize (GScanner      *scanner,
                              Gimp          *gimp,
                              GimpProcedure *procedure,
                              gboolean       return_value)
{
  GTokenType  token;
  gint        arg_type;
  gchar      *name = NULL;
  gchar      *desc = NULL;
  GParamSpec *pspec;

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
    {
      token = G_TOKEN_LEFT_PAREN;
      goto error;
    }

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL) ||
      GPOINTER_TO_INT (scanner->value.v_symbol) != PROC_ARG)
    {
      token = G_TOKEN_SYMBOL;
      goto error;
    }

  if (! gimp_scanner_parse_int (scanner, (gint *) &arg_type))
    {
      token = G_TOKEN_INT;
      goto error;
    }
  if (! gimp_scanner_parse_string (scanner, &name))
    {
      token = G_TOKEN_STRING;
      goto error;
    }
  if (! gimp_scanner_parse_string (scanner, &desc))
    {
      token = G_TOKEN_STRING;
      goto error;
    }

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
    {
      token = G_TOKEN_RIGHT_PAREN;
      goto error;
    }

  token = G_TOKEN_LEFT_PAREN;

  pspec = gimp_pdb_compat_param_spec (gimp, arg_type, name, desc);

  if (return_value)
    gimp_procedure_add_return_value (procedure, pspec);
  else
    gimp_procedure_add_argument (procedure, pspec);

 error:

  g_free (name);
  g_free (desc);

  return token;
}
开发者ID:Amerekanets,项目名称:gimp-1,代码行数:63,代码来源:plug-in-rc.c

示例7: prov_xdk_knopka

void  prov_xdk_knopka(GtkWidget *widget,class prov_xdk_data *data)
{
iceb_u_str shetd;
iceb_u_str shetk;
iceb_u_str suma;

int knop=GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(widget)));

data->kl_shift=0; //Сбрасываем нажатый сшифт так как при после запуска нового меню он не сбрасывается

switch (knop)
 {

  case GDK_plus: //это почемуто не работает Нажата клавиша плюс на основной клавиатуре
  case GDK_KP_Add: //Нажата клавиша "+" на дополнительной клавиатуре
  case FK2:
    if(prov_xdk_prpvblok(data) != 0)
     return;
    if(iceb_vprov(data->metkasys,"","","","","",rec.nomdk.ravno(),rec.kodop.ravno(),0,
    rec.dd,rec.md,rec.gd,"",data->vrem_v,data->ktoz_v,"",
    data->pods,rec.tipz,0,0,data->window) != 0)
         return;  
    
    prov_xdk_create_list(data);

    return;  

  case SFK2:
    if(data->kolzap == 0)
     return;
    if(prov_xdk_prpvblok(data) != 0)
     return;
    shetd.new_plus(data->shet_v.ravno());
    shetk.new_plus(data->shet_kor_v.ravno());
    suma.new_plus(data->debet_v);
    if(data->debet_v == 0)
     {
      shetd.new_plus(data->shet_kor_v.ravno());
      shetk.new_plus(data->shet_v.ravno());
      suma.new_plus(data->kredit_v);
     }
    
    if(iceb_vprov(data->metkasys,shetd.ravno(),shetk.ravno(),
    suma.ravno(),data->datap_v.ravno(),data->koment_v.ravno(),
    rec.nomdk.ravno(),rec.kodop.ravno(),0,
    rec.dd,rec.md,rec.gd,"",data->vrem_v,data->ktoz_v,"",
    data->pods,rec.tipz,data->val_v,data->kekv,data->window) != 0)
         return;  
    
    prov_xdk_create_list(data);

    return;  

  case FK3:
    if(data->kolzap == 0)
     return;
    if(prov_xdk_prpvblok(data) != 0)
     return;
    shetd.new_plus(gettext("Удалить запись ? Вы уверены ?"));
    if(iceb_menu_danet(&shetd,2,data->window) != 1)
     return;

    iceb_udprov(data->val_v,data->datap_v.ravno(),data->shet_v.ravno_filtr(),
    data->shet_kor_v.ravno_filtr(),data->vrem_v,
    data->debet_v,data->kredit_v,data->koment_v.ravno_filtr(),2,data->window);

    prov_xdk_create_list(data);
    
    return;  

  case SFK3:
    if(data->kolzap == 0)
     return;
    if(prov_xdk_prpvblok(data) != 0)
     return;


    shetd.new_plus(gettext("Удалить все проводки ? Вы уверены ?"));
    if(iceb_menu_danet(&shetd,2,data->window) != 1)
     return;

    if(iceb_udprgr(data->metkasys,rec.dd,rec.md,rec.gd,rec.nomdk.ravno(),0,rec.tipz,data->window) != 0)
     return;

    prov_xdk_create_list(data);
    return;  
    
  
  case FK4:
    if(prov_xdk_prpvblok(data) != 0)
     return;

    avtprpldw(data->tablica,rec.kodop.ravno(),rec.nomdk.ravno(),rec.kodor1.ravno(),data->shet,NULL,data->window);

    prov_xdk_create_list(data);
    return;  
  
  case FK5:
    iceb_raspprov(data->zapros.ravno(),rec.dd,rec.md,rec.gd,rec.nomdk.ravno(),6,data->window);

//.........这里部分代码省略.........
开发者ID:zaharchuktv,项目名称:linuxbuh,代码行数:101,代码来源:l_prov_xdk.c

示例8: mono_process_get_name

/**
 * mono_process_get_name:
 * @pid: pid of the process
 * @buf: byte buffer where to store the name of the prcoess
 * @len: size of the buffer @buf
 *
 * Return the name of the process identified by @pid, storing it
 * inside @buf for a maximum of len bytes (including the terminating 0).
 */
char*
mono_process_get_name (gpointer pid, char *buf, int len)
{
#if USE_SYSCTL
	int res;
#ifdef KERN_PROC2
	int mib [6];
	size_t data_len = sizeof (struct kinfo_proc2);
	struct kinfo_proc2 processi;
#else
	int mib [4];
	size_t data_len = sizeof (struct kinfo_proc);
	struct kinfo_proc processi;
#endif /* KERN_PROC2 */

	memset (buf, 0, len);

#ifdef KERN_PROC2
	mib [0] = CTL_KERN;
	mib [1] = KERN_PROC2;
	mib [2] = KERN_PROC_PID;
	mib [3] = GPOINTER_TO_UINT (pid);
	mib [4] = sizeof(struct kinfo_proc2);
	mib [5] = 400; /* XXX */

	res = sysctl (mib, 6, &processi, &data_len, NULL, 0);

	if (res < 0 || data_len != sizeof (struct kinfo_proc2)) {
		return buf;
	}
#else
	mib [0] = CTL_KERN;
	mib [1] = KERN_PROC;
	mib [2] = KERN_PROC_PID;
	mib [3] = GPOINTER_TO_UINT (pid);
	
	res = sysctl (mib, 4, &processi, &data_len, NULL, 0);
	if (res < 0 || data_len != sizeof (struct kinfo_proc)) {
		return buf;
	}
#endif /* KERN_PROC2 */
	strncpy (buf, processi.kinfo_name_member, len - 1);
	return buf;
#else
	char fname [128];
	FILE *file;
	char *p;
	int r;
	sprintf (fname, "/proc/%d/cmdline", GPOINTER_TO_INT (pid));
	buf [0] = 0;
	file = fopen (fname, "r");
	if (!file)
		return buf;
	r = fread (buf, 1, len - 1, file);
	fclose (file);
	buf [r] = 0;
	p = strrchr (buf, '/');
	if (p)
		return p + 1;
	if (r == 0) {
		return get_pid_status_item_buf (GPOINTER_TO_INT (pid), "Name", buf, len, NULL);
	}
	return buf;
#endif
}
开发者ID:SbGibson,项目名称:mono,代码行数:74,代码来源:mono-proclib.c

示例9: cg_cell_renderer_flags_selected

static void
cg_cell_renderer_flags_selected (CgComboFlags *combo,
                                 GtkTreeIter *iter,
                                 CgComboFlagsSelectionType type,
                                 gpointer user_data)
{
	CgCellRendererFlags *cell_flags;
	CgCellRendererFlagsPrivate *priv;
	gpointer result;
	gchar *name;
	gchar *abbr;

	cell_flags = CG_CELL_RENDERER_FLAGS (user_data);
	priv = CG_CELL_RENDERER_FLAGS_PRIVATE (cell_flags);

	gtk_tree_model_get (priv->model, iter, priv->text_column, &name,
	                    priv->abbr_column, &abbr, -1);
	
	g_assert (priv->edit_status != NULL);
	result = g_hash_table_lookup (priv->edit_status, abbr);

	/* abbr needs not to be freed if it gets inserted into the hash table
	 * because the hash table then takes ownership of it. */
	switch (type)
	{
	case CG_COMBO_FLAGS_SELECTION_NONE:
		g_free (abbr);
		break;
	case CG_COMBO_FLAGS_SELECTION_SELECT:
		if (GPOINTER_TO_INT(result) != 1)
			g_hash_table_insert (priv->edit_status, abbr, GINT_TO_POINTER (1));
		else
			g_free (abbr);

		break;
	case CG_COMBO_FLAGS_SELECTION_UNSELECT:
		if (GPOINTER_TO_INT (result) == 1)
			g_hash_table_remove(priv->edit_status, abbr);

		g_free (abbr);
		break;
	case CG_COMBO_FLAGS_SELECTION_TOGGLE:
		if (GPOINTER_TO_INT (result) == 1)
		{
			g_hash_table_remove (priv->edit_status, abbr);
			g_free(abbr);
		}
		else
		{
			g_hash_table_insert (priv->edit_status, abbr, GINT_TO_POINTER (1));
		}

		break;
	default:
		g_assert_not_reached ();
		break;
	}

	/* This is done to get GTK+ to re-render this row with the changed flag
	 * status that is set via the cell data func, but GTK+ does not call it
	 * again because it does not know that the hash table changed. There are
	 * probably better means to achieve this, but I am not aware of those. */
	gtk_list_store_set (GTK_LIST_STORE (priv->model), iter,
	                    priv->text_column, name, -1);

	g_free (name);
}
开发者ID:GNOME,项目名称:anjuta,代码行数:67,代码来源:cell-renderer-flags.c

示例10: on_menu_item_activate

static void on_menu_item_activate(G_GNUC_UNUSED GtkMenuItem *item,
                                  gpointer user_data)
{
  on_key_binding(GPOINTER_TO_INT(user_data));
}
开发者ID:easonoutlook,项目名称:code-format,代码行数:5,代码来源:plugin.c

示例11: jabber_presence_parse

void jabber_presence_parse(JabberStream *js, xmlnode *packet)
{
	const char *type;
	JabberBuddyResource *jbr = NULL;
	gboolean signal_return, ret;
	JabberPresence presence;
	xmlnode *child;

	memset(&presence, 0, sizeof(presence));
	/* defaults */
	presence.state = JABBER_BUDDY_STATE_UNKNOWN;
	presence.sent = time(NULL);
	/* interesting values */
	presence.from = xmlnode_get_attrib(packet, "from");
	presence.to   = xmlnode_get_attrib(packet, "to");
	type = xmlnode_get_attrib(packet, "type");
	presence.type = str_to_presence_type(type);

	presence.jb = jabber_buddy_find(js, presence.from, TRUE);
	g_return_if_fail(presence.jb != NULL);

	presence.jid_from = jabber_id_new(presence.from);
	if (presence.jid_from == NULL) {
		purple_debug_error("jabber", "Ignoring presence with malformed 'from' "
		                   "JID: %s\n", presence.from);
		return;
	}

	signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc),
			"jabber-receiving-presence", js->gc, type, presence.from, packet));
	if (signal_return) {
		goto out;
	}

	if (presence.jid_from->node)
		presence.chat = jabber_chat_find(js, presence.jid_from->node,
		                                 presence.jid_from->domain);
	if(presence.jb->error_msg) {
		g_free(presence.jb->error_msg);
		presence.jb->error_msg = NULL;
	}

	if (presence.type == JABBER_PRESENCE_AVAILABLE) {
		presence.state = JABBER_BUDDY_STATE_ONLINE;
	} else if (presence.type == JABBER_PRESENCE_ERROR) {
		/* TODO: Is this handled properly?  Should it be treated as per-jbr? */
		char *msg = jabber_parse_error(js, packet, NULL);
		presence.state = JABBER_BUDDY_STATE_ERROR;
		presence.jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence"));
	} else if (presence.type == JABBER_PRESENCE_SUBSCRIBE) {
		/* TODO: Move to handle_subscribe() (so nick is extracted by the
		 * PresenceHandler */
		struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
		gboolean onlist = FALSE;
		PurpleAccount *account;
		PurpleBuddy *buddy;
		xmlnode *nick;

		account = purple_connection_get_account(js->gc);
		buddy = purple_find_buddy(account, presence.from);
		nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick");
		if (nick)
			presence.nickname = xmlnode_get_data(nick);

		if (buddy) {
			if ((presence.jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING)))
				onlist = TRUE;
		}

		jap->gc = js->gc;
		jap->who = g_strdup(presence.from);
		jap->js = js;

		purple_account_request_authorization(account, presence.from, NULL, presence.nickname,
				NULL, onlist, authorize_add_cb, deny_add_cb, jap);

		goto out;
	} else if (presence.type == JABBER_PRESENCE_SUBSCRIBED) {
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:78,代码来源:presence.c

示例12: gimp_session_info_read_geometry

/**
 * gimp_session_info_read_geometry:
 * @info:  A #GimpSessionInfo
 * @cevent A #GdkEventConfigure. If set, use the size from here
 *         instead of from the window allocation.
 *
 * Read geometry related information from the associated widget.
 **/
void
gimp_session_info_read_geometry (GimpSessionInfo   *info,
                                 GdkEventConfigure *cevent)
{
  GdkWindow *window;

  g_return_if_fail (GIMP_IS_SESSION_INFO (info));
  g_return_if_fail (GTK_IS_WINDOW (info->p->widget));

  window = gtk_widget_get_window (info->p->widget);

  if (window)
    {
      gint x, y;

      gdk_window_get_root_origin (window, &x, &y);

      /* Don't write negative values to the sessionrc, they are
       * interpreted as relative to the right, respective bottom edge
       * of the screen.
       */
      info->p->x = MAX (0, x);
      info->p->y = MAX (0, y);

      if (gimp_session_info_get_remember_size (info))
        {
          int width;
          int height;

          if (cevent)
            {
              width  = cevent->width;
              height = cevent->height;
            }
          else
            {
              GtkAllocation allocation;

              gtk_widget_get_allocation (info->p->widget, &allocation);

              width  = allocation.width;
              height = allocation.height;
            }

          info->p->width  = width;
          info->p->height = height;
        }
      else
        {
          info->p->width  = 0;
          info->p->height = 0;
        }
    }

  info->p->open = FALSE;

  if (gimp_session_info_get_remember_if_open (info))
    {
      GimpDialogVisibilityState visibility;

      visibility =
        GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info->p->widget),
                                            GIMP_DIALOG_VISIBILITY_KEY));

      switch (visibility)
        {
        case GIMP_DIALOG_VISIBILITY_UNKNOWN:
          info->p->open = gtk_widget_get_visible (info->p->widget);
          break;

        case GIMP_DIALOG_VISIBILITY_INVISIBLE:
          info->p->open = FALSE;
          break;

        case GIMP_DIALOG_VISIBILITY_HIDDEN:
        case GIMP_DIALOG_VISIBILITY_VISIBLE:
          /* Even if a dialog is hidden (with Windows->Hide docks) it
           * is still considered open. It will be restored the next
           * time GIMP starts
           */
          info->p->open = TRUE;
          break;
        }
    }

  info->p->screen = DEFAULT_SCREEN;

  if (info->p->open)
    {
      GdkDisplay *display = gtk_widget_get_display (info->p->widget);
      GdkScreen  *screen  = gtk_widget_get_screen (info->p->widget);

//.........这里部分代码省略.........
开发者ID:WilfR,项目名称:Gimp-Matting,代码行数:101,代码来源:gimpsessioninfo.c

示例13: dissect_adb

static gint
dissect_adb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    proto_item      *main_item;
    proto_tree      *main_tree;
    proto_item      *arg0_item;
    proto_tree      *arg0_tree;
    proto_item      *arg1_item;
    proto_tree      *arg1_tree;
    proto_item      *magic_item;
    proto_item      *crc_item;
    proto_tree      *crc_tree = NULL;
    proto_item      *sub_item;
    gint             offset = 0;
    guint32          command;
    guint32          arg0;
    guint32          arg1;
    guint32          data_length = 0;
    guint32          crc32 = 0;
    usb_conv_info_t *usb_conv_info = NULL;
    wmem_tree_key_t  key[5];
    guint32          interface_id;
    guint32          bus_id;
    guint32          device_address;
    guint32          side_id;
    guint32          frame_number;
    gboolean         is_command = TRUE;
    gboolean         is_next_fragment = FALSE;
    gboolean         is_service = FALSE;
    gint             proto;
    gint             direction = P2P_DIR_UNKNOWN;
    wmem_tree_t     *wmem_tree;
    command_data_t  *command_data = NULL;
    service_data_t  *service_data = NULL;

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ADB");
    col_clear(pinfo->cinfo, COL_INFO);

    main_item = proto_tree_add_item(tree, proto_adb, tvb, offset, -1, ENC_NA);
    main_tree = proto_item_add_subtree(main_item, ett_adb);

    frame_number       = pinfo->num;

    /* XXX: Why? If interface is USB only first try is correct
     * (and seems strange...), in other cases standard check for
     * previous protocol is correct */
    proto = (gint) GPOINTER_TO_INT(wmem_list_frame_data(/*wmem_list_frame_prev*/(wmem_list_tail(pinfo->layers))));
    if (proto != proto_usb) {
        proto = (gint) GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_frame_prev(wmem_list_tail(pinfo->layers))));
    }

    if (proto == proto_usb) {
        usb_conv_info = (usb_conv_info_t *) data;
        DISSECTOR_ASSERT(usb_conv_info);

        direction = usb_conv_info->direction;
    } else if (proto == proto_tcp) {
        if (pinfo->destport == ADB_TCP_PORT)
            direction = P2P_DIR_SENT;
        else
            direction = P2P_DIR_RECV;
    } else {
        return offset;
    }

    if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID)
        interface_id = pinfo->phdr->interface_id;
    else
        interface_id = 0;

    if (proto == proto_usb) {
        bus_id             = usb_conv_info->bus_id;
        device_address     = usb_conv_info->device_address;

        key[0].length = 1;
        key[0].key = &interface_id;
        key[1].length = 1;
        key[1].key = &bus_id;
        key[2].length = 1;
        key[2].key = &device_address;
        key[3].length = 0;
        key[3].key = NULL;
    } else { /* tcp */
        key[0].length = 1;
        key[0].key = &interface_id;
        key[1].length = 1;
        key[2].length = 1;
        if (direction == P2P_DIR_SENT) {
            key[1].key = &pinfo->srcport;
            key[2].key = &pinfo->destport;
        } else {
            key[1].key = &pinfo->destport;
            key[2].key = &pinfo->srcport;
        }
        key[3].length = 0;
        key[3].key = NULL;
    }

    wmem_tree = (wmem_tree_t *) wmem_tree_lookup32_array(command_info, key);
    if (wmem_tree) {
//.........这里部分代码省略.........
开发者ID:DHODoS,项目名称:wireshark,代码行数:101,代码来源:packet-adb.c

示例14: gtkui_state_quicksave

void gtkui_state_quicksave(GtkWidget *widget, gpointer userdata) {
	// Wrapper function to quicksave states
	nst_state_quicksave(GPOINTER_TO_INT(userdata));
}
开发者ID:cbeach,项目名称:nestopia,代码行数:4,代码来源:gtkui.cpp

示例15: plug_in_icon_deserialize

static GTokenType
plug_in_icon_deserialize (GScanner            *scanner,
                          GimpPlugInProcedure *proc)
{
  GEnumClass   *enum_class;
  GEnumValue   *enum_value;
  GimpIconType  icon_type;
  gint          icon_data_length;
  gchar        *icon_name;
  guint8       *icon_data;

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
    return G_TOKEN_LEFT_PAREN;

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL) ||
      GPOINTER_TO_INT (scanner->value.v_symbol) != ICON)
    return G_TOKEN_SYMBOL;

  enum_class = g_type_class_peek (GIMP_TYPE_ICON_TYPE);

  switch (g_scanner_peek_next_token (scanner))
    {
    case G_TOKEN_IDENTIFIER:
      g_scanner_get_next_token (scanner);

      enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
                                             scanner->value.v_identifier);
      if (!enum_value)
        enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
                                               scanner->value.v_identifier);

      if (!enum_value)
        {
          g_scanner_error (scanner,
                           _("invalid value '%s' for icon type"),
                           scanner->value.v_identifier);
          return G_TOKEN_NONE;
        }
      break;

    case G_TOKEN_INT:
      g_scanner_get_next_token (scanner);

      enum_value = g_enum_get_value (enum_class,
                                     (gint) scanner->value.v_int64);

      if (!enum_value)
        {
          g_scanner_error (scanner,
                           _("invalid value '%ld' for icon type"),
                           (glong) scanner->value.v_int64);
          return G_TOKEN_NONE;
        }
      break;

    default:
      return G_TOKEN_IDENTIFIER;
    }

  icon_type = enum_value->value;

  if (! gimp_scanner_parse_int (scanner, &icon_data_length))
    return G_TOKEN_INT;

  switch (icon_type)
    {
    case GIMP_ICON_TYPE_STOCK_ID:
    case GIMP_ICON_TYPE_IMAGE_FILE:
      icon_data_length = -1;

      if (! gimp_scanner_parse_string_no_validate (scanner, &icon_name))
        return G_TOKEN_STRING;

      icon_data = (guint8 *) icon_name;
      break;

    case GIMP_ICON_TYPE_INLINE_PIXBUF:
      if (icon_data_length < 0)
        return G_TOKEN_STRING;

      if (! gimp_scanner_parse_data (scanner, icon_data_length, &icon_data))
        return G_TOKEN_STRING;
      break;
    }

  proc->icon_type        = icon_type;
  proc->icon_data_length = icon_data_length;
  proc->icon_data        = icon_data;

  if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
    return G_TOKEN_RIGHT_PAREN;

  return G_TOKEN_LEFT_PAREN;
}
开发者ID:Amerekanets,项目名称:gimp-1,代码行数:94,代码来源:plug-in-rc.c


注:本文中的GPOINTER_TO_INT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。