/** * gnome_druid_append_page: * @druid: A #GnomeDruid widget. * @page: The #GnomeDruidPage to be appended. * * Description: This will append @page onto the end of the internal list. * Since #GnomeDruid is just a container, you will need to also call * gtk_widget_show() on the page, otherwise the page will not be shown. **/ void gnome_druid_append_page (GnomeDruid *druid, GnomeDruidPage *page) { GList *list; g_return_if_fail (druid != NULL); g_return_if_fail (GNOME_IS_DRUID (druid)); g_return_if_fail (page != NULL); g_return_if_fail (GNOME_IS_DRUID_PAGE (page)); list = g_list_last (druid->_priv->children); if (list) { gnome_druid_insert_page (druid, GNOME_DRUID_PAGE (list->data), page); } else { gnome_druid_insert_page (druid, NULL, page); } }
GList * g_list_concat (GList *list1, GList *list2) { GList *tmp_list; if (list2) { tmp_list = g_list_last (list1); if (tmp_list) tmp_list->next = list2; else list1 = list2; list2->prev = tmp_list; } return list1; }
void add_toolbar_constructor(MainWindow *mw, LttvToolbarClosure *toolbar_c) { LttvIAttribute *attributes = mw->attributes; LttvAttributeValue value; LttvToolbars * instance_toolbar; lttvwindow_viewer_constructor constructor; GtkWidget * tool_menu_title_menu, *new_widget, *pixmap; GdkPixbuf *pixbuf; gboolean retval; retval= lttv_iattribute_find_by_path(attributes, "viewers/toolbar", LTTV_POINTER, &value); g_assert(retval); if(*(value.v_pointer) == NULL) *(value.v_pointer) = lttv_toolbars_new(); instance_toolbar = (LttvToolbars*)*(value.v_pointer); constructor = toolbar_c->con; tool_menu_title_menu = lookup_widget(mw->mwindow,"MToolbar1"); pixbuf = gdk_pixbuf_new_from_xpm_data((const char**)toolbar_c->pixmap); pixmap = gtk_image_new_from_pixbuf(pixbuf); new_widget = gtk_toolbar_append_element (GTK_TOOLBAR (tool_menu_title_menu), GTK_TOOLBAR_CHILD_BUTTON, NULL, "", toolbar_c->tooltip, NULL, pixmap, NULL, NULL); gtk_label_set_use_underline( GTK_LABEL (((GtkToolbarChild*) ( g_list_last (GTK_TOOLBAR (tool_menu_title_menu)->children)->data))->label), TRUE); gtk_container_set_border_width (GTK_CONTAINER (new_widget), 1); g_signal_connect ((gpointer) new_widget, "clicked", G_CALLBACK (insert_viewer_wrap), constructor); gtk_widget_show (new_widget); lttv_toolbars_add(instance_toolbar, toolbar_c->con, toolbar_c->tooltip, toolbar_c->pixmap, new_widget); }
static void conv_placement_by_number(PidginConversation *conv) { PidginWindow *win = NULL; GList *wins = NULL; if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) win = pidgin_conv_window_last_with_type(purple_conversation_get_type(conv->active_conv)); else if ((wins = pidgin_conv_windows_get_list()) != NULL) win = g_list_last(wins)->data; if (win == NULL) { win = pidgin_conv_window_new(); pidgin_conv_window_add_gtkconv(win, conv); pidgin_conv_window_show(win); } else { int max_count = purple_prefs_get_int("/plugins/gtk/extplacement/placement_number"); int count = pidgin_conv_window_get_gtkconv_count(win); if (count < max_count) pidgin_conv_window_add_gtkconv(win, conv); else { GList *l = NULL; for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { win = l->data; if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && purple_conversation_get_type(pidgin_conv_window_get_active_conversation(win)) != purple_conversation_get_type(conv->active_conv)) continue; count = pidgin_conv_window_get_gtkconv_count(win); if (count < max_count) { pidgin_conv_window_add_gtkconv(win, conv); return; } } win = pidgin_conv_window_new(); pidgin_conv_window_add_gtkconv(win, conv); pidgin_conv_window_show(win); } } }
/* Remove 1/3 of the least used (according to cache_counter_comp) entries (measured by size) */ int cache_clean(size_t new_element_size) { size_t req_size; GList *gl; TCounterEntry *centry; log_msg(OTTS_LOG_INFO, "Cache: cleaning, cache size %ld kbytes (>max %d).", FestivalCache.size / 1024, FestivalCacheMaxKBytes); req_size = 2 * FestivalCache.size / 3; FestivalCache.cache_counter = g_list_sort(FestivalCache.cache_counter, cache_counter_comp); g_list_foreach(FestivalCache.cache_counter, cache_debug_foreach_list_score, NULL); while ((FestivalCache.size + new_element_size) > req_size) { gl = g_list_last(FestivalCache.cache_counter); if (gl == NULL) break; if (gl->data == NULL) { log_msg(OTTS_LOG_DEBUG, "Error: Cache: gl->data in cache_clean is NULL, but shouldn't be."); return -1; } centry = gl->data; FestivalCache.size -= centry->size; log_msg(OTTS_LOG_DEBUG, "Cache: Removing element with key '%s'", centry->key); if (FestivalCache.size < 0) { log_msg(OTTS_LOG_ERR, "Error: Cache: FestivalCache.size < 0, this shouldn't be."); return -1; } /* Remove the data itself from the hash table */ g_hash_table_remove(centry->p_caches, centry->key); /* Remove the associated entry in the counter list */ cache_free_counter_entry(centry, NULL); FestivalCache.cache_counter = g_list_delete_link(FestivalCache.cache_counter, gl); } return 0; }
/** selection changed */ static void on_selection_changed(GtkTreeSelection *selection, gpointer u) { if(_clear_in_progress) return; // GtkTreeModel *m = gtk_tree_view_get_model(tv); /* unhighlight all elements */ // GtkTreeIter i; // gtk_tree_model_get_iter_root(m, &i); // _walk_tree(&i, _unhighlight_element); /* clear preview */ live_preview_clear(); ui_setup_ledlist_do_foreach_element(_foreach_unhighlight); /* process all selected elements */ gtk_tree_selection_selected_foreach(selection, _element_selected, NULL); /* get last selected element */ GList *selected; GtkTreeModel *m; if(!(selected = gtk_tree_selection_get_selected_rows(selection, &m))) return; GtkTreePath *path = (GtkTreePath *) g_list_last(selected)->data; GtkTreeIter iter; gtk_tree_model_get_iter(m, &iter, path); /* get this element */ LedCount i; gpointer *p; gtk_tree_model_get(m, &iter, C_CHAIN_LED, &i, C_CHAIN_ELEMENT, &p, -1); /* show property dialog for this led */ ui_setup_props_hide(); ui_setup_props_led_show((NiftyconfLed *) p); /* refresh live hardware preview */ live_preview_show(); /* redraw */ renderer_all_queue_draw(); }
void meta_ui_tab_popup_backward (MetaTabPopup *popup) { if (popup->current != NULL) popup->current = popup->current->prev; if (popup->current == NULL) popup->current = g_list_last (popup->entries); if (popup->current != NULL) { TabEntry *te; te = popup->current->data; display_entry (popup, te); } }
static gboolean is_window_on_active_workspace_and_no_other_maximized_windows_above(WnckWindow *window) { WnckWorkspace *workspace = wnck_window_get_workspace(window); WnckScreen *screen = wnck_workspace_get_screen(workspace); if (wnck_screen_get_active_workspace(screen) != workspace) { return FALSE; } GList *windows = wnck_screen_get_windows_stacked(screen); GList *top_window = g_list_last(windows); GList *bottom_window = g_list_first(windows); while (top_window->data != window && top_window != bottom_window) { if (wnck_window_is_maximized((WnckWindow *)top_window->data)) { return FALSE; } top_window = top_window->prev; } return TRUE; }
void gedit_multi_notebook_previous_notebook (GeditMultiNotebook *mnb) { GList *current; GtkWidget *notebook; g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb)); current = g_list_find (mnb->priv->notebooks, mnb->priv->active_notebook); if (current->prev != NULL) notebook = GTK_WIDGET (current->prev->data); else notebook = GTK_WIDGET (g_list_last (mnb->priv->notebooks)->data); gtk_widget_grab_focus (notebook); }
/***************************************************************************** * * Public functions. * *****************************************************************************/ void spi_init () { GList *list; spi_create_search_dir_list (); /* load spi from disk */ list = g_list_last (spi_search_dir_list); for (; list; list = g_list_previous (list)) { gchar *dir = list->data; if (dir && *dir) spi_search_directory (dir); } spi_inited = TRUE; }
//'Remove' button handler. static void on_remove() { GList *selected, *element; GtkTreeModel *model; GtkTreeIter iter; selected = gtk_tree_selection_get_selected_rows(tree_selection, &model); element = g_list_last(selected); //iterate backward so we don't miss any while(element != NULL) { if(!gtk_tree_model_get_iter(model, &iter, (GtkTreePath*)element->data)) break; gtk_tree_store_remove(store, &iter); element = g_list_previous(element); } g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL); g_list_free(selected); }
void ptk_file_list_file_created( VFSDir* dir, VFSFileInfo* file, PtkFileList* list ) { GList* l; GtkTreeIter it; GtkTreePath* path; VFSFileInfo* file2; if( ! list->show_hidden && vfs_file_info_get_name(file)[0] == '.' ) return; for( l = list->files; l; l = l->next ) { file2 = (VFSFileInfo*)l->data; if( G_UNLIKELY( file == file2 || ptk_file_list_compare( file2, file, list ) == 0 ) ) { /* The file is already in the list */ return; } if( ptk_file_list_compare( file2, file, list ) > 0 ) { break; } } list->files = g_list_insert_before( list->files, l, vfs_file_info_ref( file ) ); ++list->n_files; if( l ) l = l->prev; else l = g_list_last( list->files ); it.stamp = list->stamp; it.user_data = l; it.user_data2 = file; path = gtk_tree_path_new_from_indices( g_list_index(list->files, l->data), -1 ); gtk_tree_model_row_inserted( GTK_TREE_MODEL(list), path, &it ); gtk_tree_path_free( path ); }
static void clutter_group_real_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Raise at the top */ if (!sibling) { GList *last_item; last_item = g_list_last (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_append (priv->children, actor); } else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } /* set Z ordering a value below, this will then call sort * as values are equal ordering shouldn't change but Z * values will be correct. * * FIXME: get rid of this crap; this is so utterly broken and wrong on * so many levels it's not even funny. sadly, we get to keep this until * we can break API and remove Group for good. */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static void generate_report_last_compat (int uid, const char *seat, const char *session_type) { GList *oldest; CkLogEvent *oldest_event; GList *l; time_t oldest_e; /* print events in reverse time order */ for (l = g_list_last (all_events); l != NULL; l = l->prev) { CkLogEvent *event; event = l->data; if (event->type == CK_LOG_EVENT_SEAT_SESSION_ADDED) { CkLogSeatSessionAddedEvent *e; e = (CkLogSeatSessionAddedEvent *)event; if (uid >= 0 && e->session_unix_user != (guint)uid) { continue; } if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { continue; } if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { continue; } } print_last_report_record (l, event, TRUE); } oldest = g_list_first (all_events); if (oldest != NULL) { oldest_event = oldest->data; oldest_e = oldest_event->timestamp.tv_sec; g_print ("\nLog begins %s", ctime (&oldest_e)); } }
void dt_view_manager_expose (dt_view_manager_t *vm, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery) { if(vm->current_view < 0) { cairo_set_source_rgb(cr, darktable.gui->bgcolor[0], darktable.gui->bgcolor[1], darktable.gui->bgcolor[2]); cairo_paint(cr); return; } dt_view_t *v = vm->view + vm->current_view; v->width = width; v->height = height; if(v->expose) { /* expose the view */ cairo_rectangle(cr, 0, 0, v->width, v->height); cairo_clip(cr); cairo_new_path(cr); float px = pointerx, py = pointery; if(pointery > v->height) { px = 10000.0; py = -1.0; } v->expose(v, cr, v->width, v->height, px, py); /* expose plugins */ GList *plugins = g_list_last(darktable.lib->plugins); while (plugins) { dt_lib_module_t *plugin = (dt_lib_module_t *)(plugins->data); if (!plugin->views) fprintf(stderr,"module %s doesnt have views flags\n",plugin->name()); /* does this module belong to current view ?*/ if (plugin->gui_post_expose && plugin->views() & v->view(v) ) plugin->gui_post_expose(plugin,cr,v->width,v->height,px,py ); /* get next plugin */ plugins = g_list_previous(plugins); } } }
/* ********************************************************************** * Function called for a stat command-line argument * ********************************************************************** */ gboolean process_stat_cmd_arg(char *optstr) { GList *entry; stat_cmd_arg *sca; stat_requested *tr; for(entry=g_list_last(stat_cmd_arg_list);entry;entry=g_list_previous(entry)){ sca=(stat_cmd_arg *)entry->data; if(!strncmp(sca->cmd,optstr,strlen(sca->cmd))){ tr=(stat_requested *)g_malloc(sizeof (stat_requested)); tr->sca = sca; tr->arg=g_strdup(optstr); stats_requested=g_slist_append(stats_requested, tr); return TRUE; } } return FALSE; }
/** * uber_window_hide_labels: * @window: A #UberWindow. * * XXX * * Returns: None. * Side effects: None. */ void uber_window_hide_labels (UberWindow *window, /* IN */ UberGraph *graph) /* IN */ { UberWindowPrivate *priv; GtkWidget *labels; gboolean show; g_return_if_fail(UBER_IS_WINDOW(window)); g_return_if_fail(UBER_IS_GRAPH(graph)); priv = window->priv; labels = uber_graph_get_labels(graph); if (labels) { gtk_widget_hide(labels); } show = g_list_last(priv->graphs) == (gpointer)graph; uber_graph_set_show_xlabels(graph, show); }
static GHashTable * key_hash_get_keycode_hash (GtkKeyHash *key_hash) { if (!key_hash->keycode_hash) { GList *tmp_list; key_hash->keycode_hash = g_hash_table_new (g_direct_hash, NULL); /* Preserve the original insertion order */ for (tmp_list = g_list_last (key_hash->entries_list); tmp_list; tmp_list = tmp_list->prev) key_hash_insert_entry (key_hash, tmp_list->data); } return key_hash->keycode_hash; }
static GstElement * create_ipp_bin (void) { GstElement *bin = NULL, *element = NULL; GstPad *pad = NULL; gchar **elements; GList *element_list = NULL, *current = NULL, *next = NULL; int i; bin = gst_bin_new ("ippbin"); elements = g_strsplit (imagepp_name, ",", 0); for (i = 0; elements[i] != NULL; i++) { element = gst_element_factory_make (elements[i], NULL); if (element) { element_list = g_list_append (element_list, element); gst_bin_add (GST_BIN (bin), element); } else GST_WARNING ("Could create element %s for ippbin", elements[i]); } for (i = 1; i < g_list_length (element_list); i++) { current = g_list_nth (element_list, i - 1); next = g_list_nth (element_list, i); gst_element_link (current->data, next->data); } current = g_list_first (element_list); pad = gst_element_get_static_pad (current->data, "sink"); gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad)); gst_object_unref (GST_OBJECT (pad)); current = g_list_last (element_list); pad = gst_element_get_static_pad (current->data, "src"); gst_element_add_pad (bin, gst_ghost_pad_new ("src", pad)); gst_object_unref (GST_OBJECT (pad)); g_list_free (element_list); g_strfreev (elements); return bin; }
static gboolean gnc_search_dialog_crit_ok (GNCSearchWindow *sw) { struct _crit_data *data; GList *l; gboolean ret; if (!sw->crit_list) return TRUE; l = g_list_last (sw->crit_list); data = l->data; ret = gnc_search_core_type_validate (data->element); if (ret) sw->last_param = data->param; return ret; }
static gboolean process_tab( GtkWidget* widget, int direction ) { gboolean handled = FALSE; GtkWidget* parent = gtk_widget_get_parent(widget); GtkWidget* gp = parent ? gtk_widget_get_parent(parent) : 0; GtkWidget* ggp = gp ? gtk_widget_get_parent(gp) : 0; if ( ggp && GTK_IS_TOOLBAR(ggp) ) { GList* kids = gtk_container_get_children( GTK_CONTAINER(ggp) ); if ( kids ) { GtkWidget* curr = widget; while ( curr && (gtk_widget_get_parent(curr) != ggp) ) { curr = gtk_widget_get_parent( curr ); } if ( curr ) { GList* mid = g_list_find( kids, curr ); while ( mid ) { mid = ( direction < 0 ) ? g_list_previous(mid) : g_list_next(mid); if ( mid && GTK_IS_TOOL_ITEM(mid->data) ) { /* potential target */ GtkWidget* child = gtk_bin_get_child( GTK_BIN(mid->data) ); if ( child && GTK_IS_HBOX(child) ) { /* could be ours */ GList* subChildren = gtk_container_get_children( GTK_CONTAINER(child) ); if ( subChildren ) { GList* last = g_list_last(subChildren); if ( last && GTK_IS_SPIN_BUTTON(last->data) && GTK_WIDGET_IS_SENSITIVE( GTK_WIDGET(last->data) ) ) { gtk_widget_grab_focus( GTK_WIDGET(last->data) ); handled = TRUE; mid = 0; /* to stop loop */ } g_list_free(subChildren); } } } } } g_list_free( kids ); } } return handled; }
void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child) { wxMDIChildFrame* child_frame = static_cast<wxMDIChildFrame*>(child); wxString s = child_frame->GetTitle(); if ( s.empty() ) s = _("MDI child"); GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); GtkNotebook* notebook = GTK_NOTEBOOK(m_widget); gtk_notebook_append_page( notebook, child->m_widget, label_widget ); child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); wxMDIParentFrame* parent_frame = static_cast<wxMDIParentFrame*>(GetParent()); parent_frame->m_justInserted = true; }
/* * We know that the data does not exist! */ void lru_cache_insert(struct lruCache *c, void* data, void (*func)(void*, void*), void* user_data) { void *victim = 0; if (c->max_size > 0 && c->size == c->max_size) { GList *last = g_list_last(c->elem_queue); c->elem_queue = g_list_remove_link(c->elem_queue, last); victim = last->data; g_list_free_1(last); c->size--; } c->elem_queue = g_list_prepend(c->elem_queue, data); c->size++; if (victim) { if (func) func(victim, user_data); c->free_elem(victim); } }
static void data_refreshed(GtkWidget * chart) { gint j; for (j=0;j<CORES;j++) { data[j] = g_list_delete_link (data[j], g_list_first (data[j])); data[j] = g_list_append (data[j], GINT_TO_POINTER( CLAMP( GPOINTER_TO_INT( g_list_last(data[j])->data) + g_random_int_range(-10, 10), MIN_VALUE, MAX_VALUE ) )); } /*gint i; for (i=0;i<LENGTH;i++) { printf ("%d, ", GPOINTER_TO_INT(g_list_nth_data (data, i))); }*/ last_data_time = g_get_real_time (); printf(" Refreshed at %li\n", last_data_time); }
static MxFocusable * mex_column_accept_focus (MxFocusable *focusable, MxFocusHint hint) { GList *link_; MexColumn *self = MEX_COLUMN (focusable); MexColumnPrivate *priv = self->priv; focusable = NULL; switch (hint) { case MX_FOCUS_HINT_FROM_LEFT: case MX_FOCUS_HINT_FROM_RIGHT: case MX_FOCUS_HINT_PRIOR: if (priv->current_focus && (focusable = mx_focusable_accept_focus ( MX_FOCUSABLE (priv->current_focus), hint))) break; /* If there's no prior focus, or the prior focus rejects focus, * try to just focus the first actor. */ case MX_FOCUS_HINT_FIRST: case MX_FOCUS_HINT_FROM_ABOVE: if (priv->n_items) focusable = mx_focusable_accept_focus ( MX_FOCUSABLE (priv->children->data), hint); break; case MX_FOCUS_HINT_LAST: case MX_FOCUS_HINT_FROM_BELOW: link_ = g_list_last (priv->children); if (link_) focusable = mx_focusable_accept_focus ( MX_FOCUSABLE (link_->data), hint); break; } return focusable; }
static uint32_t find_free_or_expired_nip(GDHCPServer *dhcp_server, const uint8_t *safe_mac) { uint32_t ip_addr; struct dhcp_lease *lease; GList *list; ip_addr = dhcp_server->start_ip; for (; ip_addr <= dhcp_server->end_ip; ip_addr++) { /* e.g. 192.168.55.0 */ if ((ip_addr & 0xff) == 0) continue; /* e.g. 192.168.55.255 */ if ((ip_addr & 0xff) == 0xff) continue; lease = find_lease_by_nip(dhcp_server, (uint32_t) htonl(ip_addr)); if (lease != NULL) continue; if (arp_check(htonl(ip_addr), safe_mac) == TRUE) return htonl(ip_addr); } /* The last lease is the oldest one */ list = g_list_last(dhcp_server->lease_list); if (list == NULL) return 0; lease = list->data; if (lease == NULL) return 0; if (is_expired_lease(lease) == FALSE) return 0; if (arp_check(lease->lease_nip, safe_mac) == FALSE) return 0; return lease->lease_nip; }
static void do_ntp_time (GstClockTime buffer_time, gint segment_start, gint segment_base) { GstSegment segment; GstBuffer *buffer; GstRTPBuffer rtpbuffer = GST_RTP_BUFFER_INIT; guint8 *data; guint64 expected_ntp_time; guint64 timestamp; /* create a segment that controls the behavior * by changing segment.start and segment.base we affect the stream time and * running time respectively */ gst_segment_init (&segment, GST_FORMAT_TIME); segment.start = segment_start; segment.base = segment_base; gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)); expected_ntp_time = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, buffer_time); expected_ntp_time += NTP_OFFSET; expected_ntp_time = gst_util_uint64_scale (expected_ntp_time, (G_GINT64_CONSTANT (1) << 32), GST_SECOND); buffer = create_rtp_buffer (buffer_time, FALSE); fail_unless_equals_int (gst_pad_push (mysrcpad, buffer), GST_FLOW_OK); fail_unless_equals_int (g_list_length (buffers), 1); buffer = g_list_last (buffers)->data; /* get the extension header */ fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READWRITE, &rtpbuffer)); fail_unless (gst_rtp_buffer_get_extension_data (&rtpbuffer, NULL, (gpointer) & data, NULL)); /* ...and read the NTP timestamp and verify that it's the expected one */ timestamp = GST_READ_UINT64_BE (data); fail_unless_equals_uint64 (timestamp, expected_ntp_time); gst_rtp_buffer_unmap (&rtpbuffer); gst_check_drop_buffers (); }
/** Create a copy of a customer, placing the copy into a new book. */ GncCustomer * gncCloneCustomer (GncCustomer *from, QofBook *book) { GList *node; GncCustomer *cust; cust = g_object_new (GNC_TYPE_CUSTOMER, NULL); qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book); qof_instance_gemini (&cust->inst, &from->inst); cust->id = CACHE_INSERT (from->id); cust->name = CACHE_INSERT (from->name); cust->notes = CACHE_INSERT (from->notes); cust->discount = from->discount; cust->credit = from->credit; cust->taxincluded = from->taxincluded; cust->active = from->active; cust->taxtable_override = from->taxtable_override; cust->addr = gncCloneAddress (from->addr, &cust->inst, book); cust->shipaddr = gncCloneAddress (from->shipaddr, &cust->inst, book); /* Find the matching currency in the new book, assumes * currency has already been copied into new book. */ cust->currency = gnc_commodity_obtain_twin (from->currency, book); /* Find the matching bill term, tax table in the new book */ cust->terms = gncBillTermObtainTwin(from->terms, book); cust->taxtable = gncTaxTableObtainTwin (from->taxtable, book); for (node = g_list_last(cust->jobs); node; node = node->next) { GncJob *job = node->data; job = gncJobObtainTwin (job, book); cust->jobs = g_list_prepend(cust->jobs, job); } qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL); return cust; }
static void clutter_group_real_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Raise at the top */ if (!sibling) { GList *last_item; last_item = g_list_last (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_append (priv->children, actor); } else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } /* set Z ordering a value below, this will then call sort * as values are equal ordering shouldn't change but Z * values will be correct. * * FIXME: optimise */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
/** * gedit_notebook_remove_all_tabs: * @nb: a #GeditNotebook * * Removes all #GeditTab from @nb. */ void gedit_notebook_remove_all_tabs (GeditNotebook *nb) { GList *tabs, *t; g_return_if_fail (GEDIT_IS_NOTEBOOK (nb)); g_list_free (nb->priv->focused_pages); nb->priv->focused_pages = NULL; /* Remove tabs in reverse order since it is faster * due to how gtknotebook works */ tabs = gtk_container_get_children (GTK_CONTAINER (nb)); for (t = g_list_last (tabs); t != NULL; t = t->prev) { gtk_container_remove (GTK_CONTAINER (nb), GTK_WIDGET (t->data)); } g_list_free (tabs); }