Exemple #1
0
// Cancel the placement of floating items and remove them.
void sheet_item_cancel_floating (Sheet *sheet)
{
	GooCanvasGroup *group;
	GList *list;

	g_return_if_fail (sheet != NULL);
	g_return_if_fail (IS_SHEET (sheet));

	group = GOO_CANVAS_GROUP (sheet->priv->floating_group);
	if (group == NULL)
		return;

	if (sheet->state != SHEET_STATE_FLOAT && sheet->state != SHEET_STATE_FLOAT_START)
		return;

	if (g_signal_handler_is_connected (sheet, sheet->priv->float_handler_id))
		g_signal_handler_disconnect (sheet, sheet->priv->float_handler_id);

	// TODO verfiy that the following has no nasty sideffects
	for (list = sheet->priv->floating_objects; list; list = list->next) {
		goo_canvas_item_remove (list->data); // remove from canvas and free
	}
	g_list_free (sheet->priv->floating_objects);
	sheet->priv->floating_objects = NULL;
	goo_canvas_item_remove (GOO_CANVAS_ITEM (group));

	// Create a new empty group to prepare next floating group
	sheet->priv->floating_group = GOO_CANVAS_GROUP (
	    goo_canvas_group_new (GOO_CANVAS_ITEM (sheet->object_group), "x", 0.0, "y", 0.0, NULL));

	// sheet_clear_ghosts (sheet);
	sheet->priv->float_handler_id = 0;
	sheet->state = SHEET_STATE_NONE;
}
Exemple #2
0
/* =====================================================================
 * Destroy all the items
 * =====================================================================*/
static void maze_destroy_all_items() {
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  if (threedgroup!=NULL)
    goo_canvas_item_remove(threedgroup);

  mazegroup = NULL;
  tuxgroup = NULL;
  wallgroup = NULL;
  boardRootItem = NULL;
  threedgroup=NULL;
}
Exemple #3
0
/* Destroy all the items */
static void superbrain_destroy_all_items()
{
  listPiecesClear();

  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;

  if(boardLogoItem!=NULL)
    goo_canvas_item_remove(boardLogoItem);

  boardLogoItem = NULL;
}
Exemple #4
0
/* Called with items_lock locked */
static void wordsgame_next_level_unlocked()
{
  gcomprisBoard->number_of_sublevel = 10 +
    ((gcomprisBoard->level-1) * 5);
  gc_score_start(SCORESTYLE_NOTE,
		 BOARDWIDTH - 195,
		 BOARDHEIGHT - 30,
		 gcomprisBoard->number_of_sublevel);

  gc_bar_set_level(gcomprisBoard);
  gc_score_set(gcomprisBoard->sublevel);

  wordsgame_destroy_all_items();

  if (preedit_text){
    goo_canvas_item_remove(preedit_text);
    preedit_text=NULL;
  }
  gc_im_reset();

  items=g_ptr_array_new();
  items2del=g_ptr_array_new();


  /* Increase speed only after 5 levels */
  if(gcomprisBoard->level > 5)
    {
      gint temp = fallSpeed-gcomprisBoard->level*200;
      if (temp > MIN_FALLSPEED)	fallSpeed=temp;
    }

  pause_board(FALSE);
}
Exemple #5
0
static void
end_board ()
{

  if(gcomprisBoard!=NULL)
    {
      pause_board(TRUE);
      gc_score_end();
#if GLIB_CHECK_VERSION(2, 31, 0)
      g_mutex_lock (&items_lock);
#else
      g_static_mutex_lock (&items_lock);
#endif
      wordsgame_destroy_all_items();
#if GLIB_CHECK_VERSION(2, 31, 0)
      g_mutex_unlock (&items_lock);
#else
      g_static_mutex_unlock (&items_lock);
#endif
      if (preedit_text){
	goo_canvas_item_remove(preedit_text);
	preedit_text=NULL;
      }
      gc_im_reset();
      gcomprisBoard = NULL;

      if (gc_wordlist != NULL){
	gc_wordlist_free(gc_wordlist);
	gc_wordlist = NULL;
      }
    }

  gc_locale_set( NULL );
}
Exemple #6
0
void
rubberband_info_destroy (RubberbandInfo *rubberband_info)
{
	g_return_if_fail (rubberband_info!=NULL);
	goo_canvas_item_remove (GOO_CANVAS_ITEM (rubberband_info->rectangle));
	g_free (rubberband_info);
}
Exemple #7
0
/* Destroy all the items */
static void planegame_destroy_all_items()
{
    if(rootitem)
        goo_canvas_item_remove(rootitem);

    rootitem = NULL;
}
Exemple #8
0
/* Destroy all the items */
static void wordprocessor_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;
}
Exemple #9
0
static gboolean
on_button_press (GooCanvasItem *item,
		 GooCanvasItem *target,
		 GdkEventButton *event,
		 gpointer data)
{
  GooCanvasItem *parent1, *parent2, *parent;

  if (event->button != 1 || event->type != GDK_BUTTON_PRESS)
    return FALSE;

  g_print ("In on_button_press\n");

  parent1 = g_object_get_data (G_OBJECT (item), "parent1");
  parent2 = g_object_get_data (G_OBJECT (item), "parent2");

  parent = goo_canvas_item_get_parent (item);
  g_object_ref (item);
  goo_canvas_item_remove (item);
  if (parent == parent1)
    goo_canvas_item_add_child (parent2, item, -1);
  else
    goo_canvas_item_add_child (parent1, item, -1);
  g_object_unref (item);

  return TRUE;
}
Exemple #10
0
/* Destroy all the items */
static void imageid_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;
}
Exemple #11
0
static void
display_section (gchar *path)
{
    GList *boardlist;	/* List of Board */

    menu_displayed = FALSE;

    boardlist = gc_menu_getlist(path);

    if (actualSectionItem)
        goo_canvas_item_remove(actualSectionItem);

    current_x = 0.0;
    current_y = 0.0;
    current_top_x = 0.0;
    current_top_y = 0.0;

    actualSectionItem = goo_canvas_group_new (boardRootItem,
                        NULL);

    create_top (actualSectionItem, path);

    g_list_foreach (boardlist, (GFunc) display_board_icon, menuitems);

    if (strcmp(path,"home")!=0)
        g_list_free(boardlist);

    menu_displayed = TRUE;
}
GSList *
browser_canvas_canvas_shapes_remove_obsolete_shapes (GSList *list)
{
	GSList *l, *ret = list;

	for (l = list; l; ) {
		if (((BrowserCanvasCanvasShape*)(l->data))->_used) {
			((BrowserCanvasCanvasShape*)(l->data))->_used = FALSE;
			l=l->next;
		}
		else {
			GSList *tmp;
			BrowserCanvasCanvasShape *shape = (BrowserCanvasCanvasShape*) l->data;

			g_free (shape->id);
			goo_canvas_item_remove (shape->item);
			g_free (shape);

			tmp = l->next;
			ret = g_slist_delete_link (ret, l);
			l = tmp;
		}
	}

	return ret;
}
Exemple #13
0
void
gst_editor_link_destroy (GstEditorLink * link)
{
  // g_print ("trying to destroy this half link");
  GstEditorBin * padbin;
  if (link->srcpad)
    padbin = GST_EDITOR_BIN (goo_canvas_item_get_parent (
        goo_canvas_item_get_parent (GOO_CANVAS_ITEM (link->srcpad))));
  else
    padbin = GST_EDITOR_BIN (goo_canvas_item_get_parent (
        goo_canvas_item_get_parent (GOO_CANVAS_ITEM (link->sinkpad))));
  padbin->links = g_list_remove (padbin->links, link);
  if (link->srcpad)
    GST_EDITOR_PAD (link->srcpad)->link = NULL;
  if (link->sinkpad)
    GST_EDITOR_PAD (link->sinkpad)->link = NULL;
  // int killnumber;
  // killnumber=goo_canvas_item_find_child(goo_canvas_item_get_parent(GOO_CANVAS_ITEM(link)),GOO_CANVAS_ITEM(link));
  // g_print ("found child at %d",killnumber);
  // ARGH, what am I doing here
  // g_realloc(link,sizeof(GooCanvasPolyline));

  // g_realloc(link,sizeof(GooCanvasPolyline));
  // goo_canvas_item_remove_child(goo_canvas_item_get_parent(GOO_CANVAS_ITEM(link)),killnumber);
  goo_canvas_item_remove (GOO_CANVAS_ITEM (link));
  if (link->points)
    goo_canvas_points_unref (link->points);
  // g_print ("ready to crash:)");
  // g_free(link);
  // g_print ("no warnings until now");
  return;
}
Exemple #14
0
/* Destroy all the items */
static void canal_lock_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;
}
Exemple #15
0
/*
 * remove the currently selected items from the sheet
 * (especially their goocanvas representators)
 */
void
sheet_delete_selection (Sheet *sheet)
{
	GList *copy, *iter;

	g_return_if_fail (sheet != NULL);
	g_return_if_fail (IS_SHEET (sheet));

	if (sheet->state != SHEET_STATE_NONE)
		return;

	copy = g_list_copy (sheet->priv->selected_objects);

	for (iter = copy; iter; iter = iter->next) {
		sheet_remove_item_in_sheet (SHEET_ITEM (iter->data), sheet);
		goo_canvas_item_remove (GOO_CANVAS_ITEM (iter->data));
	}
	g_list_free (copy);

	// we need to it like this as <sheet_remove_item_in_sheet>
	// requires selected_objects, items, floating_objects
	// to be not NULL!
	g_list_free (sheet->priv->selected_objects);
	sheet->priv->selected_objects = NULL;
}
Exemple #16
0
/* Destroy all the items */
static void
missing_letter_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;
}
Exemple #17
0
static void
hide_item_layer(PcbItem *item, int layer)
{
	if (item->canvas_item[layer]) {
		goo_canvas_item_remove(item->canvas_item[layer]);
		item->canvas_item[layer] = NULL;
	}
}
Exemple #18
0
/* Destroy all the items */
static void target_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;

  if(speedRootItem!=NULL)
    goo_canvas_item_remove(speedRootItem);

  animate_item = NULL;
  answer_item = NULL;
  answer_string_index = 0;
  user_points = 0;

  speedRootItem = NULL;
}
Exemple #19
0
static void planegame_cloud_colision(GooCanvasItem *item)
{
    GooCanvasBounds ib, pb;

    goo_canvas_item_get_bounds(planeitem,  &pb);
    goo_canvas_item_get_bounds(item, &ib);

    if(ib.x2<0)
    {
        goo_canvas_item_remove(item);
        return;
    }

    if(
        ISIN(ib.x1, ib.y1, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x2, ib.y1, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x1, ib.y2, pb.x1, pb.y1, pb.x2, pb.y2) ||
        ISIN(ib.x2, ib.y2, pb.x1, pb.y1, pb.x2, pb.y2)
    )
    {
        gint number = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item),
                                       "cloud_number"));

        if(plane_target == number)
        {
            planegame_speak_number(number);
            plane_target++;

            goo_canvas_item_remove(item);

            if(gcomprisBoard->level==1)
                gc_score_set(plane_target);

            if(plane_target == plane_last_target)
            {
                /* Try the next level */
                gcomprisBoard->level++;
                if(gcomprisBoard->level>gcomprisBoard->maxlevel)
                    gcomprisBoard->level = gcomprisBoard->maxlevel;

                planegame_next_level();
                gc_sound_play_ogg ("sounds/bonus.wav", NULL);
            }
        }
    }
}
Exemple #20
0
static void wire_delete_callback (Wire *wire, WireItem *item)
{
	// no clue why does work but canvas item does not disappear
	//	g_clear_object (&item);
	//	g_assert (item==NULL);
	goo_canvas_item_remove (GOO_CANVAS_ITEM (item));
	//	g_object_unref (wire); //FIXME this causes a segfault
}
Exemple #21
0
/* Destroy all the items */
static void memory_destroy_all_items()
{
  gint x, y;

  firstCard = NULL;
  secondCard = NULL;

  /* Remove timers first */
  if (win_id) {
    g_source_remove (win_id);
  }
  win_id = 0;

  if (currentMode == MODE_TUX){
    to_tux = FALSE;
    if (tux_id) {
      g_source_remove (tux_id);
    }
    tux_id =0;
  }

  /* Now destroy all items */
  if(boardRootItem!=NULL)
      goo_canvas_item_remove(boardRootItem);

  boardRootItem=NULL;

  // Clear the memoryArray
  for(x=0; x<MAX_MEMORY_WIDTH; x++)
    for(y=0; y<MAX_MEMORY_HEIGHT; y++)
      {
	if (memoryArray[x][y])
	  g_free(memoryArray[x][y]->second_value);
	g_free(memoryArray[x][y]);
	memoryArray[x][y] = NULL;
      }

  GList *list;

  for (list = passed_token; list != NULL; list=list->next)
    g_free(list->data);

  g_list_free(passed_token);

  passed_token = NULL;

  if (currentMode == MODE_TUX){
    for (list = winning_pairs; list != NULL; list=list->next)
      g_free(list->data);

    g_list_free(winning_pairs);

    winning_pairs = NULL;
    if (tux_memory)
      while (g_queue_pop_head (tux_memory));
  }

}
Exemple #22
0
static void stop_frigate_anim()
{
  if (frigate_item)
    {
      goo_canvas_item_stop_animation (frigate_item);
      goo_canvas_item_remove(frigate_item);
    }
  frigate_item = NULL;
}
Exemple #23
0
/* Destroy all the items */
static void click_on_letter_destroy_all_items()
{
  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;

  g_free (right_letter);
  right_letter = NULL;
}
Exemple #24
0
static void wordsgame_destroy_item(LettersItem *item)
{

  /* The items are freed by player_win */
  goo_canvas_item_remove(item->rootitem);
  g_free(item->word);
  g_free(item->overword);
  g_free(item->letter);
  g_free(item);
}
Exemple #25
0
// Reparent a sheet object without moving it on the sheet.
void sheet_item_reparent (SheetItem *item, GooCanvasGroup *group)
{
	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_SHEET_ITEM (item));
	g_return_if_fail (group != NULL);

	g_object_ref (item);
	goo_canvas_item_remove (GOO_CANVAS_ITEM (item));
	goo_canvas_item_add_child (GOO_CANVAS_ITEM (group), GOO_CANVAS_ITEM (item), -1);
	// FIXME are we leaking a ref here?
}
Exemple #26
0
/* Destroy all the items */
static void fifteen_destroy_all_items()
{
  if(boardRootItem!=NULL)
    {
      GooCanvasItem **board;
      board = g_object_get_data (G_OBJECT (boardRootItem), "board");
      g_free(board);
      goo_canvas_item_remove(boardRootItem);
    }
  boardRootItem = NULL;
}
/* =====================================================================
 * Destroy all the items
 * =====================================================================*/
static void colors_destroy_all_items()
{
  if (timer_id) {
    gtk_timeout_remove (timer_id);
    timer_id = 0;
  }

  if(boardRootItem!=NULL)
    goo_canvas_item_remove(boardRootItem);

  boardRootItem = NULL;
}
Exemple #28
0
static void
menu_end ()
{
    if(boardRootItem!=NULL)
        goo_canvas_item_remove(boardRootItem);

    boardRootItem     = NULL;
    actualSectionItem = NULL;

    g_list_free(panelBoards);

}
Exemple #29
0
/* =====================================================================
 *
 * =====================================================================*/
static void end_board () {
  if(gcomprisBoard!=NULL){
    pause_board(TRUE);
    submarine_destroy_all_items();
  }
  gcomprisBoard = NULL;

  if(backgroundRootItem != NULL){
    goo_canvas_item_remove(backgroundRootItem);
  }
  backgroundRootItem = NULL;
}
Exemple #30
0
void
hide_overlays(int layer)
{
	PcbItem *cur;

	g_print("hide overlays on layer %d\n", layer);
	if (pcb.layer[layer].olay) {
		goo_canvas_item_remove(pcb.layer[layer].olay);
		pcb.layer[layer].olay = NULL;
	}
	for (cur = pcb.items; cur; cur = cur->next)
		cur->canvas_item[layer] = NULL;
}