void select_line_inside_window(void) { if (g_list_position(lines, selected_line) < g_list_position(lines, first_line)) select_line(first_line); else if (g_list_position(lines, selected_line) > g_list_position(lines, last_line)) select_line(last_line); }
/** * Check all referenced targets are present in OI_TARGET. * * @param pOi pointer to oi_fits struct to check * @param pResult pointer to oi_check_result struct to store result in * * @return oi_breach level indicating overall test result */ oi_breach_level check_targets_present(oi_fits *pOi, oi_check_result *pResult) { GList *link; int i; oi_vis *pVis; oi_vis2 *pVis2; oi_t3 *pT3; const char desc[] = "Reference to missing target record"; char location[FLEN_VALUE]; init_check_result(pResult); /* Check OI_VIS tables */ link = pOi->visList; while(link != NULL) { pVis = link->data; for(i=0; i<pVis->numrec; i++) { if(oi_fits_lookup_target(pOi, pVis->record[i].target_id) == NULL) { g_snprintf(location, FLEN_VALUE, "OI_VIS #%d record %d", g_list_position(pOi->visList, link)+1, i+1); set_result(pResult, OI_BREACH_NOT_OIFITS, desc, location); } } link = link->next; } /* Check OI_VIS2 tables */ link = pOi->vis2List; while(link != NULL) { pVis2 = link->data; for(i=0; i<pVis2->numrec; i++) { if(oi_fits_lookup_target(pOi, pVis2->record[i].target_id) == NULL) { g_snprintf(location, FLEN_VALUE, "OI_VIS2 #%d record %d", g_list_position(pOi->vis2List, link)+1, i+1); set_result(pResult, OI_BREACH_NOT_OIFITS, desc, location); } } link = link->next; } /* Check OI_T3 tables */ link = pOi->t3List; while(link != NULL) { pT3 = link->data; for(i=0; i<pT3->numrec; i++) { if(oi_fits_lookup_target(pOi, pT3->record[i].target_id) == NULL) { g_snprintf(location, FLEN_VALUE, "OI_T3 #%d record %d", g_list_position(pOi->t3List, link)+1, i+1); set_result(pResult, OI_BREACH_NOT_OIFITS, desc, location); } } link = link->next; } return pResult->level; }
gboolean insert_in_tree(GNode *directory, File *file) { GNode *new_file, *file_ptr, *dir_ptr; int position; if (file->name[0] == '.' && FILE(directory)->show_dotfiles == FALSE) { insert_sorted_in_dotfiles(directory, file); return FALSE; } new_file = insert_sorted_in_tree(directory, file); for (dir_ptr = directory; !G_NODE_IS_ROOT(dir_ptr); dir_ptr = dir_ptr->parent) { if (FILE(dir_ptr)->open == FALSE) return FALSE; } if (FILE(dir_ptr)->open == FALSE) return FALSE; file_ptr = get_previous_file(new_file); position = g_list_position(lines, FILE(file_ptr)->line); lines = g_list_insert(lines, new_file, position + 1); file->line = g_list_nth(lines, position + 1); if (g_list_length(first_line) - g_list_length(last_line) + 1) { if (g_list_previous(first_line) == file->line) first_line = file->line; else if (g_list_next(last_line) == file->line) last_line = file->line; } if (g_list_position(lines, first_line) <= position + 1 && position + 1 <= g_list_position(lines, last_line)) { if (position + 1 < g_list_position(lines, selected_line)) { if (g_list_length(first_line) <= getmaxy(tree_window)) print_lines(first_line, last_line, FALSE); else { first_line = g_list_next(first_line); print_lines(first_line, file->line, FALSE); } } else { if (g_list_length(first_line) > getmaxy(tree_window)) last_line = g_list_previous(last_line); if (g_node_last_sibling(new_file) == new_file) print_lines(g_list_previous(file->line), last_line, FALSE); else print_lines(file->line, last_line, FALSE); } return TRUE; } return FALSE; }
static GtkTreePath *fm_dir_tree_model_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter) { GList *item_list; GList *children; FmDirTreeItem *dir_tree_item; GtkTreePath *path; int i; FmDirTreeModel *dir_tree_model = FM_DIR_TREE_MODEL (tree_model); g_return_val_if_fail (dir_tree_model, NULL); g_return_val_if_fail (iter->stamp == dir_tree_model->stamp, NULL); g_return_val_if_fail (iter != NULL, NULL); g_return_val_if_fail (iter->user_data != NULL, NULL); item_list = (GList*)iter->user_data; dir_tree_item = (FmDirTreeItem*)item_list->data; // Root Item... if (dir_tree_item->parent == NULL) { i = g_list_position (dir_tree_model->root_list, item_list); path = gtk_tree_path_new_first (); gtk_tree_path_get_indices (path)[0] = i; } else { path = gtk_tree_path_new (); do { FmDirTreeItem *parent_item = (FmDirTreeItem*)dir_tree_item->parent->data; children = parent_item->children; i = g_list_position (children, item_list); if (G_UNLIKELY (i == -1)) { gtk_tree_path_free (path); return NULL; } gtk_tree_path_prepend_index (path, i); // Go One Level Up... item_list = dir_tree_item->parent; dir_tree_item = (FmDirTreeItem*)item_list->data; } while (G_UNLIKELY (dir_tree_item->parent)); // We Have Reached Toplevel... children = dir_tree_model->root_list; i = g_list_position (children, item_list); gtk_tree_path_prepend_index (path, i); } return path; }
/** * Check for unnormalised (i.e. significantly > 1) T3AMP values. * * @param pOi pointer to oi_fits struct to check * @param pResult pointer to oi_check_result struct to store result in * * @return oi_breach level indicating overall test result */ oi_breach_level check_t3amp(oi_fits *pOi, oi_check_result *pResult) { GList *link; int i, j; oi_t3 *pT3; oi_t3_record t3Rec; const char desc[] = "OI_T3 table may contain unnormalised triple product amplitude"; char location[FLEN_VALUE]; init_check_result(pResult); link = pOi->t3List; while(link != NULL) { pT3 = link->data; for(i=0; i<pT3->numrec; i++) { t3Rec = pT3->record[i]; if(t3Rec.flag) continue; for(j=0; j<pT3->nwave; j++) { /* use one sigma in case error bars are overestimated */ if((t3Rec.t3amp[j] - 1.0) > 1*t3Rec.t3amperr[j]) { g_snprintf(location, FLEN_VALUE, "OI_T3 #%d record %d channel %d", g_list_position(pOi->t3List, link)+1, i+1, j+1); set_result(pResult, OI_BREACH_NOT_OIFITS, desc, location); } } } link = link->next; } return pResult->level; }
static gboolean anjuta_tabber_button_press_event (GtkWidget* widget, GdkEventButton* event) { AnjutaTabber* tabber = ANJUTA_TABBER (widget); GList* child; if (event->button == 1) { gint x, y; if (!anjuta_tabber_get_widget_coordinates (widget, (GdkEvent*) event, &x, &y)) return FALSE; for (child = tabber->priv->children; child != NULL; child = g_list_next (child)) { GtkAllocation alloc; gtk_widget_get_allocation (GTK_WIDGET (child->data), &alloc); if (alloc.x <= x && (alloc.x + alloc.width) >= x && alloc.y <= y && (alloc.y + alloc.height) >= y) { gint page = g_list_position (tabber->priv->children, child); gtk_notebook_set_current_page (tabber->priv->notebook, page); return TRUE; } } } return FALSE; }
static MateConfValue* combo_conv_to_widget (MateConfPropertyEditor *peditor, const MateConfValue *value) { MateConfValue *ret; GList *entry, *handlers; const gchar *command; gint index; g_object_get (G_OBJECT (peditor), "data", &handlers, NULL); command = mateconf_value_get_string (value); if (handlers) { entry = g_list_find_custom (handlers, command, (GCompareFunc) generic_item_comp); if (entry) index = g_list_position (handlers, entry); else index = g_list_length (handlers) + 1; } else { /* if the item has no handlers lsit then select the Custom item */ index = 1; } ret = mateconf_value_new (MATECONF_VALUE_INT); mateconf_value_set_int (ret, index); return ret; }
/** * xfae_model_remove: * @model : a #XfaeModel. * @iter : the #GtkTreeIter referring to the item that should be removed. * @error : return location for errors or %NULL. * * Tries to remove the item referred to by @iter from @model. * * Return value: %TRUE if the removal was successful. **/ gboolean xfae_model_remove (XfaeModel *model, GtkTreeIter *iter, GError **error) { GtkTreePath *path; XfaeItem *item; GList *lp; gint index_; g_return_val_if_fail (XFAE_IS_MODEL (model), FALSE); g_return_val_if_fail (iter->stamp == model->stamp, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); lp = iter->user_data; item = lp->data; /* try to unlink the item from disk */ if (!xfae_item_remove (item, error)) return FALSE; /* unlink the item from the list */ index_ = g_list_position (model->items, lp); model->items = g_list_delete_link (model->items, lp); xfae_item_free (item); /* tell the view that we have just removed one item */ path = gtk_tree_path_new_from_indices (index_, -1); gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path); gtk_tree_path_free (path); return TRUE; }
gboolean view_window_find_image(ImageWindow *imd, gint *index, gint *total) { GList *work; work = view_window_list; while (work) { ViewWindow *vw = work->data; work = work->next; if (vw->imd == imd || (vw->fs && vw->fs->imd == imd)) { if (vw->ss) { gint n; gint t; n = g_list_length(vw->ss->list_done); t = n + g_list_length(vw->ss->list); if (n == 0) n = t; if (index) *index = n - 1; if (total) *total = t; } else { if (index) *index = g_list_position(vw->list, vw->list_pointer); if (total) *total = g_list_length(vw->list); } return TRUE; } } return FALSE; }
static void phase_cmd_insert_undo (PlannerCmd *cmd_base) { PhaseCmdInsert *cmd; GList *list, *l; gboolean found = FALSE; cmd = (PhaseCmdInsert*) cmd_base; g_object_get (cmd->project, "phases", &list, NULL); for (l = list; l; l = l->next) { if (!strcmp (cmd->phase, l->data)) { g_free (l->data); cmd->position = g_list_position (list, l); list = g_list_remove_link (list, l); found = TRUE; break; } } if (found) { g_object_set (cmd->project, "phases", list, NULL); } mrp_string_list_free (list); }
/* * Convert a model/owner pair into a gtk_tree_model_iter. This * routine should only be called from the file * gnc-tree-view-owner.c. */ gboolean gnc_tree_model_owner_get_iter_from_owner (GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter) { GncTreeModelOwnerPrivate *priv; GList *owner_in_list; ENTER("model %p, owner %p, iter %p", model, owner, iter); gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE); gnc_leave_return_val_if_fail ((owner != NULL), FALSE); gnc_leave_return_val_if_fail ((iter != NULL), FALSE); priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model); owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc); if (owner_in_list) { iter->stamp = model->stamp; iter->user_data = owner_in_list->data; iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list)); iter->user_data3 = NULL; LEAVE("iter %s", iter_to_string (iter)); return TRUE; } else { iter->stamp = 0; iter->user_data = NULL; LEAVE("Owner not found in list"); return FALSE; } }
void TPCCTableProps_save_config (TPCCTableProps * newdlg) { int i; ServerDSN *dsn = SERVER_DSN (newdlg->dsn); for (i = 0; i < 9; i++) { GList *found; char *szValue = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (newdlg-> combos[i])->entry)); strncpy (newdlg->lpBench->tpc.c.tableDSNS[i], szValue, 50); if (!strcmp (szValue, "<local>")) newdlg->lpBench->tpc.c.tableDSNS[i][0] = 0; else if (NULL != (found = g_list_find_custom (dsn->dsn_info.dsns, szValue, (GCompareFunc) strcmp))) strncpy (newdlg->lpBench->tpc.c.tableDBMSes[i], (char *) g_list_nth_data (dsn->dsn_info.names, g_list_position (dsn->dsn_info.dsns, found)), 50); } newdlg->lpBench->tpc.c.count_ware = (int) gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (newdlg-> n_ware)); }
static gboolean thumbalbum_thumbnail_is_in_viewport (GimvThumbView *tv, GimvThumb *thumb) { ThumbViewData *tv_data; GList *node; gint index; gboolean success; GdkRectangle area, cell_area, intersect_area; g_return_val_if_fail (GIMV_IS_THUMB_VIEW (tv), FALSE); g_return_val_if_fail (GIMV_IS_THUMB (thumb), FALSE); tv_data = g_object_get_data (G_OBJECT (tv), THUMBALBUM_LABEL); g_return_val_if_fail (tv_data, FALSE); node = g_list_find (tv->thumblist, thumb); index = g_list_position (tv->thumblist, node); /* widget area */ gtkutil_get_widget_area (tv_data->album, &area); /* cell area */ success = gimv_zlist_get_cell_area (GIMV_ZLIST (tv_data->album), index, &cell_area); g_return_val_if_fail (success, FALSE); /* intersect? */ if (gdk_rectangle_intersect (&area, &cell_area, &intersect_area)) return TRUE; else return FALSE; }
void combo_tx_mode_changed (GtkEditable *editable, gpointer user_data) { GtkWidget *widget; char *mode, *upfreq, *dwfreq, *bcnfreq; GList *lmode; gint n; widget = lookup_widget( mainwindow, "combo_mode" ); mode = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry)); modelist=g_list_first( modelist ); lmode = g_list_find_custom( modelist, mode, (GCompareFunc)&compare_mode ); n=g_list_position( modelist, lmode ); if( n > -1 ) { upfreq=g_list_nth_data( uplinklist, n ); dwfreq=g_list_nth_data( downlinklist, n ); bcnfreq=g_list_nth_data( beaconlist, n ); widget = lookup_widget( mainwindow, "tx_uplink" ); gtk_entry_set_text(GTK_ENTRY(widget),upfreq); widget = lookup_widget( mainwindow, "tx_downlink" ); gtk_entry_set_text(GTK_ENTRY(widget),dwfreq); widget = lookup_widget( mainwindow, "tx_beacon" ); gtk_entry_set_text(GTK_ENTRY(widget),bcnfreq); } else { widget = lookup_widget( mainwindow, "tx_uplink" ); gtk_entry_set_text(GTK_ENTRY(widget),""); widget = lookup_widget( mainwindow, "tx_downlink" ); gtk_entry_set_text(GTK_ENTRY(widget),""); widget = lookup_widget( mainwindow, "tx_beacon" ); gtk_entry_set_text(GTK_ENTRY(widget),""); } }
void vik_aggregate_layer_insert_layer ( VikAggregateLayer *val, VikLayer *l, GtkTreeIter *replace_iter ) { GtkTreeIter iter; VikLayer *vl = VIK_LAYER(val); if ( vl->realized ) { vik_treeview_insert_layer ( vl->vt, &(vl->iter), &iter, l->name, val, l, l->type, l->type, replace_iter ); if ( ! l->visible ) vik_treeview_item_set_visible ( vl->vt, &iter, FALSE ); vik_layer_realize ( l, vl->vt, &iter ); if ( val->children == NULL ) vik_treeview_expand ( vl->vt, &(vl->iter) ); } if (replace_iter) { GList *theone = g_list_find ( val->children, vik_treeview_item_get_pointer ( vl->vt, replace_iter ) ); val->children = g_list_insert ( val->children, l, g_list_position(val->children,theone)+1 ); } else { // Effectively insert at 'end' of the list to match how displayed in the treeview // - but since it is drawn from 'bottom first' it is actually the first in the child list // This ordering is especially important if it is a map or similar type, // which needs be drawn first for the layering draw method to work properly. // ATM this only happens when a layer is drag/dropped to the end of an aggregate layer val->children = g_list_prepend ( val->children, l ); } g_signal_connect_swapped ( G_OBJECT(l), "update", G_CALLBACK(vik_layer_emit_update_secondary), val ); }
static GList* flush_explicit_items( GList* descriptions, GCallback toggleCb, int val, GtkWidget* menu, EgeAdjustmentAction* act, GtkWidget** dst, GSList** group, gdouble num ) { GList* cur = descriptions; if ( cur ) { gdouble valUpper = num + act->private_data->epsilon; gdouble valLower = num - act->private_data->epsilon; EgeAdjustmentDescr* descr = (EgeAdjustmentDescr*)cur->data; while ( cur && descr && (descr->value >= valLower) ) { if ( descr->value > valUpper ) { create_single_menu_item( toggleCb, val + g_list_position(act->private_data->descriptions, cur), menu, act, dst, group, descr->value, FALSE ); } cur = g_list_previous( cur ); descr = cur ? (EgeAdjustmentDescr*)cur->data : 0; } } return cur; }
void print_parents_lines(GList *line) { GNode *file_ptr; int depth; for (file_ptr = NODE(line)->parent, depth = g_node_depth(file_ptr) - 1; !G_NODE_IS_ROOT(file_ptr); file_ptr = file_ptr->parent, depth--) { if (file_ptr != g_node_last_sibling(file_ptr)) mvwaddch(tree_window, g_list_position(first_line, line), 2 * depth - 2, ACS_VLINE); else mvwaddch(tree_window, g_list_position(first_line, line), 2 * depth - 2, ' '); mvwaddch(tree_window, g_list_position(first_line, line), 2 * depth - 1, ' '); } }
/** * g_queue_link_index: * @queue: a #GQueue * @link_: A #GList link * * Returns the position of @link_ in @queue. * * Return value: The position of @link_, or -1 if the link is * not part of @queue * * Since: 2.4 **/ gint g_queue_link_index (GQueue *queue, GList *link_) { g_return_val_if_fail (queue != NULL, -1); return g_list_position (queue->head, link_); }
/* find the primary staff of the current staff, return its staffnum */ static gint primary_staff (DenemoMovement * si) { GList *curstaff; for (curstaff = si->currentstaff; curstaff && !(((DenemoStaff *) curstaff->data)->voicecontrol & DENEMO_PRIMARY); curstaff = curstaff->prev) ; //do nothing //g_debug("The position is %d\n", 1+g_list_position(si->thescore, curstaff)); return 1 + g_list_position (si->thescore, curstaff); }
/** * ags_polling_thread_new: * @polling_thread: the #AgsPollingThread * @gobject: the #AgsPollFd * * Remove @gobject from #AgsPollingThread. * * Since: 2.0.0 */ void ags_polling_thread_remove_poll_fd(AgsPollingThread *polling_thread, GObject *gobject) { struct pollfd *fds; guint length; gint nth; if(!AGS_IS_POLLING_THREAD(polling_thread) || !(AGS_IS_POLL_FD(gobject))){ return; } pthread_mutex_lock(polling_thread->fd_mutex); /* find fd */ nth = g_list_position(polling_thread->poll_fd, (gpointer) g_list_find(polling_thread->poll_fd, gobject)); if(nth < 0){ pthread_mutex_unlock(polling_thread->fd_mutex); return; } AGS_POLL_FD(gobject)->polling_thread = NULL; /* realloc array */ length = g_list_length(polling_thread->poll_fd); fds = (struct pollfd *) malloc((length - 1) * sizeof(struct pollfd)); if(nth != 0){ memcpy(fds, polling_thread->fds, nth * sizeof(struct pollfd)); } if(nth + 1 < length){ memcpy(&(fds[nth]), &(polling_thread->fds[nth + 1]), (length - nth - 1) * sizeof(struct pollfd)); } free(polling_thread->fds); polling_thread->fds = fds; /* remove from list */ polling_thread->poll_fd = g_list_remove(polling_thread->poll_fd, gobject); g_object_unref(gobject); pthread_mutex_unlock(polling_thread->fd_mutex); }
static gint gtr_po_message_container_get_message_number (GtrMessageContainer * container, GtrMsg * msg) { GtrPo *po = GTR_PO (container); GList *list; GtrPoPrivate *priv = gtr_po_get_instance_private (po); list = g_list_find (priv->messages, msg); return g_list_position (priv->messages, list); }
static GList* playlist_sort_selected(GList *list, GCompareFunc cmpfunc) { GList *list1, *list2; GList *temp_list = NULL; GList *index_list = NULL; /* * We take all the selected entries out of the playlist, * sort them, and then put them back in again. */ list1 = g_list_last(list); while (list1) { list2 = g_list_previous(list1); if (((PlaylistEntry *) list1->data)->selected) { gpointer idx; idx = GINT_TO_POINTER(g_list_position(list, list1)); index_list = g_list_prepend(index_list, idx); list = g_list_remove_link(list, list1); temp_list = g_list_concat(list1, temp_list); } list1 = list2; } if (cmpfunc) temp_list = g_list_sort(temp_list, cmpfunc); else temp_list = playlist_shuffle_list(temp_list); list1 = temp_list; list2 = index_list; while (list2) { if (!list1) { g_log(NULL, G_LOG_LEVEL_CRITICAL, "%s: Error during list sorting. " "Possibly dropped some playlist-entries.", PACKAGE); break; } list = g_list_insert(list, list1->data, GPOINTER_TO_INT(list2->data)); list2 = g_list_next(list2); list1 = g_list_next(list1); } g_list_free(index_list); g_list_free(temp_list); return list; }
int Layer::indexOf(Element * e) { XOJ_CHECK_TYPE(Layer); GList * elem = g_list_find(this->elements, e); if (elem == NULL) { return -1; } return g_list_position(this->elements, elem); }
void scroll_tree(int n_lines) { int min_n_lines, max_n_lines; if ((min_n_lines = -g_list_position(lines, first_line)) > n_lines) n_lines = min_n_lines; else if ((max_n_lines = g_list_length(last_line) - 1) < n_lines) n_lines = max_n_lines; wscrl(tree_window, n_lines); if (n_lines < 0) { first_line = g_list_nth(lines, g_list_position(lines, first_line) + n_lines); update_last_line(); print_lines(first_line, g_list_nth(first_line, -n_lines), FALSE); } else if (n_lines > 0) { first_line = g_list_nth(first_line, n_lines); update_last_line(); print_lines(g_list_nth(lines, g_list_position(lines, last_line) - n_lines), last_line, TRUE); } }
void change_interface(GtkComboBox *combo, gpointer labelinfo) { char *selected; GtkTreeIter iter; GtkTreeModel *model; gtk_combo_box_get_active_iter(combo, &iter); model = gtk_combo_box_get_model(combo); gtk_tree_model_get (model, &iter, 0, &selected, -1); GList * elem = g_list_find_custom(iflist, (gconstpointer) selected, cmp_str); int i = g_list_position(iflist, elem); gtk_label_set_label(GTK_LABEL(labelinfo), (char*)g_list_nth_data(iflist, i+1)); }
void vik_aggregate_layer_insert_layer ( VikAggregateLayer *val, VikLayer *l, GtkTreeIter *replace_iter ) { GtkTreeIter iter; VikLayer *vl = VIK_LAYER(val); // By default layers are inserted above the selected layer gboolean put_above = TRUE; // These types are 'base' types in that you what other information on top if ( l->type == VIK_LAYER_MAPS || l->type == VIK_LAYER_DEM || l->type == VIK_LAYER_GEOREF ) put_above = FALSE; if ( vl->realized ) { vik_treeview_insert_layer ( vl->vt, &(vl->iter), &iter, l->name, val, put_above, l, l->type, l->type, replace_iter ); if ( ! l->visible ) vik_treeview_item_set_visible ( vl->vt, &iter, FALSE ); vik_layer_realize ( l, vl->vt, &iter ); if ( val->children == NULL ) vik_treeview_expand ( vl->vt, &(vl->iter) ); } if (replace_iter) { GList *theone = g_list_find ( val->children, vik_treeview_item_get_pointer ( vl->vt, replace_iter ) ); if ( put_above ) val->children = g_list_insert ( val->children, l, g_list_position(val->children,theone)+1 ); else // Thus insert 'here' (so don't add 1) val->children = g_list_insert ( val->children, l, g_list_position(val->children,theone) ); } else { // Effectively insert at 'end' of the list to match how displayed in the treeview // - but since it is drawn from 'bottom first' it is actually the first in the child list // This ordering is especially important if it is a map or similar type, // which needs be drawn first for the layering draw method to work properly. // ATM this only happens when a layer is drag/dropped to the end of an aggregate layer val->children = g_list_prepend ( val->children, l ); } g_signal_connect_swapped ( G_OBJECT(l), "update", G_CALLBACK(vik_layer_emit_update_secondary), val ); }
static int session_try_login(Session *s){ struct gg_login_params login_params; GgServer *serv; g_message(N_("Trying to log in on server %u for %s"), g_list_position(gg_servers, s->current_server), s->jid); if (s->ping_timeout_func) g_source_remove(s->ping_timeout_func); s->ping_timeout_func=NULL; if (s->timeout_func) g_source_remove(s->timeout_func); s->timeout_func=NULL; if (s->ping_timer) g_timer_destroy(s->ping_timer); s->ping_timer=NULL; if (s->ggs) { gg_free_session(s->ggs); s->ggs=NULL; } session_remove_g_source(s); memset(&login_params,0,sizeof(login_params)); login_params.uin=s->user->uin; login_params.password=string_to_gg(s->user->password); login_params.async=1; login_params.last_sysmsg=s->user->last_sys_msg; login_params.protocol_version=GG_DEFAULT_PROTOCOL_VERSION; login_params.protocol_features=GG_FEATURE_ALL; login_params.client_version=GG_DEFAULT_CLIENT_VERSION; login_params.encoding = GG_ENCODING_UTF8; login_params.status=GG_STATUS_INVISIBLE; if(s->user->status) login_params.status_descr=s->user->status; serv=(GgServer*)s->current_server->data; if(serv->port!=1){ login_params.server_addr=serv->addr.s_addr; login_params.server_port=serv->port; } #ifdef __GG_LIBGADU_HAVE_OPENSSL debug(N_("Turning TLS %s"), serv->tls?"on":"off"); login_params.tls=serv->tls; #endif s->ggs=gg_login(&login_params); if (!s->ggs){ g_free(s); return 1; } session_setup_g_source(s); s->timeout_func=g_timeout_add(conn_timeout*1000,session_timeout,s); return FALSE; }
void print_lines(GList *start_line, GList *end_line, gboolean clear_bottom_lines) { GList *line_ptr; int line_number; if (end_line == NULL) end_line = last_line; else if (start_line != NULL) { for (line_ptr = start_line; g_list_position(first_line, line_ptr) < getmaxy(tree_window); line_ptr = g_list_next(line_ptr)) { print_line(line_ptr); if (line_ptr == end_line) break; } } line_number = g_list_position(first_line, last_line) + 1; if (clear_bottom_lines && line_number < getmaxy(tree_window)) { wmove(tree_window, line_number, 0); wclrtobot(tree_window); } }
static void tips_dialog_destroy (GtkWidget *widget, GimpGuiConfig *config) { /* the last-shown-tip is saved in sessionrc */ config->last_tip_shown = g_list_position (tips, current_tip); tips_dialog = NULL; current_tip = NULL; gimp_tips_free (tips); tips = NULL; }
void gltk_spinner_set_selected_item(GltkSpinner* spinner, int level, const gchar* id) { g_return_if_fail(GLTK_IS_SPINNER(spinner)); USING_PRIVATE(spinner); g_return_if_fail(level >= 0 && level < priv->model->levels); GList* pItems = g_list_find_custom(priv->wheels[level].items, id, (GCompareFunc)find_spinner_item); g_return_if_fail(pItems); int index = g_list_position(priv->wheels[level].items, pItems); gltk_spinner_set_selected_index(spinner, level, index); }