您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GINT_TO_POINTER函数代码示例

51自学网 2021-06-01 20:52:58
  C++
这篇教程C++ GINT_TO_POINTER函数代码示例写得很实用,希望能帮到您。

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

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

示例1: near_snep_core_response_with_info

void near_snep_core_response_with_info(int client_fd, uint8_t response,				uint8_t *data, int length){	struct p2p_snep_data *snep_data;	struct p2p_snep_put_req_data *req;	struct near_ndef_message *ndef;	DBG("Response with info 0x%x (len:%d)", response, length);	req = NULL;	ndef = NULL;	/* get the snep data */	snep_data = g_hash_table_lookup(snep_client_hash,						GINT_TO_POINTER(client_fd));	if (!snep_data) {		DBG("snep_data not found");		goto done;	}	/* Prepare the ndef struct */	ndef = g_try_malloc0(sizeof(struct near_ndef_message));	if (!ndef)		goto done;	ndef->data = g_try_malloc0(length);	if (!ndef->data) {		g_free(ndef);		ndef = NULL;		goto done;	}	/* Fill the ndef */	ndef->length = length;	ndef->offset = 0;	memcpy(ndef->data, data, length);	ndef->offset = 0;	/* Now prepare req struct */	req = g_try_malloc0(sizeof(struct p2p_snep_put_req_data));	if (!req)		goto done;	/* Prepare the callback */	snep_data->req = req;	req->fd = client_fd;	req->adapter_idx = snep_data->adapter_idx;	req->target_idx = snep_data->target_idx;	req->cb = snep_data->cb;	/* send it !*/	near_snep_core_response(client_fd, req, response, ndef);done:	/* If no fragment, free mem */	if (req) {		if (req->fragments == 0) {			g_free(req);			snep_data->req = NULL;		}	}	if (ndef)		g_free(ndef->data);	g_free(ndef);}
开发者ID:justinc1985,项目名称:IntelRangeley,代码行数:68,


示例2: main

gintmain (gint argc, gchar **argv){  GtkWidget *window, *toolbar, *table, *treeview, *scrolled_window;  GtkWidget *hbox, *hbox1, *hbox2, *checkbox, *option_menu, *menu;  gint i;  static const gchar *toolbar_styles[] = { "icons", "text", "both (vertical)",					   "both (horizontal)" };  GtkToolItem *item;  GtkListStore *store;  GtkWidget *image;  GtkWidget *menuitem;  GtkWidget *button;  GtkWidget *label;  GIcon *gicon;  GSList *group;    gtk_init (&argc, &argv);  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);  g_signal_connect (window, "destroy", G_CALLBACK(gtk_main_quit), NULL);  table = gtk_table_new (4, 2, FALSE);  gtk_container_add (GTK_CONTAINER (window), table);  toolbar = gtk_toolbar_new ();  gtk_table_attach (GTK_TABLE (table), toolbar,		    0,2, 0,1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);  hbox1 = gtk_hbox_new (FALSE, 3);  gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);  gtk_table_attach (GTK_TABLE (table), hbox1,		    1,2, 1,2, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);  hbox2 = gtk_hbox_new (FALSE, 2);  gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5);  gtk_table_attach (GTK_TABLE (table), hbox2,		    1,2, 2,3, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);  checkbox = gtk_check_button_new_with_mnemonic("_Vertical");  gtk_box_pack_start (GTK_BOX (hbox1), checkbox, FALSE, FALSE, 0);  g_signal_connect (checkbox, "toggled",		    G_CALLBACK (change_orientation), toolbar);  checkbox = gtk_check_button_new_with_mnemonic("_Show Arrow");  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);  gtk_box_pack_start (GTK_BOX (hbox1), checkbox, FALSE, FALSE, 0);  g_signal_connect (checkbox, "toggled",		    G_CALLBACK (change_show_arrow), toolbar);  checkbox = gtk_check_button_new_with_mnemonic("_Set Toolbar Style:");  g_signal_connect (checkbox, "toggled", G_CALLBACK (set_toolbar_style_toggled), toolbar);  gtk_box_pack_start (GTK_BOX (hbox1), checkbox, FALSE, FALSE, 0);    option_menu = gtk_option_menu_new();  gtk_widget_set_sensitive (option_menu, FALSE);    g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);    menu = gtk_menu_new();  for (i = 0; i < G_N_ELEMENTS (toolbar_styles); i++)    {      GtkWidget *menuitem;      menuitem = gtk_menu_item_new_with_label (toolbar_styles[i]);      gtk_container_add (GTK_CONTAINER (menu), menuitem);      gtk_widget_show (menuitem);    }  gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);  gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu),			       GTK_TOOLBAR (toolbar)->style);  gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);  g_signal_connect (option_menu, "changed",		    G_CALLBACK (change_toolbar_style), toolbar);  checkbox = gtk_check_button_new_with_mnemonic("_Set Icon Size:");   g_signal_connect (checkbox, "toggled", G_CALLBACK (set_icon_size_toggled), toolbar);  gtk_box_pack_start (GTK_BOX (hbox2), checkbox, FALSE, FALSE, 0);  option_menu = gtk_option_menu_new();  g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);  gtk_widget_set_sensitive (option_menu, FALSE);  menu = gtk_menu_new();  menuitem = gtk_menu_item_new_with_label ("small toolbar");  g_object_set_data (G_OBJECT (menuitem), "value-id", GINT_TO_POINTER (GTK_ICON_SIZE_SMALL_TOOLBAR));  gtk_container_add (GTK_CONTAINER (menu), menuitem);  gtk_widget_show (menuitem);  menuitem = gtk_menu_item_new_with_label ("large toolbar");  g_object_set_data (G_OBJECT (menuitem), "value-id", GINT_TO_POINTER (GTK_ICON_SIZE_LARGE_TOOLBAR));  gtk_container_add (GTK_CONTAINER (menu), menuitem);  gtk_widget_show (menuitem);  gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);  gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);  g_signal_connect (option_menu, "changed",		    G_CALLBACK (icon_size_history_changed), toolbar);    scrolled_window = gtk_scrolled_window_new (NULL, NULL);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),//.........这里部分代码省略.........
开发者ID:Aridna,项目名称:gtk2,代码行数:101,


示例3: text_create_widget

GtkWidget *text_create_widget (GtkWidget * dlg){  GtkWidget *w;  w = gtk_scrolled_window_new (NULL, NULL);  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (w), GTK_SHADOW_ETCHED_IN);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (w),				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);  text_view = gtk_text_view_new ();  gtk_widget_set_name (text_view, "yad-text-widget");  text_buffer = gtk_text_buffer_new (NULL);  gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer);  gtk_text_view_set_justification (GTK_TEXT_VIEW (text_view), options.text_data.justify);  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text_view), options.text_data.margins);  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (text_view), options.text_data.margins);  gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), options.common_data.editable);  if (!options.common_data.editable)    gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);  if (options.text_data.wrap)    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD_CHAR);  if (options.text_data.fore)    {#if GTK_CHECK_VERSION(3,0,0)      GdkRGBA clr;      if (gdk_rgba_parse (&clr, options.text_data.fore))	gtk_widget_override_color (text_view, GTK_STATE_FLAG_NORMAL, &clr);#else      GdkColor clr;      if (gdk_color_parse (options.text_data.fore, &clr))	gtk_widget_modify_text (text_view, GTK_STATE_NORMAL, &clr);#endif    }  if (options.text_data.back)    {#if GTK_CHECK_VERSION(3,0,0)      GdkRGBA clr;      if (gdk_rgba_parse (&clr, options.text_data.fore))	gtk_widget_override_background_color (text_view, GTK_STATE_FLAG_NORMAL, &clr);#else      GdkColor clr;      if (gdk_color_parse (options.text_data.back, &clr))	gtk_widget_modify_base (text_view, GTK_STATE_NORMAL, &clr);#endif    }  if (options.common_data.font)    {      PangoFontDescription *fd =	pango_font_description_from_string (options.common_data.font);#if GTK_CHECK_VERSION(3,0,0)      gtk_widget_override_font (text_view, fd);#else      gtk_widget_modify_font (text_view, fd);#endif      pango_font_description_free (fd);    }  /* Add submit on ctrl+enter */  g_signal_connect (text_view, "key-press-event", G_CALLBACK (key_press_cb), dlg);  /* Initialize linkifying */  if (options.text_data.uri)    {      GRegex *regex;      regex = g_regex_new (YAD_URL_REGEX,			   G_REGEX_CASELESS | G_REGEX_OPTIMIZE | G_REGEX_EXTENDED,			   G_REGEX_MATCH_NOTEMPTY,			   NULL);      /* Create text tag for URI */      tag = gtk_text_buffer_create_tag (text_buffer, NULL,                                        "foreground", "blue",                                        "underline", PANGO_UNDERLINE_SINGLE,                                        NULL);      g_object_set_data (G_OBJECT (tag), "is_link", GINT_TO_POINTER (1));      g_signal_connect (G_OBJECT (tag), "event", G_CALLBACK (tag_event_cb), NULL);      /* Create cursors */      hand = gdk_cursor_new (GDK_HAND2);      normal= gdk_cursor_new (GDK_XTERM);      g_signal_connect (G_OBJECT (text_view), "motion-notify-event", G_CALLBACK (motion_cb), NULL);      g_signal_connect_after (G_OBJECT (text_buffer), "changed", G_CALLBACK (linkify_cb), regex);    }  gtk_container_add (GTK_CONTAINER (w), text_view);  if (options.common_data.uri)    fill_buffer_from_file ();  else    fill_buffer_from_stdin ();  return w;}
开发者ID:polarcat,项目名称:yad,代码行数:100,


示例4: test_array_sort

voidtest_array_sort(gpointer data){  const gint32 values[] = {    5, 6, 18, 9, 0, 4, 13, 12, 8, 14, 19, 11, 7, 3, 1, 10, 15, 2, 17, 16  };  const int n_values = sizeof(values) / sizeof(values[0]);  const gchar table_name[] = "Store";  const gchar column_name[] = "sample_column";  const int n_keys = 1;  grn_table_sort_key keys[n_keys];  grn_obj *table, *column, *result;  grn_table_cursor *cursor;  int n_results;  guint i;  guint n_expected_values;  GList *expected_values, *sorted_values = NULL;  table = grn_table_create(context, table_name, strlen(table_name),                           NULL,                           GRN_OBJ_TABLE_NO_KEY | GRN_OBJ_PERSISTENT,                           NULL,                           NULL);  column = grn_column_create(context,                             table,                             column_name,                             strlen(column_name),                             NULL, 0,                             get_object("Int32"));  keys[0].key = column;  keys[0].flags = GRN_TABLE_SORT_ASC;  for(i = 0; i < n_values; ++i) {    grn_obj record_value;    grn_id record_id;    record_id = grn_table_add(context, table, NULL, 0, NULL);    GRN_INT32_INIT(&record_value, 0);    GRN_INT32_SET(context, &record_value, values[i]);    grn_test_assert(grn_obj_set_value(context, column, record_id,                                      &record_value, GRN_OBJ_SET));    GRN_OBJ_FIN(context, &record_value);  }  cut_assert_equal_int(n_values, grn_table_size(context, table));  result = grn_table_create(context, NULL, 0, NULL, GRN_TABLE_NO_KEY,                            NULL, table);  n_results = grn_table_sort(context, table,                             gcut_data_get_int(data, "offset"),                             gcut_data_get_int(data, "limit"),                             result, keys, n_keys);  expected_values = (GList *)gcut_data_get_pointer(data, "expected_values");  n_expected_values = g_list_length(expected_values);  cut_assert_equal_int(n_expected_values, n_results);  cut_assert_equal_int(n_expected_values, grn_table_size(context, result));  cursor = grn_table_cursor_open(context, result, NULL, 0, NULL, 0,                                 0, -1, GRN_CURSOR_ASCENDING);  while (grn_table_cursor_next(context, cursor) != GRN_ID_NIL) {    void *value;    grn_id *id;    grn_obj record_value;    grn_table_cursor_get_value(context, cursor, &value);    id = value;    GRN_INT32_INIT(&record_value, 0);    grn_obj_get_value(context, column, *id, &record_value);    sorted_values = g_list_append(sorted_values,                                  GINT_TO_POINTER(GRN_INT32_VALUE(&record_value)));    GRN_OBJ_FIN(context, &record_value);  }  gcut_take_list(sorted_values, NULL);  gcut_assert_equal_list_int(expected_values, sorted_values);  grn_table_cursor_close(context, cursor);  grn_obj_close(context, result);}
开发者ID:temita,项目名称:groonga,代码行数:81,


示例5: gnc_csv_parse_to_trans

//.........这里部分代码省略.........            {                /* Affect the transaction appropriately. */                TransProperty* property = trans_property_new(column_types->data[j], list);                gboolean succeeded = trans_property_set(property, line->pdata[j]);                /* TODO Maybe move error handling to within TransPropertyList functions? */                if (succeeded)                {                    trans_property_list_add(property);                }                else                {                    errors = TRUE;                    error_message = g_strdup_printf(_("%s column could not be understood."),                                                    _(gnc_csv_column_type_strs[property->type]));                    trans_property_free(property);                    break;                }            }        }        /* If we had success, add the transaction to parse_data->transaction. */        if (!errors)        {            trans_line = trans_property_list_to_trans(list, &error_message);            errors = trans_line == NULL;        }        trans_property_list_free(list);        /* If there were errors, add this line to parse_data->error_lines. */        if (errors)        {            parse_data->error_lines = g_list_append(parse_data->error_lines,                                                    GINT_TO_POINTER(i));            /* If there's already an error message, we need to replace it. */            if (line->len > (int)(parse_data->orig_row_lengths->data[i]))            {                g_free(line->pdata[line->len - 1]);                line->pdata[line->len - 1] = error_message;            }            else            {                /* Put the error message at the end of the line. */                g_ptr_array_add(line, error_message);            }        }        else        {            /* If all went well, add this transaction to the list. */            trans_line->line_no = i;            /* We keep the transactions sorted by date. We start at the end             * of the list and go backward, simply because the file itself             * is probably also sorted by date (but we need to handle the             * exception anyway). */            /* If we can just put it at the end, do so and increment last_transaction. */            if (last_transaction == NULL ||                    xaccTransGetDate(((GncCsvTransLine*)(last_transaction->data))->trans) <= xaccTransGetDate(trans_line->trans))            {                parse_data->transactions = g_list_append(parse_data->transactions, trans_line);                /* If this is the first transaction, we need to get last_transaction on track. */                if (last_transaction == NULL)                    last_transaction = parse_data->transactions;                else /* Otherwise, we can just continue. */                    last_transaction = g_list_next(last_transaction);
开发者ID:cstim,项目名称:gnucash-svn,代码行数:67,


示例6: schedule_video_controls_disapearance

static void schedule_video_controls_disapearance(GtkWidget *w){	gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout"));	if (timeout != 0) g_source_remove(timeout);	timeout=g_timeout_add(3000,(GSourceFunc)do_gtk_widget_destroy,w);	g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));}
开发者ID:42p,项目名称:linphone,代码行数:6,


示例7: mono_process_list

/** * mono_process_list: * @size: a pointer to a location where the size of the returned array is stored * * Return an array of pid values for the processes currently running on the system. * The size of the array is stored in @size. */gpointer*mono_process_list (int *size){#if USE_SYSCTL	int res, i;#ifdef KERN_PROC2	int mib [6];	size_t data_len = sizeof (struct kinfo_proc2) * 400;	struct kinfo_proc2 *processes = malloc (data_len);#else	int mib [4];	size_t data_len = sizeof (struct kinfo_proc) * 400;	struct kinfo_proc *processes = malloc (data_len);#endif /* KERN_PROC2 */	void **buf = NULL;	if (size)		*size = 0;	if (!processes)		return NULL;#ifdef KERN_PROC2	mib [0] = CTL_KERN;	mib [1] = KERN_PROC2;	mib [2] = KERN_PROC_ALL;	mib [3] = 0;	mib [4] = sizeof(struct kinfo_proc2);	mib [5] = 400; /* XXX */	res = sysctl (mib, 6, processes, &data_len, NULL, 0);#else	mib [0] = CTL_KERN;	mib [1] = KERN_PROC;	mib [2] = KERN_PROC_ALL;	mib [3] = 0;		res = sysctl (mib, 4, processes, &data_len, NULL, 0);#endif /* KERN_PROC2 */	if (res < 0) {		free (processes);		return NULL;	}#ifdef KERN_PROC2	res = data_len/sizeof (struct kinfo_proc2);#else	res = data_len/sizeof (struct kinfo_proc);#endif /* KERN_PROC2 */	buf = g_realloc (buf, res * sizeof (void*));	for (i = 0; i < res; ++i)		buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);	free (processes);	if (size)		*size = res;	return buf;#elif defined(__HAIKU__)	/* FIXME: Add back the code from 9185fcc305e43428d0f40f3ee37c8a405d41c9ae */	g_assert_not_reached ();	return NULL;#else	const char *name;	void **buf = NULL;	int count = 0;	int i = 0;	GDir *dir = g_dir_open ("/proc/", 0, NULL);	if (!dir) {		if (size)			*size = 0;		return NULL;	}	while ((name = g_dir_read_name (dir))) {		int pid;		char *nend;		pid = strtol (name, &nend, 10);		if (pid <= 0 || nend == name || *nend)			continue;		if (i >= count) {			if (!count)				count = 16;			else				count *= 2;			buf = g_realloc (buf, count * sizeof (void*));		}		buf [i++] = GINT_TO_POINTER (pid);	}	g_dir_close (dir);	if (size)		*size = i;	return buf;#endif}
开发者ID:Socolin,项目名称:mono,代码行数:98,


示例8: enable_3d_buttons_pf

/*!  /brief Enables all applicable 3D display buttons */G_MODULE_EXPORT void enable_3d_buttons_pf(void){	g_list_foreach(get_list("3d_buttons"),set_widget_sensitive,GINT_TO_POINTER(TRUE));}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:7,


示例9: _set_name

static void_set_name (GESTimelineElement * self, const gchar * wanted_name){  const gchar *type_name;  gchar *lowcase_type;  gint count;  GQuark q;  guint i, l;  gchar *name = NULL;  if (!object_name_counts) {    g_datalist_init (&object_name_counts);  }  q = g_type_qname (G_OBJECT_TYPE (self));  count = GPOINTER_TO_INT (g_datalist_id_get_data (&object_name_counts, q));  /* GstFooSink -> foosink<N> */  type_name = g_quark_to_string (q);  if (strncmp (type_name, "GES", 3) == 0)    type_name += 3;  lowcase_type = g_strdup (type_name);  l = strlen (lowcase_type);  for (i = 0; i < l; i++)    lowcase_type[i] = g_ascii_tolower (lowcase_type[i]);  if (wanted_name == NULL) {    /* give the 20th "uriclip" element and the first "uriclip2" (if needed in the future)     * different names */    l = strlen (type_name);    if (l > 0 && g_ascii_isdigit (type_name[l - 1])) {      name = g_strdup_printf ("%s-%d", lowcase_type, count++);    } else {      name = g_strdup_printf ("%s%d", lowcase_type, count++);    }  } else {    /* If the wanted name uses the same 'namespace' as default, make     * sure it does not badly interfere with our counting system */    if (g_str_has_prefix (wanted_name, lowcase_type)) {      guint64 tmpcount =          g_ascii_strtoull (&wanted_name[strlen (lowcase_type)], NULL, 10);      if (tmpcount > count) {        count = tmpcount + 1;        GST_DEBUG_OBJECT (self, "Using same naming %s but updated count to %i",            wanted_name, count);      } else if (tmpcount < count) {        name = g_strdup_printf ("%s%d", lowcase_type, count);        count++;        GST_DEBUG_OBJECT (self, "Name %s already allocated, giving: %s instead"            " New count is %i", wanted_name, name, count);      } else {        count++;        GST_DEBUG_OBJECT (self, "Perfect name, just bumping object count");      }    }    if (name == NULL)      name = g_strdup (wanted_name);  }  g_free (lowcase_type);  g_datalist_id_set_data (&object_name_counts, q, GINT_TO_POINTER (count));  g_free (self->name);  self->name = name;}
开发者ID:freedesktop-unofficial-mirror,项目名称:gstreamer__gst-editing-services,代码行数:69,


示例10: g_hash_table_lookup

struct near_adapter *__near_adapter_get(uint32_t idx){	return g_hash_table_lookup(adapter_hash, GINT_TO_POINTER(idx));}
开发者ID:aklein53,项目名称:neard,代码行数:4,


示例11: prefs_display_header_create

//.........这里部分代码省略.........    clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL);    gtk_widget_set_size_request (clist_scrolledwin, 200, 210);    gtk_widget_show (clist_scrolledwin);    gtk_box_pack_start (GTK_BOX (clist_hbox1), clist_scrolledwin,                        TRUE, TRUE, 0);    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin),                                    GTK_POLICY_AUTOMATIC,                                    GTK_POLICY_AUTOMATIC);    title[0] = _("Displayed Headers");    headers_clist = gtk_clist_new_with_titles(1, title);    gtk_widget_show (headers_clist);    gtk_container_add (GTK_CONTAINER (clist_scrolledwin), headers_clist);    gtk_clist_set_selection_mode (GTK_CLIST (headers_clist),                                  GTK_SELECTION_BROWSE);    gtk_clist_set_reorderable (GTK_CLIST (headers_clist), TRUE);    gtk_clist_set_use_drag_icons (GTK_CLIST (headers_clist), FALSE);    gtkut_clist_set_redraw (GTK_CLIST (headers_clist));    GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (headers_clist)->column[0].button,                            GTK_CAN_FOCUS);    g_signal_connect_after    (G_OBJECT (headers_clist), "row_move",     G_CALLBACK (prefs_display_header_row_moved), NULL);    btn_vbox = gtk_vbox_new (FALSE, 8);    gtk_widget_show (btn_vbox);    gtk_box_pack_start (GTK_BOX (clist_hbox1), btn_vbox, FALSE, FALSE, 0);    reg_btn = gtk_button_new_with_label (_("Add"));    gtk_widget_show (reg_btn);    gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0);    g_signal_connect (G_OBJECT (reg_btn), "clicked",                      G_CALLBACK (prefs_display_header_register_cb),                      GINT_TO_POINTER(FALSE));    del_btn = gtk_button_new_with_label (_("Delete"));    gtk_widget_show (del_btn);    gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0);    g_signal_connect (G_OBJECT (del_btn), "clicked",                      G_CALLBACK (prefs_display_header_delete_cb),                      headers_clist);    up_btn = gtk_button_new_with_label (_("Up"));    gtk_widget_show (up_btn);    gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0);    g_signal_connect (G_OBJECT (up_btn), "clicked",                      G_CALLBACK (prefs_display_header_up), NULL);    down_btn = gtk_button_new_with_label (_("Down"));    gtk_widget_show (down_btn);    gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0);    g_signal_connect (G_OBJECT (down_btn), "clicked",                      G_CALLBACK (prefs_display_header_down), NULL);    /* hidden headers list */    clist_hbox2 = gtk_hbox_new (FALSE, 8);    gtk_widget_show (clist_hbox2);    gtk_box_pack_start (GTK_BOX (clist_hbox), clist_hbox2, TRUE, TRUE, 0);    clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL);    gtk_widget_set_size_request (clist_scrolledwin, 200, 210);    gtk_widget_show (clist_scrolledwin);    gtk_box_pack_start (GTK_BOX (clist_hbox2), clist_scrolledwin,                        TRUE, TRUE, 0);    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin),                                    GTK_POLICY_AUTOMATIC,
开发者ID:ChakaZulu,项目名称:sylpheed_upstream,代码行数:67,


示例12: meta_create_xrandr_output

MetaOutput *meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,                           XRROutputInfo *xrandr_output,                           RROutput       output_id,                           RROutput       primary_output){  MetaOutputXrandr *output_xrandr;  MetaOutput *output;  GBytes *edid;  unsigned int i;  output = g_object_new (META_TYPE_OUTPUT, NULL);  output->gpu = META_GPU (gpu_xrandr);  output->winsys_id = output_id;  output->name = g_strdup (xrandr_output->name);  output_xrandr = g_slice_new0 (MetaOutputXrandr);  output->driver_private = output_xrandr;  output->driver_notify = (GDestroyNotify)meta_output_xrandr_destroy_notify;  edid = meta_output_xrandr_read_edid (output);  meta_output_parse_edid (output, edid);  g_bytes_unref (edid);  output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;  output->hotplug_mode_update = output_get_hotplug_mode_update (output);  output->suggested_x = output_get_suggested_x (output);  output->suggested_y = output_get_suggested_y (output);  output->connector_type = output_get_connector_type (output);  output->panel_orientation_transform =    output_get_panel_orientation_transform (output);  if (meta_monitor_transform_is_rotated (                                output->panel_orientation_transform))    {      output->width_mm = xrandr_output->mm_height;      output->height_mm = xrandr_output->mm_width;    }  else    {      output->width_mm = xrandr_output->mm_width;      output->height_mm = xrandr_output->mm_height;    }  output_get_tile_info (output);  output_get_modes (output, xrandr_output);  output_get_crtcs (output, xrandr_output);  output->n_possible_clones = xrandr_output->nclone;  output->possible_clones = g_new0 (MetaOutput *,                                    output->n_possible_clones);  /*   * We can build the list of clones now, because we don't have the list of   * outputs yet, so temporarily set the pointers to the bare XIDs, and then   * we'll fix them in a second pass.   */  for (i = 0; i < (unsigned int) xrandr_output->nclone; i++)    {      output->possible_clones[i] = GINT_TO_POINTER (xrandr_output->clones[i]);    }  output->is_primary = ((XID) output->winsys_id == primary_output);  output->is_presentation = output_get_presentation_xrandr (output);  output->supports_underscanning =    output_get_supports_underscanning_xrandr (output, &output_xrandr->underscan_value);  output->is_underscanning = output_get_underscanning_xrandr (output);  output_get_backlight_limits_xrandr (output);  output_get_underscanning_borders_xrandr (output);  /* Override the 'supports underscanning' property for non HDTV sets.   * Note that we need to do this after checking if underscanning is on, so   * that we now the exact values for width and height to be checked. */  if (output->supports_underscanning && !output_is_hdtv (output))    output->supports_underscanning = FALSE;  if (!(output->backlight_min == 0 && output->backlight_max == 0))    output->backlight = output_get_backlight_xrandr (output);  else    output->backlight = -1;  if (output->n_modes == 0 || output->n_possible_crtcs == 0)    {      g_object_unref (output);      return NULL;    }  else    {      return output;    }}
开发者ID:endlessm,项目名称:mutter,代码行数:90,


示例13: SetIntIntoHash

static inline void SetIntIntoHash(int key, int value){    g_hash_table_insert(hash, GINT_TO_POINTER(key), &value);}
开发者ID:Peerapan,项目名称:hash-table-shootout,代码行数:4,


示例14: create_screenshot_frame

static voidcreate_screenshot_frame (GtkWidget   *outer_vbox,                         const gchar *frame_title){  GtkWidget *main_vbox, *vbox, *hbox;  GtkWidget *align;  GtkWidget *radio;  GtkWidget *image;  GtkWidget *spin;  GtkWidget *label;  GtkAdjustment *adjust;  GSList *group;  gchar *title;  main_vbox = gtk_vbox_new (FALSE, 6);  gtk_box_pack_start (GTK_BOX (outer_vbox), main_vbox, FALSE, FALSE, 0);  gtk_widget_show (main_vbox);  title = g_strconcat ("<b>", frame_title, "</b>", NULL);  label = gtk_label_new (title);  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);  gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);  gtk_widget_show (label);  g_free (title);  hbox = gtk_hbox_new (FALSE, 12);  gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);  gtk_widget_show (hbox);  align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);  gtk_widget_set_size_request (align, 48, -1);  gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0);  gtk_widget_show (align);  image = gtk_image_new_from_stock (SCREENSHOOTER_ICON,                                    GTK_ICON_SIZE_DIALOG);  gtk_container_add (GTK_CONTAINER (align), image);  gtk_widget_show (image);  vbox = gtk_vbox_new (FALSE, 6);  gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);  gtk_widget_show (vbox);  /** Grab whole desktop **/  group = NULL;  radio = gtk_radio_button_new_with_mnemonic (group,                                              _("Grab the whole _desktop"));  if (take_window_shot || take_area_shot)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), FALSE);  g_signal_connect (radio, "toggled",                    G_CALLBACK (target_toggled_cb),                    GINT_TO_POINTER (TARGET_TOGGLE_DESKTOP));  gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 0);  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));  gtk_widget_show (radio);  /** Grab current window **/  radio = gtk_radio_button_new_with_mnemonic (group,                                              _("Grab the current _window"));  if (take_window_shot)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);  g_signal_connect (radio, "toggled",                    G_CALLBACK (target_toggled_cb),                    GINT_TO_POINTER (TARGET_TOGGLE_WINDOW));  gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 0);  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));  gtk_widget_show (radio);  /** Grab area of the desktop **/  radio = gtk_radio_button_new_with_mnemonic (group,                                              _("Select _area to grab"));  if (take_area_shot)    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);  g_signal_connect (radio, "toggled",                    G_CALLBACK (target_toggled_cb),                    GINT_TO_POINTER (TARGET_TOGGLE_AREA));  gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 0);  gtk_widget_show (radio);  /** Grab after delay **/  delay_hbox = gtk_hbox_new (FALSE, 6);  gtk_box_pack_start (GTK_BOX (vbox), delay_hbox, FALSE, FALSE, 0);  gtk_widget_show (delay_hbox);  /* translators: this is the first part of the "grab after a   * delay of <spin button> seconds".   */  label = gtk_label_new_with_mnemonic (_("Grab _after a delay of"));  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);  gtk_box_pack_start (GTK_BOX (delay_hbox), label, FALSE, FALSE, 0);  gtk_widget_show (label);  adjust = GTK_ADJUSTMENT (gtk_adjustment_new ((gdouble) delay,                                               0.0, 99.0,                                               1.0,  1.0,                                               0.0));  spin = gtk_spin_button_new (adjust, 1.0, 0);  g_signal_connect (spin, "value-changed",                    G_CALLBACK (delay_spin_value_changed_cb),//.........这里部分代码省略.........
开发者ID:kenvandine,项目名称:gnome-utils,代码行数:101,


示例15: disable_burner_buttons_pf

/*!  /brief Disables all burn to ecu buttons */G_MODULE_EXPORT void disable_burner_buttons_pf(void){	gdk_threads_enter();	g_list_foreach(get_list("burners"),set_widget_sensitive,GINT_TO_POINTER(FALSE));	gdk_threads_leave();}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:9,


示例16: trans_property_list_verify_essentials

/** Tests a TransPropertyList for having enough essential properties. * Essential properties are "Date" and one of the following: "Balance", "Deposit", or * "Withdrawal". * @param list The list we are checking * @param error Contains an error message on failure * @return TRUE if there are enough essentials; FALSE otherwise */static gboolean trans_property_list_verify_essentials(TransPropertyList* list, gchar** error){    int i;    /* possible_errors lists the ways in which a list can fail this test. */    enum PossibleErrorTypes {NO_DATE, NO_AMOUNT, NUM_OF_POSSIBLE_ERRORS};    gchar* possible_errors[NUM_OF_POSSIBLE_ERRORS] =    {        N_("No date column."),        N_("No balance, deposit, or withdrawal column.")    };    int possible_error_lengths[NUM_OF_POSSIBLE_ERRORS] = {0};    GList *properties_begin = list->properties, *errors_list = NULL;    /* Go through each of the properties and erase possible errors. */    while (list->properties)    {        switch (((TransProperty*)(list->properties->data))->type)        {        case GNC_CSV_DATE:            possible_errors[NO_DATE] = NULL;            break;        case GNC_CSV_BALANCE:        case GNC_CSV_DEPOSIT:        case GNC_CSV_WITHDRAWAL:            possible_errors[NO_AMOUNT] = NULL;            break;        }        list->properties = g_list_next(list->properties);    }    list->properties = properties_begin;    /* Accumulate a list of the actual errors. */    for (i = 0; i < NUM_OF_POSSIBLE_ERRORS; i++)    {        if (possible_errors[i] != NULL)        {            errors_list = g_list_append(errors_list, GINT_TO_POINTER(i));            /* Since we added an error, we want to also store its length for             * when we construct the full error string. */            possible_error_lengths[i] = strlen(_(possible_errors[i]));        }    }    /* If there are no errors, we can quit now. */    if (errors_list == NULL)        return TRUE;    else    {        /* full_error_size is the full length of the error message. */        int full_error_size = 0, string_length = 0;        GList* errors_list_begin = errors_list;        gchar *error_message, *error_message_begin;        /* Find the value for full_error_size. */        while (errors_list)        {            /* We add an extra 1 to account for spaces in between messages. */            full_error_size += possible_error_lengths[GPOINTER_TO_INT(errors_list->data)] + 1;            errors_list = g_list_next(errors_list);        }        errors_list = errors_list_begin;        /* Append the error messages one after another. */        error_message = error_message_begin = g_new(gchar, full_error_size);        while (errors_list)        {            i = GPOINTER_TO_INT(errors_list->data);            string_length = possible_error_lengths[i];            /* Copy the error message and put a space after it. */            strncpy(error_message, _(possible_errors[i]), string_length);            error_message += string_length;            *error_message = ' ';            error_message++;            errors_list = g_list_next(errors_list);        }        *error_message = '/0'; /* Replace the last space with the null byte. */        g_list_free(errors_list_begin);        *error = error_message_begin;        return FALSE;    }}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:92,


示例17: enable_get_data_buttons_pf

/*!  /brief Enables the "get data" buttons on all tabs  */G_MODULE_EXPORT void enable_get_data_buttons_pf(void){	gdk_threads_enter();	g_list_foreach(get_list("get_data_buttons"),set_widget_sensitive,GINT_TO_POINTER(TRUE));	gdk_threads_leave();}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:9,


示例18: delete_button_clicked

static voiddelete_button_clicked (GtkButton *button, gpointer user_data){  dt_lib_module_t *self = (dt_lib_module_t *)user_data;  dt_lib_tagging_t *d   = (dt_lib_tagging_t *)self->data;  int res = GTK_RESPONSE_YES;  guint tagid;  GtkTreeIter iter;  GtkTreeModel *model = NULL;  GtkTreeView *view = d->related;  GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));  if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;  gtk_tree_model_get (model, &iter,                      DT_LIB_TAGGING_COL_ID, &tagid,                      -1);  // First check how many images are affected by the remove  int count = dt_tag_remove(tagid,FALSE);  if( count > 0 && dt_conf_get_bool("plugins/lighttable/tagging/ask_before_delete_tag") )  {    GtkWidget *dialog;    GtkWidget *win = dt_ui_main_window(darktable.gui->ui);    gchar *tagname=dt_tag_get_name(tagid);    dialog = gtk_message_dialog_new(GTK_WINDOW(win),                                    GTK_DIALOG_DESTROY_WITH_PARENT,                                    GTK_MESSAGE_QUESTION,                                    GTK_BUTTONS_YES_NO,                                    ngettext("do you really want to delete the tag `%s'?/n%d image is assigned this tag!",                                        "do you really want to delete the tag `%s'?/n%d images are assigned this tag!", count),                                    tagname,count);    gtk_window_set_title(GTK_WINDOW(dialog), _("delete tag?"));    res = gtk_dialog_run(GTK_DIALOG(dialog));    gtk_widget_destroy(dialog);    free(tagname);  }  if(res != GTK_RESPONSE_YES) return;  GList *tagged_images = NULL;  sqlite3_stmt *stmt;  DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from tagged_images where tagid=?1", -1, &stmt, NULL);  DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, tagid);  while(sqlite3_step(stmt) == SQLITE_ROW)  {    tagged_images = g_list_append(tagged_images, GINT_TO_POINTER(sqlite3_column_int(stmt, 0)));  }  sqlite3_finalize(stmt);  dt_tag_remove(tagid,TRUE);  GList *list_iter;  if((list_iter = g_list_first(tagged_images)) != NULL)  {    do    {      dt_image_synch_xmp(GPOINTER_TO_INT(list_iter->data));    }    while((list_iter=g_list_next(list_iter)) != NULL);  }  g_list_free(g_list_first(tagged_images));  update(self, 0);  update(self, 1);  dt_collection_hint_message(darktable.collection);}
开发者ID:MarcAntoine-Arnaud,项目名称:darktable,代码行数:67,


示例19: create_plugin

static voidcreate_plugin(GtkWidget *vbox, gint first_create)	{	GkrellmDecalbutton	*button;	GkrellmStyle	*style;	GkrellmTextstyle *ts, *ts_alt;	GdkPixmap		*pixmap;	GdkBitmap		*mask;	gint			y;	gint			x;	/* See comments about first create in demo2.c	*/	if (first_create)		panel = gkrellm_panel_new0();	style = gkrellm_meter_style(style_id);	/* Each Style has two text styles.  The theme designer has picked the	|  colors and font sizes, presumably based on knowledge of what you draw	|  on your panel.  You just do the drawing.  You can assume that the	|  ts font is larger than the ts_alt font.	*/	ts = gkrellm_meter_textstyle(style_id);	ts_alt = gkrellm_meter_alt_textstyle(style_id);	/* ==== Create a text decal that will be used to scroll text. ====	|  Make it the full panel width (minus the margins).  Position it at top	|  border and left margin of the style.  The "Ay" string is a vertical	|  sizing string for the decal and not an initialization string.	*/	text1_decal = gkrellm_create_decal_text(panel, "Ay", ts, style,				-1,     /* x = -1 places at left margin */				-1,     /* y = -1 places at top margin	*/				-1);    /* w = -1 makes decal the panel width minus margins */	y = text1_decal->y + text1_decal->h + 2;	/* ==== Create a scaled button ====	|  This is the easiest and most versatile way to create a button and is	|  a new function for GKrellM 2.0.0.  Here we use the builtin default	|  button image which is a simple 2 frame in/out image.  If you supply	|  your own image, there can be as many frames as you wish which can be	|  used for state indicating purposes.  Make two buttons, one large and one	|  small to demonstrate scaling capability.  Make the small one auto-hide.	|  See demo4 for a more complicated scaled button which has an irregular	|  shape and a custom in_button callback to detect when the mouse is on	|  a non-transparent part of the button.	*/	button = gkrellm_make_scaled_button(panel,				NULL,               /* GkrellmPiximage image to use to   */				                    /*   create the button images. Use a */				                    /*   builtin default if NULL         */				cb_button,          /* Button clicked callback function  */				GINT_TO_POINTER(0), /* Arg to callback function          */				FALSE,              /* auto_hide: if TRUE, button is visible */				                    /*   only when mouse is in the panel */				FALSE,              /* set_default_border: if TRUE, apply a */				                    /*   default border of 1,1,1,1.  If false*/				                    /*   use the GkrellmPiximage border which*/				                    /*   in this case is 0,0,0,0         */				0,                  /* Image depth if image != NULL      */				0,                  /* Initial out frame if image != NULL */				0,                  /* Pressed frame if image != NULL    */				2,                  /* x position of button  */				y,                  /* y position of button  */				13,                 /* Width for scaling the button  */				15);                /* Height for scaling the button */	x = button->decal->x + button->decal->w + 2;	button = gkrellm_make_scaled_button(panel, NULL, cb_button,				GINT_TO_POINTER(1), TRUE, FALSE, 0, 0, 0,				x, y, 6, 8);	/* ==== Create a text decal and convert it into a decal button. ====	|  Text decals are converted into buttons by being put into a meter or	|  panel button.  This "put" overlays the text decal with special button	|  in and out images that have a transparent interior and a non-transparent	|  border. The "Hello" string is not an initialization string, it is just	|  a vertical sizing string.  After the decal is created, draw the	|  initial text onto the decal.	*/	x = button->decal->x + button->decal->w + 2;	text2_decal = gkrellm_create_decal_text(panel, "Hello", ts_alt, style,				x,				y,      /* Place below the scrolling text1_decal     */				0);     /* w = 0 makes decal the sizing string width */	gkrellm_put_decal_in_meter_button(panel, text2_decal,				cb_button,          /* Button clicked callback function */				GINT_TO_POINTER(2), /* Arg to callback function      */				NULL);              /* Optional margin struct to pad the size */	gkrellm_draw_decal_text(panel, text2_decal, button_text[button_state],				button_state);	/* ==== Create a pixmap decal and convert it into a decal button ====//.........这里部分代码省略.........
开发者ID:cheako,项目名称:gkrellm2-demos,代码行数:101,


示例20: gda_data_model_array_copy_model_ext

/** * gda_data_model_array_copy_model_ext: * @src: a #GdaDataModel to copy data from * @ncols: size of @cols * @cols: (array length=ncols): array of @src's columns to copy into the new array, not %NULL * @error: a place to store errors, or %NULL * * Like gda_data_model_array_copy_model(), makes a copy of @src, but copies only some * columns. * * Returns: (transfer full) (allow-none): a new data model, or %NULL if an error occurred * * Since: 5.2.0 */GdaDataModelArray *gda_data_model_array_copy_model_ext (GdaDataModel *src, gint ncols, gint *cols, GError **error){	GdaDataModel *model;	gint nbfields, i;	g_return_val_if_fail (GDA_IS_DATA_MODEL (src), NULL);	g_return_val_if_fail (cols, NULL);	g_return_val_if_fail (ncols > 0, NULL);	/* check columns' validity */	nbfields = gda_data_model_get_n_columns (src);	for (i = 0; i < ncols; i++) {		if ((cols[i] < 0) || (cols[i] >= nbfields)) {			g_set_error (error, GDA_DATA_MODEL_ERROR,				     GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,                                     _("Column %d out of range (0-%d)"), cols[i], nbfields - 1);			return NULL;		}	}	/* initialize new model */	model = gda_data_model_array_new (ncols);	if (g_object_get_data (G_OBJECT (src), "name"))		g_object_set_data_full (G_OBJECT (model), "name", g_strdup (g_object_get_data (G_OBJECT (src), "name")), g_free);	if (g_object_get_data (G_OBJECT (src), "descr"))		g_object_set_data_full (G_OBJECT (model), "descr", g_strdup (g_object_get_data (G_OBJECT (src), "descr")), g_free);	/* map new columns */	GHashTable *hash;	hash = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, NULL);	for (i = 0; i < ncols; i++) {		gint *ptr;		ptr = g_new (gint, 1);		*ptr = i;		g_hash_table_insert (hash, ptr, GINT_TO_POINTER (cols[i]));		GdaColumn *copycol, *srccol;		gchar *colid;		srccol = gda_data_model_describe_column (src, cols[i]);		copycol = gda_data_model_describe_column (model, i);		g_object_get (G_OBJECT (srccol), "id", &colid, NULL);		g_object_set (G_OBJECT (copycol), "id", colid, NULL);		g_free (colid);		gda_column_set_description (copycol, gda_column_get_description (srccol));		gda_column_set_name (copycol, gda_column_get_name (srccol));		gda_column_set_dbms_type (copycol, gda_column_get_dbms_type (srccol));		gda_column_set_g_type (copycol, gda_column_get_g_type (srccol));		gda_column_set_position (copycol, gda_column_get_position (srccol));		gda_column_set_allow_null (copycol, gda_column_get_allow_null (srccol));	}	if (! gda_data_model_import_from_model (model, src, FALSE, hash, error)) {		g_hash_table_destroy (hash);		g_object_unref (model);		model = NULL;	}	/*else	  gda_data_model_dump (model, stdout);*/	g_hash_table_destroy (hash);	return (GdaDataModelArray*) model;}
开发者ID:UIKit0,项目名称:libgda,代码行数:80,


示例21: parseLine

static gbooleanparseLine (CSVImporter *gci,           EContact *contact,           gchar *buf){	const gchar *pptr = buf, *field_text;	gchar *do_free = NULL;	GString *value;	gint ii = 0, idx;	gint flags = 0;	gint contact_field;	EContactAddress *home_address = NULL, *work_address = NULL, *other_address = NULL;	EContactDate *bday = NULL;	GString *home_street, *work_street, *other_street;	home_street = g_string_new ("");	work_street = g_string_new ("");	other_street = g_string_new ("");	home_address = g_new0 (EContactAddress, 1);	work_address = g_new0 (EContactAddress, 1);	other_address = g_new0 (EContactAddress, 1);	bday = g_new0 (EContactDate, 1);	if (!g_utf8_validate (pptr, -1, NULL)) {		do_free = g_convert (pptr, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);		pptr = do_free;	}	while (value = parseNextValue (&pptr), value != NULL) {		contact_field = NOMAP;		flags = FLAG_INVALID;		field_text = NULL;		idx = ii;		if (gci->fields_map) {			gpointer found;			found = g_hash_table_lookup (				gci->fields_map, GINT_TO_POINTER (idx));			if (found == NULL) {				g_warning ("%s: No map for index %d, skipping it", G_STRFUNC, idx);				idx = -1;			} else {				idx = GPOINTER_TO_INT (found) - 1;			}		}		if (importer == OUTLOOK_IMPORTER) {			if (idx >= 0 && idx < G_N_ELEMENTS (csv_fields_outlook)) {				contact_field = csv_fields_outlook[idx].contact_field;				flags = csv_fields_outlook[idx].flags;				field_text = csv_fields_outlook[idx].csv_attribute;			}		}		else if (importer == MOZILLA_IMPORTER) {			if (idx >= 0 && idx < G_N_ELEMENTS (csv_fields_mozilla)) {				contact_field = csv_fields_mozilla[idx].contact_field;				flags = csv_fields_mozilla[idx].flags;				field_text = csv_fields_mozilla[idx].csv_attribute;			}		}		else {			if (idx >= 0 && idx < G_N_ELEMENTS (csv_fields_evolution)) {				contact_field = csv_fields_evolution[idx].contact_field;				flags = csv_fields_evolution[idx].flags;				field_text = csv_fields_evolution[idx].csv_attribute;			}		}		if (*value->str) {			if (contact_field != NOMAP) {				if (importer == OUTLOOK_IMPORTER || importer == MOZILLA_IMPORTER) {					e_contact_set (contact, contact_field, value->str);				} else {					if (contact_field == E_CONTACT_WANTS_HTML)						e_contact_set (							contact, contact_field,							GINT_TO_POINTER (							g_ascii_strcasecmp (							value->str, "TRUE") == 0));					else						e_contact_set (contact, contact_field, value->str);				}			}			else {				switch (flags) {				case FLAG_HOME_ADDRESS | FLAG_STREET:					if (strlen (home_street->str) != 0) {						home_street = g_string_append (home_street, ",/n");					}					home_street = g_string_append (home_street, value->str);					break;				case FLAG_HOME_ADDRESS | FLAG_CITY:					home_address->locality = g_strdup (value->str);					break;				case FLAG_HOME_ADDRESS | FLAG_STATE:					home_address->region = g_strdup (value->str);					break;				case FLAG_HOME_ADDRESS | FLAG_POSTAL_CODE://.........这里部分代码省略.........
开发者ID:Oliver-Luo,项目名称:evolution,代码行数:101,


示例22: gconf_bridge_bind_window

/** * gconf_bridge_bind_window * @bridge: A #GConfBridge * @key_prefix: The prefix of the GConf keys * @window: A #GtkWindow * @bind_size: TRUE to bind the size of @window * @bind_pos: TRUE to bind the position of @window * * On calling this function @window will be resized to the values * specified by "@key_prefix<!-- -->_width" and "@key_prefix<!-- -->_height" * and maximixed if "@key_prefix<!-- -->_maximized is TRUE if * @bind_size is TRUE, and moved to the values specified by * "@key_prefix<!-- -->_x" and "@key_prefix<!-- -->_y" if @bind_pos is TRUE. * The respective GConf values will be updated when the window is resized * and/or moved. * * Return value: The ID of the new binding. **/guintgconf_bridge_bind_window (GConfBridge *bridge,                          const gchar *key_prefix,                          GtkWindow *window,                          gboolean bind_size,                          gboolean bind_pos){	WindowBinding *binding;	g_return_val_if_fail (bridge != NULL, 0);	g_return_val_if_fail (key_prefix != NULL, 0);	g_return_val_if_fail (GTK_IS_WINDOW (window), 0);        /* Create new binding. */	binding = g_new (WindowBinding, 1);	binding->type = BINDING_WINDOW;	binding->id = new_id ();	binding->bind_size = bind_size;	binding->bind_pos = bind_pos;	binding->key_prefix = g_strdup (key_prefix);	binding->window = window;	binding->sync_timeout_id = 0;        /* Set up GConf keys & sync window to GConf values */	if (bind_size) {		gchar *key;		GConfValue *width_val, *height_val, *maximized_val;                key = g_strconcat (key_prefix, "_width", NULL);		width_val = gconf_client_get (bridge->client, key, NULL);		g_free (key);                key = g_strconcat (key_prefix, "_height", NULL);		height_val = gconf_client_get (bridge->client, key, NULL);		g_free (key);                key = g_strconcat (key_prefix, "_maximized", NULL);		maximized_val = gconf_client_get (bridge->client, key, NULL);		g_free (key);		if (width_val && height_val) {			gtk_window_resize (window,					   gconf_value_get_int (width_val),					   gconf_value_get_int (height_val));			gconf_value_free (width_val);			gconf_value_free (height_val);		} else if (width_val) {			gconf_value_free (width_val);		} else if (height_val) {			gconf_value_free (height_val);		}		if (maximized_val) {			if (gconf_value_get_bool (maximized_val)) {				/* Maximize is not done immediately, but to				 * count with proper window size, resize it				 * before. The previous size is restored				 * after the maximization is changed,				 * in window_binding_state_event_cb(). */				gint width = 0, height = 0;				GdkScreen *screen;				gtk_window_get_size (window, &width, &height);				g_object_set_data (					G_OBJECT (window),					"binding-premax-width",					GINT_TO_POINTER (width));				g_object_set_data (					G_OBJECT (window),					"binding-premax-height",					GINT_TO_POINTER (height));				screen = gtk_window_get_screen (window);				gtk_window_resize (window,					gdk_screen_get_width (screen),					gdk_screen_get_height (screen));				gtk_window_maximize (window);			}			gconf_value_free (maximized_val);//.........这里部分代码省略.........
开发者ID:jdapena,项目名称:evolution,代码行数:101,


示例23: open_ini_file

INIFile * open_ini_file (VFSFile * file){    GHashTable *ini_file = NULL;    GHashTable *section = NULL;    GString *section_name, *key_name, *value;    gpointer section_hash, key_hash;    gsize off = 0;    gint64 filesize = vfs_fsize (file);    if (filesize < 1)        return NULL;    gchar * buffer = g_malloc (filesize);    filesize = vfs_fread (buffer, 1, filesize, file);    section_name = g_string_new("");    key_name = g_string_new(NULL);    value = g_string_new(NULL);    ini_file =        g_hash_table_new_full(NULL, NULL, NULL, close_ini_file_free_section);    section =        g_hash_table_new_full(NULL, NULL, NULL, close_ini_file_free_value);    /* make a nameless section which should store all entries that are not     * embedded in a section */    section_hash = GINT_TO_POINTER(g_string_hash(section_name));    g_hash_table_insert(ini_file, section_hash, section);    while (off < filesize)    {        /* ignore the following characters */        if (buffer[off] == '/r' || buffer[off] == '/n' || buffer[off] == ' '            || buffer[off] == '/t')        {            if (buffer[off] == '/n')            {                g_string_free(key_name, TRUE);                g_string_free(value, TRUE);                key_name = g_string_new(NULL);                value = g_string_new(NULL);            }            off++;            continue;        }        /* if we encounter a possible section statement */        if (buffer[off] == '[')        {            g_string_free(section_name, TRUE);            section_name = g_string_new(NULL);            off++;            if (off >= filesize)                goto return_sequence;            while (buffer[off] != ']')            {                /* if the section statement has not been closed before a                 * linebreak */                if (buffer[off] == '/n')                    break;                g_string_append_c(section_name, buffer[off]);                off++;                if (off >= filesize)                    goto return_sequence;            }            if (buffer[off] == '/n')                continue;            if (buffer[off] == ']')            {                off++;                if (off >= filesize)                    goto return_sequence;                strip_lower_string(section_name);                section_hash = GINT_TO_POINTER(g_string_hash(section_name));                /* if this section already exists, we don't make a new one,                 * but reuse the old one */                if (g_hash_table_lookup(ini_file, section_hash) != NULL)                    section = g_hash_table_lookup(ini_file, section_hash);                else                {                    section =                        g_hash_table_new_full(NULL, NULL, NULL,                                              close_ini_file_free_value);                    g_hash_table_insert(ini_file, section_hash, section);                }                continue;            }        }        if (buffer[off] == '=')        {            off++;            if (off >= filesize)                goto return_sequence;//.........这里部分代码省略.........
开发者ID:ivan-dives,项目名称:audacious-plugins,代码行数:101,


示例24: screen_saver_floater_do_draw

static gbooleanscreen_saver_floater_do_draw (ScreenSaver        *screen_saver,                              ScreenSaverFloater *floater,                              cairo_t            *context){    gint size;    CachedSource *source;    size = CLAMP ((int) (FLOATER_MAX_SIZE * floater->scale),                  FLOATER_MIN_SIZE, FLOATER_MAX_SIZE);    source = g_hash_table_lookup (screen_saver->cached_sources, GINT_TO_POINTER (size));    if (source == NULL)    {        GdkPixbuf *pixbuf;        GError *error;        pixbuf = NULL;        error = NULL;        pixbuf = gdk_pixbuf_new_from_file_at_size (screen_saver->filename, size, -1,                 &error);        if (pixbuf == NULL)        {            g_assert (error != NULL);            g_printerr ("%s", _(error->message));            g_error_free (error);            return FALSE;        }        if (gdk_pixbuf_get_has_alpha (pixbuf))            gamma_correct (pixbuf);        gdk_cairo_set_source_pixbuf (context, pixbuf, 0.0, 0.0);        source = cached_source_new (cairo_get_source (context),                                    gdk_pixbuf_get_width (pixbuf),                                    gdk_pixbuf_get_height (pixbuf));        g_object_unref (pixbuf);        g_hash_table_insert (screen_saver->cached_sources, GINT_TO_POINTER (size),                             source);    }    cairo_save (context);    if (screen_saver->should_do_rotations && (abs (floater->angle) > G_MINDOUBLE))    {        floater->bounds.width = G_SQRT2 * source->width + 2;        floater->bounds.height = G_SQRT2 * source->height + 2;        floater->bounds.x = (int) (floater->position.x - .5 * G_SQRT2 * source->width) - 1;        floater->bounds.y = (int) (floater->position.y - .5 * G_SQRT2 * source->height) - 1;        cairo_translate (context,                         trunc (floater->position.x),                         trunc (floater->position.y));        cairo_rotate (context, floater->angle);        cairo_translate (context,                         -trunc (floater->position.x),                         -trunc (floater->position.y));    }    else    {        floater->bounds.width = source->width + 2;        floater->bounds.height = source->height + 2;        floater->bounds.x = (int) (floater->position.x - .5 * source->width) - 1;        floater->bounds.y = (int) (floater->position.y - .5 * source->height) - 1;    }    cairo_translate (context,                     trunc (floater->position.x - .5 * source->width),                     trunc (floater->position.y - .5 * source->height));    cairo_set_source (context, source->pattern);    cairo_rectangle (context,                     trunc (.5 * (source->width - floater->bounds.width)),                     trunc (.5 * (source->height - floater->bounds.height)),                     floater->bounds.width, floater->bounds.height);    cairo_clip (context);    cairo_paint_with_alpha (context, floater->opacity);    cairo_restore (context);    if (screen_saver->should_show_paths && (floater->path != NULL))    {        gdouble dash_pattern[] = { 5.0 };        gint size;        size = CLAMP ((int) (FLOATER_MAX_SIZE * floater->path_start_scale),                      FLOATER_MIN_SIZE, FLOATER_MAX_SIZE);        cairo_save (context);        cairo_set_source_rgba (context, 1.0, 1.0, 1.0, .2 * floater->opacity);        cairo_move_to (context,                       floater->path->start_point.x,                       floater->path->start_point.y);        cairo_curve_to (context,                        floater->path->start_control_point.x,                        floater->path->start_control_point.y,//.........这里部分代码省略.........
开发者ID:samupl,项目名称:mate-screensaver,代码行数:101,


示例25: gimp_paint_mode_menu_new

GtkWidget *gimp_paint_mode_menu_new (gboolean with_behind_mode,                          gboolean with_replace_modes){  GtkListStore *store;  GtkWidget    *combo;  store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE_EFFECTS,                                           21,                                           GIMP_NORMAL_MODE,                                           GIMP_DISSOLVE_MODE,                                           GIMP_MULTIPLY_MODE,                                           GIMP_DIVIDE_MODE,                                           GIMP_SCREEN_MODE,                                           GIMP_OVERLAY_MODE,                                           GIMP_DODGE_MODE,                                           GIMP_BURN_MODE,                                           GIMP_HARDLIGHT_MODE,                                           GIMP_SOFTLIGHT_MODE,                                           GIMP_GRAIN_EXTRACT_MODE,                                           GIMP_GRAIN_MERGE_MODE,                                           GIMP_DIFFERENCE_MODE,                                           GIMP_ADDITION_MODE,                                           GIMP_SUBTRACT_MODE,                                           GIMP_DARKEN_ONLY_MODE,                                           GIMP_LIGHTEN_ONLY_MODE,                                           GIMP_HUE_MODE,                                           GIMP_SATURATION_MODE,                                           GIMP_COLOR_MODE,                                           GIMP_VALUE_MODE);  gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),                                         GIMP_DISSOLVE_MODE, -1);  gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),                                         GIMP_OVERLAY_MODE, -1);  gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),                                         GIMP_GRAIN_MERGE_MODE, -1);  gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),                                         GIMP_LIGHTEN_ONLY_MODE, -1);  if (with_behind_mode)    {      gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),                                          GIMP_DISSOLVE_MODE,                                          GIMP_BEHIND_MODE);      gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),                                          GIMP_BEHIND_MODE,                                          GIMP_COLOR_ERASE_MODE);    }  if (with_replace_modes)    {      gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),                                          GIMP_NORMAL_MODE,                                          GIMP_REPLACE_MODE);      gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),                                          GIMP_COLOR_ERASE_MODE,                                          GIMP_ERASE_MODE);      gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),                                          GIMP_ERASE_MODE,                                          GIMP_ANTI_ERASE_MODE);    }  combo = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));  g_object_unref (store);  gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),                                        gimp_paint_mode_menu_separator_func,                                        GINT_TO_POINTER (-1),                                        NULL);  return combo;}
开发者ID:jdburton,项目名称:gimp-osx,代码行数:77,


示例26: ao_enclose_words_config

void ao_enclose_words_config (GtkButton *button, GtkWidget *config_window){	GtkWidget *dialog;	GtkWidget *vbox;	GtkTreeIter chars_iter;	GtkCellRenderer *renderer;	GtkTreeViewColumn *label_column, *char_one_column, *char_two_column;	GtkTreeView *chars_tree_view;	gchar insert_chars [2] = {0, 0};	gint i;	dialog = gtk_dialog_new_with_buttons(_("Plugins"), GTK_WINDOW(config_window),						GTK_DIALOG_DESTROY_WITH_PARENT, "Accept", GTK_RESPONSE_ACCEPT,						"Cancel", GTK_RESPONSE_CANCEL, "OK", GTK_RESPONSE_OK, NULL);	vbox = ui_dialog_vbox_new (GTK_DIALOG (dialog));	chars_list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);	renderer = gtk_cell_renderer_text_new ();	chars_tree_view = (GtkTreeView *) gtk_tree_view_new ();	for (i = 0; i < 8; i++)	{		gchar *title = g_strdup_printf (_("Enclose combo %d"), i + 1);		gtk_list_store_append (chars_list, &chars_iter);		gtk_list_store_set (chars_list, &chars_iter, COLUMN_TITLE, title, -1);		insert_chars [0] = *enclose_chars [i];		gtk_list_store_set (chars_list, &chars_iter, COLUMN_PRIOR_CHAR, insert_chars, -1);		insert_chars [0] = *(enclose_chars [i] + 1);		gtk_list_store_set (chars_list, &chars_iter, COLUMN_END_CHAR, insert_chars, -1);		g_free(title);	}	label_column = gtk_tree_view_column_new_with_attributes ("", renderer, "text", 0, NULL);	renderer = gtk_cell_renderer_text_new ();	g_object_set (renderer, "editable", TRUE, NULL);	char_one_column = gtk_tree_view_column_new_with_attributes (_("Opening Character"), renderer,		"text", COLUMN_PRIOR_CHAR, NULL);	g_signal_connect (renderer, "edited", G_CALLBACK (enclose_chars_changed),		GINT_TO_POINTER (COLUMN_PRIOR_CHAR));	renderer = gtk_cell_renderer_text_new ();	g_object_set (renderer, "editable", TRUE, NULL);	char_two_column = gtk_tree_view_column_new_with_attributes (_("Closing Character"), renderer,		"text", COLUMN_END_CHAR, NULL);	g_signal_connect (renderer, "edited", G_CALLBACK (enclose_chars_changed),		GINT_TO_POINTER (COLUMN_END_CHAR));	gtk_tree_view_append_column (chars_tree_view, label_column);	gtk_tree_view_append_column (chars_tree_view, char_one_column);	gtk_tree_view_append_column (chars_tree_view, char_two_column);	gtk_tree_view_set_model (chars_tree_view, GTK_TREE_MODEL (chars_list));	gtk_box_pack_start(GTK_BOX(vbox), (GtkWidget *) chars_tree_view, FALSE, FALSE, 3);	gtk_widget_show_all (vbox);	g_signal_connect (dialog, "response", G_CALLBACK (configure_response), NULL);	while (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);	gtk_widget_destroy (GTK_WIDGET (dialog));}
开发者ID:floverdevel,项目名称:geany-plugins,代码行数:62,


示例27: dialog

static gbooleandialog (void){  /* Missing options: Color-dialogs? / own curl layer ? / transparency     to original drawable / Warp-curl (unsupported yet) */  GtkWidget *dialog;  GtkWidget *hbox;  GtkWidget *vbox;  GtkWidget *table;  GtkWidget *frame;  GtkWidget *button;  GtkWidget *combo;  GtkObject *adjustment;  gboolean   run;  gimp_ui_init (PLUG_IN_BINARY, FALSE);  dialog = gimp_dialog_new (_("Pagecurl Effect"), PLUG_IN_BINARY,                            NULL, 0,			    gimp_standard_help_func, PLUG_IN_PROC,			    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,			    GTK_STOCK_OK,     GTK_RESPONSE_OK,			    NULL);  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),                                           GTK_RESPONSE_OK,                                           GTK_RESPONSE_CANCEL,                                           -1);  gimp_window_set_transient (GTK_WINDOW (dialog));  vbox = gtk_vbox_new (FALSE, 12);  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),                      vbox, TRUE, TRUE, 0);  gtk_widget_show (vbox);  frame = gimp_frame_new (_("Curl Location"));  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);  table = gtk_table_new (3, 2, TRUE);  gtk_table_set_col_spacings (GTK_TABLE (table), 6);  gtk_table_set_row_spacings (GTK_TABLE (table), 6);  gtk_container_add (GTK_CONTAINER (frame), table);  curl_image = gtk_image_new ();  gtk_table_attach (GTK_TABLE (table), curl_image, 0, 2, 1, 2,                    GTK_SHRINK, GTK_SHRINK, 0, 0);  gtk_widget_show (curl_image);  curl_pixbuf_update ();  {    static const gchar *name[] =    {      N_("Lower right"),      N_("Lower left"),      N_("Upper left"),      N_("Upper right")    };    gint i;    button = NULL;    for (i = CURL_EDGE_FIRST; i <= CURL_EDGE_LAST; i++)      {        button =          gtk_radio_button_new_with_label (button == NULL ?                                           NULL :                                           gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),                                           gettext (name[i - CURL_EDGE_FIRST]));        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),                                      curl.edge == i);        g_object_set_data (G_OBJECT (button),                           "gimp-item-data", GINT_TO_POINTER (i));        gtk_table_attach (GTK_TABLE (table), button,                          CURL_EDGE_LEFT  (i) ? 0 : 1,                          CURL_EDGE_LEFT  (i) ? 1 : 2,                          CURL_EDGE_UPPER (i) ? 0 : 2,                          CURL_EDGE_UPPER (i) ? 1 : 3,                          GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);        gtk_widget_show (button);        g_signal_connect (button, "toggled",                          G_CALLBACK (gimp_radio_button_update),                          &curl.edge);        g_signal_connect (button, "toggled",                          G_CALLBACK (curl_pixbuf_update),                           NULL);      }  }  gtk_widget_show (table);//.........这里部分代码省略.........
开发者ID:Minoos,项目名称:gimp,代码行数:101,


示例28: gtk_scrolled_window_new

static GtkWidget *create_timer_list(CtkConfig *ctk_config){    GtkTreeModel *model;    GtkWidget *treeview;    GtkCellRenderer *renderer;    GtkTreeViewColumn *column;    GtkWidget *sw;    GtkWidget *vbox;    GtkWidget *label;    GtkWidget *alignment;        sw = gtk_scrolled_window_new(NULL, NULL);        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);    ctk_config->list_store =        gtk_list_store_new(NUM_COLUMNS,                           G_TYPE_POINTER,  /* TIMER_CONFIG_COLUMN */                           G_TYPE_POINTER,  /* FUNCTION_COLUMN */                           G_TYPE_POINTER,  /* DATA_COLUMN */                           G_TYPE_UINT,     /* HANDLE_COLUMN */                           G_TYPE_BOOLEAN); /* OWNER_ENABLE_COLUMN */        model = GTK_TREE_MODEL(ctk_config->list_store);        treeview = gtk_tree_view_new_with_model(model);        g_object_unref(ctk_config->list_store);    /* Enable */    renderer = gtk_cell_renderer_toggle_new();    g_signal_connect(renderer, "toggled",                     G_CALLBACK(timer_enable_toggled), ctk_config);    column = gtk_tree_view_column_new_with_attributes("Enabled", renderer,                                                      NULL);        gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);    gtk_tree_view_column_set_resizable(column, FALSE);    gtk_tree_view_column_set_cell_data_func(column,                                            renderer,                                            enabled_renderer_func,                                            GINT_TO_POINTER                                            (TIMER_CONFIG_COLUMN),                                            NULL);    /* Description */        renderer = gtk_cell_renderer_text_new();    column = gtk_tree_view_column_new_with_attributes("Description",                                                      renderer,                                                      NULL);        gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);    gtk_tree_view_column_set_resizable(column, TRUE);    gtk_tree_view_column_set_cell_data_func(column,                                            renderer,                                            description_renderer_func,                                            GINT_TO_POINTER                                            (TIMER_CONFIG_COLUMN),                                            NULL);        /* Time interval */    renderer = gtk_cell_renderer_text_new();    column = gtk_tree_view_column_new_with_attributes("Time Interval",                                                      renderer,                                                      NULL);    g_signal_connect(renderer, "edited",                     G_CALLBACK(time_interval_edited), ctk_config);        gtk_tree_view_column_set_cell_data_func(column,                                            renderer,                                            time_interval_renderer_func,                                            GINT_TO_POINTER                                            (TIMER_CONFIG_COLUMN),                                            NULL);        gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);    gtk_tree_view_column_set_resizable(column, FALSE);    gtk_container_add(GTK_CONTAINER(sw), treeview);    vbox = gtk_vbox_new(FALSE, 5);        label = gtk_label_new("Active Timers:");    alignment = gtk_alignment_new(0.0, 0.0, 0, 0);    gtk_container_add(GTK_CONTAINER(alignment), label);    gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);        /* create the tooltip for the treeview (can't do it per column) */        ctk_config_set_tooltip(ctk_config, treeview,                           "The Active Timers describe operations that "//.........这里部分代码省略.........
开发者ID:carbn,项目名称:nvidia-settings,代码行数:101,


示例29: near_snep_core_read

/* * SNEP Core: read function *	This function handles SNEP REQUEST codes: *	GET, PUT and CONTINUE (REJECT is not handled). * *	We read the first 6 bytes (the header) and check *	- the read size ( should be 6 ) *	- the version (on MAJOR) * *	Then, we check snep_data. If it exists, it means that we are in *	a fragment/continue situation (a 1st fragment was sent, and we *	expect a CONTINUE for the remaining bytes). *	If there's no existing snep_data, we create a new one and read the *	missing bytes (llcp removes fragmentation issues) * */bool near_snep_core_read(int client_fd,				uint32_t adapter_idx, uint32_t target_idx,				near_tag_io_cb cb,				near_server_io req_get,				near_server_io req_put,				gpointer data){	struct p2p_snep_data *snep_data;	struct p2p_snep_req_frame frame;	int bytes_recv, ret;	uint32_t ndef_length;	DBG("");	/* Check previous/pending snep_data */	snep_data = g_hash_table_lookup(snep_client_hash,					GINT_TO_POINTER(client_fd));	/*	 * If snep data is already there, and there are more bytes to read	 * we just go ahead and read more fragments from the client.	 */	if (snep_data &&			snep_data->nfc_data_length !=					snep_data->nfc_data_current_length) {		ret = snep_core_read_ndef(client_fd, snep_data);		if (ret)			return ret;		goto process_request;	}	/*	 * We already got something from this client, we should try	 * to continue reading.	 */	/* TODO Try with PEEK */	bytes_recv = recv(client_fd, &frame, sizeof(frame), 0);	if (bytes_recv < 0) {		near_error("Read error SNEP %d %s", bytes_recv,							strerror(errno));		return false;	}	/* Check frame size */	if (bytes_recv != sizeof(frame)) {		near_error("Bad frame size: %d", bytes_recv);		return false;	}	/* If major is different, send UNSUPPORTED VERSION */	if (NEAR_SNEP_MAJOR(frame.version) != NEAR_SNEP_MAJOR(NEAR_SNEP_VERSION)) {		near_error("Unsupported version (%d)", frame.version);		near_snep_core_response_noinfo(client_fd, NEAR_SNEP_RESP_VERSION);		return true;	}	/*	 * This is a fragmentation SNEP operation since we have pending	 * frames. But the ndef length and the current data length are	 * identical. So this is a CONTINUE for a fragmented GET, and	 * we should just process a CONTINUE frame and send the fragments	 * back to the client. This will be done from snep_core_process_request().	 */	if (snep_data) {		snep_data->request = frame.request;		goto process_request;	}	/* This is a new request from the client */	snep_data = g_try_malloc0(sizeof(struct p2p_snep_data));	if (!snep_data)		return false;	/* the whole frame length */	ndef_length = GINT_FROM_BE(frame.length);	snep_data->nfc_data = g_try_malloc0(ndef_length + TLV_SIZE);	if (!snep_data->nfc_data) {		g_free(snep_data);		return false;	}	/* fill the struct *///.........这里部分代码省略.........
开发者ID:justinc1985,项目名称:IntelRangeley,代码行数:101,



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


C++ GITERR_CHECK_ALLOC函数代码示例
C++ GIMP_VIEWABLE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。