本文整理汇总了C++中GINT_TO_POINTER函数的典型用法代码示例。如果您正苦于以下问题:C++ GINT_TO_POINTER函数的具体用法?C++ GINT_TO_POINTER怎么用?C++ GINT_TO_POINTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GINT_TO_POINTER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:snep.c
示例2: main
gint
main (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,代码来源:testtoolbar.c
示例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,代码来源:text.c
示例4: test_array_sort
void
test_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,代码来源:test-table.c
示例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,代码来源:gnc-csv-model.c
示例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,代码来源:videowindow.c
示例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,代码来源:mono-proclib.c
示例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,代码来源:helpers.c
示例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,代码来源:ges-timeline-element.c
示例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,代码来源:adapter.c
示例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,代码来源:prefs_display_header.c
示例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,代码来源:meta-output-xrandr.c
示例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,代码来源:glib_hash_table.c
示例14: create_screenshot_frame
static void
create_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,代码来源:gnome-screenshot.c
示例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,代码来源:helpers.c
示例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,代码来源:gnc-csv-model.c
示例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,代码来源:helpers.c
示例18: delete_button_clicked
static void
delete_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,代码来源:tagging.c
|
请发表评论