ir_node *gcji_allocate_array(ir_type *eltype, ir_node *count) { ir_node *jclass = gcji_get_runtime_classinfo(eltype); ir_node *res; ir_node *new_mem; if (is_Primitive_type(eltype)) { ir_node *addr = new_Address(gcj_new_prim_array_entity); ir_node *args[] = { jclass, count }; ir_type *call_type = get_entity_type(gcj_new_prim_array_entity); ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *ress = new_Proj(call, mode_T, pn_Call_T_result); new_mem = new_Proj(call, mode_M, pn_Call_M); res = new_r_Proj(ress, mode_reference, 0); } else { ir_node *addr = new_Address(gcj_new_object_array_entity); ir_node *null = new_Const(get_mode_null(mode_reference)); ir_node *args[] = { count, jclass, null }; ir_type *call_type = get_entity_type(gcj_new_object_array_entity); ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *ress = new_Proj(call, mode_T, pn_Call_T_result); new_mem = new_Proj(call, mode_M, pn_Call_M); res = new_Proj(ress, mode_reference, 0); } ir_node *assure_vptr = new_VptrIsSet(new_mem, res, type_jarray); ir_node *new_mem2 = new_Proj(assure_vptr, mode_M, pn_VptrIsSet_M); ir_node *res2 = new_Proj(assure_vptr, mode_reference, pn_VptrIsSet_res); set_store(new_mem2); return res2; }
// //the routine for deleting keys in pool // void* NVM_KV_Pool_Del_Manager::start_thread() { pthread_mutex_t *glb_mtx = get_store()->get_pool_mgr()->get_glb_mutex(); NVM_KV_Store* kv_store = get_store(); NVM_KV_Pool_Mgr* pool_mgr = kv_store->get_pool_mgr(); bool delete_all_pools = false; int ret_code = NVM_SUCCESS; set_cancel_state(); //register function that needs to be called on thread cancellation pthread_cleanup_push(&NVM_KV_Scanner::scanner_cancel_routine, get_mutex()); pthread_cleanup_push(&NVM_KV_Scanner::scanner_cancel_routine, glb_mtx); while (true) { //cancellation point pthread_testcancel(); //check if the pool deletion map is empty, if not //return from the wait else start waiting for //external trigger pthread_mutex_lock(get_mutex()); while (!pool_mgr->has_pools_to_delete()) { wait_for_trigger(); } //copy out the pool deletion bitmap to m_pools_to_delete bitmap for //processing. This operation is protected by pool bitmap mutex. pool_mgr->get_pool_deletion_bitmap(m_pools_to_delete, delete_all_pools); pthread_mutex_unlock(get_mutex()); //to yield to pool deletion manager, pool deletion status is set right //away pool_mgr->set_pool_del_status(true); //acquire global lock to synchronize with expiry manager pthread_mutex_lock(glb_mtx); if ((ret_code = start_pool_delete(delete_all_pools)) != NVM_SUCCESS) { fprintf(stderr, "Pool deletion encounter error: %d\n", ret_code); } pool_mgr->set_pool_del_status(false); //trigger expiry thread if (get_store()->expiry_status()) { get_store()->get_expiry_thread()->restart_scanner_if_asleep(); } pthread_mutex_unlock(glb_mtx); } pthread_cleanup_pop(0); pthread_cleanup_pop(0); return NULL; }
void eh_end_method(void) { assert (! top->prev); // the explicit stuff is gone, we have the default handler if (top->used) { mature_immBlock(top->handler_header_block); assert (top->cur_block); // would fail if front end adds an catch all handler to the default handler ir_node *saved_block = get_cur_block(); set_cur_block(top->cur_block); ir_node *cur_mem = get_store(); ir_node *raise = new_Raise(cur_mem, top->exception_object); ir_node *proj = new_Proj(raise, mode_X, pn_Raise_X); cur_mem = new_Proj(raise, mode_M, pn_Raise_M); set_store(cur_mem); ir_node *end_block = get_irg_end_block(get_current_ir_graph()); add_immBlock_pred(end_block, proj); set_cur_block(saved_block); } obstack_free(&lpads, top); top = NULL; }
void eh_add_handler(ir_type *catch_type, ir_node *catch_block) { assert (top->prev); //e.g., not the default handler assert (top->cur_block && "Cannot add handler after an catch all was registered"); ir_node *saved_block = get_cur_block(); set_cur_block(top->cur_block); if (catch_type) { ir_node *cur_mem = get_store(); ir_node *instanceof = new_InstanceOf(cur_mem, top->exception_object, catch_type); cur_mem = new_Proj(instanceof, mode_M, pn_InstanceOf_M); ir_node *result = new_Proj(instanceof, mode_b, pn_InstanceOf_res); ir_node *cond = new_Cond(result); ir_node *proj_match = new_Proj(cond, mode_X, pn_Cond_true); add_immBlock_pred(catch_block, proj_match); // will be matured elsewhere ir_node *proj_go_on = new_Proj(cond, mode_X, pn_Cond_false); ir_node *new_block = new_immBlock(); add_immBlock_pred(new_block, proj_go_on); mature_immBlock(new_block); top->cur_block = new_block; set_store(cur_mem); } else { ir_node *jmp = new_Jmp(); add_immBlock_pred(catch_block, jmp); top->cur_block = NULL; } set_cur_block(saved_block); }
static void ignore_store_new (int cancel, char *mask, gpointer data) { if (cancel) return; /* check if it already exists */ if (ignore_exists (mask)) { fe_message (_("That mask already exists."), FE_MSG_ERROR); return; } GtkTreeView *view = static_cast<GtkTreeView *>(g_object_get_data(G_OBJECT(ignorewin), "view")); GtkListStore *store = GTK_LIST_STORE(get_store()); GtkTreeIter iter; ignore::ignore_type flags = ignore::IG_DEFAULTS; ignore_add (mask, flags, TRUE); gtk_list_store_append (store, &iter); /* ignore everything by default */ gtk_list_store_set (store, &iter, 0, mask, 1, TRUE, 2, TRUE, 3, TRUE, 4, TRUE, 5, TRUE, 6, TRUE, 7, FALSE, -1); /* make sure the new row is visible and selected */ GtkTreePathPtr path (gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter)); gtk_tree_view_scroll_to_cell (view, path.get(), NULL, TRUE, 1.0, 0.0); gtk_tree_view_set_cursor (view, path.get(), NULL, FALSE); }
/** * * Performs the actual refresh operations. * */ static void banlist_do_refresh (struct session *sess) { char tbuf[256]; if (sess->server->connected) { GtkListStore *store; gtk_widget_set_sensitive (sess->res->banlist_butRefresh, FALSE); snprintf (tbuf, sizeof tbuf, "XChat: Ban List (%s, %s)", sess->channel, sess->server->servername); mg_set_title (sess->res->banlist_window, tbuf); store = get_store (sess); gtk_list_store_clear (store); handle_command (sess, "ban", FALSE); #ifdef WIN32 if (0) #else if (supports_exempt (sess->server)) #endif { snprintf (tbuf, sizeof (tbuf), "quote mode %s +e", sess->channel); handle_command (sess, tbuf, FALSE); } } else { fe_message (_("Not connected."), FE_MSG_ERROR); } }
static void mask_edited (GtkCellRendererText *render, gchar *path, gchar *newStr, gpointer dat) { GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkTreeIter iter; char *old; int flags; gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter); gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &old, -1); if (!strcmp (old, newStr)) /* no change */ ; else if (ignore_exists (newStr)) /* duplicate, ignore */ fe_message (_("That mask already exists."), FE_MSG_ERROR); else { /* delete old mask, and add new one with original flags */ ignore_del (old); flags = ignore_get_flags (GTK_TREE_MODEL (store), &iter); ignore_add (newStr, flags, TRUE); /* update tree */ gtk_list_store_set (store, &iter, MASK_COLUMN, newStr, -1); } g_free (old); }
/* fe_add_ban_list() and fe_ban_list_end() return TRUE if consumed, FALSE otherwise */ gboolean fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int rplcode) { banlist_info *banl = sess->res->banlist; int i; GtkListStore *store; GtkTreeIter iter; if (!banl) return FALSE; for (i = 0; i < MODE_CT; i++) if (modes[i].code == rplcode) break; if (i == MODE_CT) { /* printf ("Unexpected value in fe_add_ban_list: %d\n", rplcode); */ return FALSE; } if (banl->pending & 1<<i) { store = get_store (sess); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, TYPE_COLUMN, _(modes[i].type), MASK_COLUMN, mask, FROM_COLUMN, who, DATE_COLUMN, when, -1); banl->line_ct++; return TRUE; } else return FALSE; }
ir_node *eh_new_Call(ir_node * irn_ptr, int arity, ir_node *const * in, ir_type* type) { ir_node *jmp = new_Jmp(); ir_node *call_block = new_immBlock(); add_immBlock_pred(call_block, jmp); mature_immBlock(call_block); set_cur_block(call_block); ir_node *cur_mem = get_store(); ir_node *call = new_Call(cur_mem, irn_ptr, arity, in, type); ir_set_throws_exception(call, 1); ir_node *proj_except = new_Proj(call, mode_X, pn_Call_X_except); cur_mem = new_Proj(call, mode_M, pn_Call_M); set_store(cur_mem); add_immBlock_pred(top->handler_header_block, proj_except); ir_node *proj_regular = new_Proj(call, mode_X, pn_Call_X_regular); ir_node *new_block = new_immBlock(); add_immBlock_pred(new_block, proj_regular); mature_immBlock(new_block); set_cur_block(new_block); top->used = true; return call; }
ir_node *gcji_get_runtime_classinfo(ir_type *type) { ir_node *block = get_cur_block(); ir_node *mem = get_store(); ir_node *res = gcji_get_runtime_classinfo_(block, &mem, type); set_store(mem); return res; }
static void key_dialog_save (GtkWidget *wid, gpointer userdata) { GtkTreeModel *store = get_store (); GtkTreeIter iter; struct key_binding *kb; char *data1, *data2, *accel, *actiontext; guint keyval; GdkModifierType mod; if (keybind_list) { g_slist_free_full (keybind_list, key_free); keybind_list = NULL; } if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { do { kb = g_new0 (struct key_binding, 1); gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, ACCEL_COLUMN, &accel, ACTION_COLUMN, &actiontext, D1_COLUMN, &data1, D2_COLUMN, &data2, -1); kb->data1 = data1; kb->data2 = data2; if (accel) { gtk_accelerator_parse (accel, &keyval, &mod); kb->keyval = keyval; kb->mod = key_modifier_get_valid (mod); g_free (accel); } if (actiontext) { kb->action = key_get_action_from_string (actiontext); g_free (actiontext); } if (!accel || !actiontext) key_free (kb); else keybind_list = g_slist_append (keybind_list, kb); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); } if (key_save_kbs () == 0) key_dialog_close (wid, NULL); }
static void store_exception_object(ir_node *exo_ptr) { ir_node *cur_mem = get_store(); ir_node *ex_symc = new_Address(exception_object_entity); ir_node *ex_store = new_Store(cur_mem, ex_symc, exo_ptr, cons_none); cur_mem = new_Proj(ex_store, mode_M, pn_Store_M); set_store(cur_mem); }
void gcji_checkcast(ir_type *classtype, ir_node *objptr) { ir_node *jclass = gcji_get_runtime_classinfo(classtype); ir_node *addr = new_Address(gcj_checkcast_entity); ir_type *call_type = get_entity_type(gcj_checkcast_entity); ir_node *args[] = { jclass, objptr }; ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *new_mem = new_Proj(call, mode_M, pn_Call_M); set_store(new_mem); }
ir_node *eh_get_exception_object(void) { ir_node *cur_mem = get_store(); ir_node *ex_symc = new_Address(exception_object_entity); ir_node *ex_load = new_Load(cur_mem, ex_symc, mode_P, cons_none); cur_mem = new_Proj(ex_load, mode_M, pn_Load_M); ir_node *ex_obj = new_Proj(ex_load, mode_P, pn_Load_res); set_store(cur_mem); return ex_obj; }
void gcji_class_init(ir_type *type) { assert(is_Class_type(type)); ir_node *addr = new_Address(gcj_init_entity); ir_node *jclass = gcji_get_runtime_classinfo(type); ir_node *args[] = { jclass }; ir_type *call_type = get_entity_type(gcj_init_entity); ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *new_mem = new_Proj(call, mode_M, pn_Call_M); set_store(new_mem); }
static void editlist_edited (GtkCellRendererText *render, gchar *pathstr, gchar *new_text, gpointer data) { GtkTreeModel *model = get_store (); GtkTreePath *path = gtk_tree_path_new_from_string (pathstr); GtkTreeIter iter; gint column = GPOINTER_TO_INT (data); gtk_tree_model_get_iter (model, &iter, path); gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, new_text, -1); gtk_tree_path_free (path); }
static int banlist_unban_inner (gpointer none, banlist_info *banl, int mode_num) { session *sess = banl->sess; GtkTreeModel *model; GtkTreeSelection *sel; GtkTreeIter iter; char tbuf[2048]; char **masks, *mask, *type; int num_sel, i; /* grab the list of selected items */ model = GTK_TREE_MODEL (get_store (sess)); sel = gtk_tree_view_get_selection (get_view (sess)); if (!gtk_tree_model_get_iter_first (model, &iter)) return 0; masks = g_malloc (sizeof (char *) * banl->line_ct); num_sel = 0; do { if (gtk_tree_selection_iter_is_selected (sel, &iter)) { /* Get the mask part of this selected line */ gtk_tree_model_get (model, &iter, TYPE_COLUMN, &type, MASK_COLUMN, &mask, -1); /* If it's the wrong type of mask, just continue */ if (strcmp (_(modes[mode_num].type), type) != 0) continue; /* Otherwise add it to our array of mask pointers */ masks[num_sel++] = g_strdup (mask); g_free (mask); g_free (type); } } while (gtk_tree_model_iter_next (model, &iter)); /* and send to server */ if (num_sel) send_channel_modes (sess, tbuf, masks, 0, num_sel, '-', modes[mode_num].letter, 0); /* now free everything */ for (i=0; i < num_sel; i++) g_free (masks[i]); g_free (masks); return num_sel; }
// //initializes the pool deletion manager // int NVM_KV_Pool_Del_Manager::initialize() { int ret_code = NVM_SUCCESS; NVM_KV_Store *kv_store = get_store(); nvm_kv_store_device_t *kv_device = kv_store->get_store_device(); NVM_KV_Layout *kv_layout = kv_store->get_layout(); uint32_t max_pools = kv_store->get_store_metadata()->max_pools; uint32_t sector_size = kv_store->get_store_device()->capabilities.nvm_sector_size; uint32_t pool_bits = kv_layout->get_pool_bits(); kv_batch_iterator_t *batch_iter = NULL; if ((ret_code = NVM_KV_Scanner::initialize(KV_POOL_DEL_ITER)) != NVM_SUCCESS) { return ret_code; } batch_iter = kv_store->get_iter()->get_iter(get_iter_id(), KV_POOL_DEL_ITER); m_iter = batch_iter->it; m_iter.max_ranges = kv_device->capabilities.nvm_max_num_logical_iter_ranges; m_iter.ranges = (nvm_block_range_t *) (batch_iter + 1); m_iter.reserved = 0; m_iter.filters.filter_mask = (1 << pool_bits) - 1; //disable the expiry m_iter.filters.filter_expiry = 0; m_pools_to_delete = bitmap_alloc_aligned(max_pools, sector_size); if (!m_pools_to_delete) { fprintf(stderr, "Error, pool in progress bitmap allocation failed!\n"); return -NVM_ERR_OUT_OF_MEMORY; } if (max_pools > (1 << pool_bits)) { m_validate_pool_id_on_media = true; } else { m_validate_pool_id_on_media = false; } m_usr_data_start_lba = kv_layout->get_data_start_lba(); m_usr_data_max_lba = kv_layout->get_kv_len() - m_usr_data_start_lba; return ret_code; }
ir_node *gcji_new_multiarray(ir_node *array_class_ref, unsigned dims, ir_node **sizes) { ir_node *addr = new_Address(gcj_new_multiarray_entity); ir_node *dims_arr = alloc_dims_array(dims, sizes); ir_node *cnst = new_Const_long(mode_int, dims); ir_node *args[] = { array_class_ref, cnst, dims_arr }; ir_type *call_type = get_entity_type(gcj_new_multiarray_entity); ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *new_mem = new_Proj(call, mode_M, pn_Call_M); ir_node *ress = new_Proj(call, mode_T, pn_Call_T_result); ir_node *res = new_Proj(ress, mode_reference, 0); set_store(new_mem); return res; }
static void editlist_add (GtkWidget *wid, gpointer userdata) { GtkTreeView *view = g_object_get_data (G_OBJECT (editlist_win), "view"); GtkTreeViewColumn *col; GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkTreeIter iter; GtkTreePath *path; gtk_list_store_append (store, &iter); /* make sure the new row is visible and selected */ path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); col = gtk_tree_view_get_column (view, NAME_COLUMN); gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0.0, 0.0); gtk_tree_view_set_cursor (view, path, col, TRUE); gtk_tree_path_free (path); }
ir_node *gcji_new_string(ir_entity *bytes) { ir_node *addr = new_Address(gcj_new_string_entity); ir_node *string_symc = new_Address(bytes); ir_node *args[] = { string_symc }; ir_node *mem = get_store(); ir_type *call_type = get_entity_type(gcj_new_string_entity); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *new_mem = new_Proj(call, mode_M, pn_Call_M); ir_node *ress = new_Proj(call, mode_T, pn_Call_T_result); ir_node *res = new_Proj(ress, mode_reference, 0); set_store(new_mem); // TODO: get type for java.lang.String from somewhere and use VptrIsSet // on the result return res; }
void fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int is_exempt) { GtkListStore *store; GtkTreeIter iter; char buf[512]; store = get_store (sess); gtk_list_store_append (store, &iter); if (is_exempt) { snprintf (buf, sizeof (buf), "(EX) %s", mask); gtk_list_store_set (store, &iter, 0, buf, 1, who, 2, when, -1); } else { gtk_list_store_set (store, &iter, 0, mask, 1, who, 2, when, -1); } }
// //go through m_pools_to_delete bitmap to delete each pool // int NVM_KV_Pool_Del_Manager::start_pool_delete(bool delete_all_pools) { NVM_KV_Store *kv_store = get_store(); uint32_t max_pools = kv_store->get_store_metadata()->max_pools; int ret_code = NVM_SUCCESS; if (delete_all_pools) { if ((ret_code = delete_pool(-1, m_validate_pool_id_on_media)) != NVM_SUCCESS) { return ret_code; } if ((ret_code = kv_store->get_pool_mgr()->clear_pool_bitmaps(m_pools_to_delete)) != NVM_SUCCESS) { return ret_code; } } else { for (uint32_t i = 1; i < max_pools; i++) { if (bitmap_test(m_pools_to_delete, i)) { if ((ret_code = delete_pool(i, m_validate_pool_id_on_media)) != NVM_SUCCESS) { return ret_code; } if ((ret_code = kv_store->get_pool_mgr()->clear_pool_bitmaps(i)) != NVM_SUCCESS) { return ret_code; } } } } return ret_code; }
static ir_node *alloc_dims_array(unsigned dims, ir_node **sizes) { ir_mode *dim_mode = mode_ushort; unsigned bytes = dims * (get_mode_size_bits(dim_mode) / 8); ir_node *dims_const = new_Const_long(dim_mode, bytes); ir_node *mem = get_store(); ir_node *alloc = new_Alloc(mem, dims_const, 1); ir_node *arr = new_Proj(alloc, mode_reference, pn_Alloc_res); ir_node *new_mem = new_Proj(alloc, mode_M, pn_Alloc_M); for (unsigned d = 0; d < dims; d++) { ir_node *index_const = new_Const_long(mode_int, d); ir_node *sel = new_Sel(arr, index_const, type_array_int); ir_node *store = new_Store(new_mem, sel, sizes[d], type_array_int, cons_none); new_mem = new_Proj(store, mode_M, pn_Store_M); } set_store(new_mem); return arr; }
ir_node *gcji_allocate_object(ir_type *type) { assert(is_Class_type(type)); ir_node *addr = new_Address(gcj_alloc_entity); ir_node *jclass = gcji_get_runtime_classinfo(type); ir_node *args[] = { jclass }; ir_type *call_type = get_entity_type(gcj_alloc_entity); ir_node *mem = get_store(); ir_node *call = new_Call(mem, addr, ARRAY_SIZE(args), args, call_type); ir_node *new_mem = new_Proj(call, mode_M, pn_Call_M); ir_node *ress = new_Proj(call, mode_T, pn_Call_T_result); ir_node *res = new_Proj(ress, mode_reference, 0); ir_node *assure_vptr = new_VptrIsSet(new_mem, res, type); ir_node *new_mem2 = new_Proj(assure_vptr, mode_M, pn_VptrIsSet_M); ir_node *res2 = new_Proj(assure_vptr, mode_reference, pn_VptrIsSet_res); set_store(new_mem2); return res2; }
/** * * Performs the actual refresh operations. * */ static void banlist_do_refresh (banlist_info *banl) { session *sess = banl->sess; char tbuf[256]; int i; char *tbufp; banlist_sensitize (banl); if (sess->server->connected) { GtkListStore *store; g_snprintf (tbuf, sizeof tbuf, DISPLAY_NAME": Ban List (%s, %s)", sess->channel, sess->server->servername); mg_set_title (banl->window, tbuf); store = get_store (sess); gtk_list_store_clear (store); banl->line_ct = 0; banl->pending = banl->checked; if (banl->pending) { tbufp = tbuf + g_snprintf (tbuf, sizeof tbuf, "quote mode %s +", sess->channel); for (i = 0; i < MODE_CT; i++) if (banl->pending & 1<<i) { *tbufp++ = modes[i].letter; } *tbufp = 0; handle_command (sess, tbuf, FALSE); } } else { fe_message (_("Not connected."), FE_MSG_ERROR); } }
static void option_toggled (GtkCellRendererToggle *render, gchar *path, gpointer data) { GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkTreeIter iter; int col_id = GPOINTER_TO_INT (data); gboolean active; char *mask; int flags; gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter); /* update model */ gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, col_id, &active, -1); gtk_list_store_set (store, &iter, col_id, !active, -1); /* update ignore list */ gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &mask, -1); flags = ignore_get_flags (GTK_TREE_MODEL (store), &iter); if (ignore_add (mask, flags, TRUE) != 2) g_warning ("ignore treeview is out of sync!\n"); g_free (mask); }
static void ignore_clear_cb (GtkDialog *dialog, gint response) { GtkListStore *store = GTK_LIST_STORE (get_store ()); GtkTreeIter iter; gtk_widget_destroy (GTK_WIDGET (dialog)); if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter) && response == GTK_RESPONSE_OK) { /* remove from ignore_list */ do { char* mask = nullptr; gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, MASK_COLUMN, &mask, -1); glib_string mask_ptr(mask); ignore_del (mask); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); /* remove from GUI */ gtk_list_store_clear (store); } }
static void key_dialog_combo_changed (GtkCellRendererCombo *combo, gchar *pathstr, GtkTreeIter *new_iter, gpointer data) { GtkTreeModel *model; GtkXText *xtext; gchar *actiontext = NULL; gint action; xtext = GTK_XTEXT (g_object_get_data (G_OBJECT (key_dialog), "xtext")); model = GTK_TREE_MODEL (data); gtk_tree_model_get (model, new_iter, 0, &actiontext, -1); if (actiontext) { #ifdef WIN32 /* We need to manually update the store */ GtkTreePath *path; GtkTreeIter iter; path = gtk_tree_path_new_from_string (pathstr); model = get_store (); gtk_tree_model_get_iter (model, &iter, path); gtk_list_store_set (GTK_LIST_STORE (model), &iter, ACTION_COLUMN, actiontext, -1); gtk_tree_path_free (path); #endif action = key_get_action_from_string (actiontext); key_dialog_print_text (xtext, key_actions[action].help); g_free (actiontext); } }
static void key_dialog_set_key (GtkCellRendererAccel *accel, gchar *pathstr, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, gpointer userdata) { GtkTreeModel *model = get_store (); GtkTreePath *path = gtk_tree_path_new_from_string (pathstr); GtkTreeIter iter; gchar *label_name, *accel_name; /* Shift tab requires an exception, hopefully that list ends here.. */ if (accel_key == GDK_KEY_Tab && accel_mods & GDK_SHIFT_MASK) accel_key = GDK_KEY_ISO_Left_Tab; label_name = gtk_accelerator_get_label (accel_key, key_modifier_get_valid (accel_mods)); accel_name = gtk_accelerator_name (accel_key, key_modifier_get_valid (accel_mods)); gtk_tree_model_get_iter (model, &iter, path); gtk_list_store_set (GTK_LIST_STORE (model), &iter, KEY_COLUMN, label_name, ACCEL_COLUMN, accel_name, -1); gtk_tree_path_free (path); g_free (label_name); g_free (accel_name); }