Exemple #1
0
static void deinit(void)
{
  tick_timer_service_unsubscribe();

  for (int i = 0; i < TOTAL_TIME_DIGITS; i++)
  {
    layer_remove_from_parent(bitmap_layer_get_layer(time_digits_layers[i]));
    gbitmap_destroy(time_digits_images[i]);
    bitmap_layer_destroy(time_digits_layers[i]);
  }

	  window_destroy(window);
}
Exemple #2
0
void html_diag_destroy_cb(GtkWidget * widget, Thtml_diag *dg) {
	/* kyanh, removed, 20050225,
	dg->tobedestroyed = TRUE; */
	if (dg->mark_ins) {
		gtk_text_buffer_delete_mark(dg->doc->buffer,dg->mark_ins);
	}
	if (dg->mark_sel) {
		gtk_text_buffer_delete_mark(dg->doc->buffer,dg->mark_sel);
	}
	window_destroy(dg->dialog); /* kyanh, from: gtk_easy.h */
	DEBUG_MSG("html_diag_destroy_cb, about to free dg=%p\n",dg);
	g_free(dg);
}
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CONFIRM);

  const GEdgeInsets icon_insets = {.top = 7, .right = 28, .bottom = 56, .left = 14};
  s_icon_layer = bitmap_layer_create(grect_inset(bounds, icon_insets));
  bitmap_layer_set_bitmap(s_icon_layer, s_icon_bitmap);
  bitmap_layer_set_compositing_mode(s_icon_layer, GCompOpSet);
  layer_add_child(window_layer, bitmap_layer_get_layer(s_icon_layer));

  const GEdgeInsets label_insets = {.top = 112, .right = ACTION_BAR_WIDTH, .left = ACTION_BAR_WIDTH / 2};
  s_label_layer = text_layer_create(grect_inset(bounds, label_insets));
  text_layer_set_text(s_label_layer, DIALOG_CHOICE_WINDOW_MESSAGE);
  text_layer_set_background_color(s_label_layer, GColorClear);
  text_layer_set_text_alignment(s_label_layer, GTextAlignmentCenter);
  text_layer_set_font(s_label_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  layer_add_child(window_layer, text_layer_get_layer(s_label_layer));

  s_tick_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TICK);
  s_cross_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CROSS);

  s_action_bar_layer = action_bar_layer_create();
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, s_tick_bitmap);
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, s_cross_bitmap);
  action_bar_layer_add_to_window(s_action_bar_layer, window);
}

static void window_unload(Window *window) {
  text_layer_destroy(s_label_layer);
  action_bar_layer_destroy(s_action_bar_layer);
  bitmap_layer_destroy(s_icon_layer);

  gbitmap_destroy(s_icon_bitmap);
  gbitmap_destroy(s_tick_bitmap);
  gbitmap_destroy(s_cross_bitmap);

  window_destroy(window);
  s_main_window = NULL;
}

void dialog_choice_window_push() {
  if(!s_main_window) {
    s_main_window = window_create();
    window_set_background_color(s_main_window, PBL_IF_COLOR_ELSE(GColorJaegerGreen, GColorWhite));
    window_set_window_handlers(s_main_window, (WindowHandlers) {
        .load = window_load,
        .unload = window_unload,
    });
  }
Exemple #4
0
/**
 * @brief Clean up function for the button widget.
 *
 *    @param tab Tabbed Window to clean up.
 */
static void tab_cleanup( Widget *tab )
{
   int i;
   for (i=0; i<tab->dat.tab.ntabs; i++) {
      free( tab->dat.tab.tabnames[i] );
      window_destroy( tab->dat.tab.windows[i] );
   }
   if (tab->dat.tab.tabnames != NULL)
      free( tab->dat.tab.tabnames );
   if (tab->dat.tab.windows != NULL)
      free( tab->dat.tab.windows );
   if (tab->dat.tab.namelen != NULL)
      free( tab->dat.tab.namelen );
}
static void
_hide(const int id)
{
	g_debug("call_hide(id=%d)", id);
	call_common_active_call_remove(id);

	struct Window *win = instance_manager_remove(id);
	if (win) {
		window_destroy(win, NULL);
	}
	else {
		g_critical("Tried to hide a unitinialized window");
	}
}
Exemple #6
0
static void deinit() {
    battery_state_service_unsubscribe();
    tick_timer_service_unsubscribe();
    window_destroy(g_window);
    layer_destroy(g_layer);
#if RESMEM
    free(g_resource_memory);
#else
    fpath_destroy(g_minute);
    fpath_destroy(g_hour);
    fpath_destroy(g_body);
    ffont_destroy(g_font);
#endif
}
Exemple #7
0
void main_window_deinit(void)
{
	accel_tap_service_unsubscribe();
	tick_timer_service_unsubscribe();
	if (app_timer != NULL) {
		app_timer_cancel(app_timer);
	}

	for (int index = 0; index < 4; index++) {
		text_layer_destroy(text_layers[index]);
	}

	window_destroy(main_window);
}
Exemple #8
0
int main(int argc, char *argv[])
{
	struct timespec ts;
	struct smoke smoke;
	struct display *d;
	int size;

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	smoke.width = 200;
	smoke.height = 200;
	smoke.display = d;
	smoke.window = window_create(d);
	smoke.widget = window_add_widget(smoke.window, &smoke);
	window_set_title(smoke.window, "smoke");

	window_set_buffer_type(smoke.window, WINDOW_BUFFER_TYPE_SHM);
	clock_gettime(CLOCK_MONOTONIC, &ts);
	srandom(ts.tv_nsec);

	smoke.current = 0;
	size = smoke.height * smoke.width;
	smoke.b[0].d = calloc(size, sizeof(float));
	smoke.b[0].u = calloc(size, sizeof(float));
	smoke.b[0].v = calloc(size, sizeof(float));
	smoke.b[1].d = calloc(size, sizeof(float));
	smoke.b[1].u = calloc(size, sizeof(float));
	smoke.b[1].v = calloc(size, sizeof(float));

	widget_set_motion_handler(smoke.widget, mouse_motion_handler);
	widget_set_touch_motion_handler(smoke.widget, touch_motion_handler);
	widget_set_resize_handler(smoke.widget, resize_handler);
	widget_set_redraw_handler(smoke.widget, redraw_handler);

	window_set_user_data(smoke.window, &smoke);

	widget_schedule_resize(smoke.widget, smoke.width, smoke.height);

	display_run(d);

	widget_destroy(smoke.widget);
	window_destroy(smoke.window);
	display_destroy(d);

	return 0;
}
Exemple #9
0
void handle_deinit(void) {
  tick_timer_service_unsubscribe();

  layer_destroy(triangle_overlay_layer);
  layer_destroy(s_hands_layer);
  
  bluetooth_connection_service_unsubscribe();
  battery_state_service_unsubscribe();
  app_focus_service_unsubscribe();
  
  fonts_unload_custom_font(fontRobotoCondensed19);
  
  window_destroy(window);
}
Exemple #10
0
static void destroy_ui(void) {
  window_destroy(s_window);
  layer_destroy(sCalendarLayer);
  text_layer_destroy(sTimeLayer);
  text_layer_destroy(sDateLayer);
  text_layer_destroy(sDayLayer);
  bitmap_layer_destroy(sBatteryLayer);
  bitmap_layer_destroy(sBluetoothLayer);
  bitmap_layer_destroy(sChargingLayer);
  fonts_unload_custom_font(s_res_futura_condensed_48);
  gbitmap_destroy(s_res_battery_0);
  gbitmap_destroy(s_res_bluetooth);
  gbitmap_destroy(s_res_empty);
}
Exemple #11
0
// Terminate the program
static void prv_terminate(void) {
  // unsubscribe from timer service
  tick_timer_service_unsubscribe();
  // schedule wakeup
  if (!timer_is_chrono() && !timer_is_paused()) {
    time_t wakeup_time = (epoch() + timer_get_value_ms()) / MSEC_IN_SEC;
    wakeup_schedule(wakeup_time, 0, true);
  }
  // destroy
  timer_persist_store();
  drawing_terminate();
  layer_destroy(main_data.layer);
  window_destroy(main_data.window);
}
Exemple #12
0
void destroy_chrono_objects() {
  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "destroy_chrono_objects");

  if (chrono_digital_window != NULL) {
    window_destroy(chrono_digital_window);
    chrono_digital_window = NULL;
  }

  hand_cache_destroy(&chrono_minute_cache);
  hand_cache_destroy(&chrono_second_cache);
  hand_cache_destroy(&chrono_tenth_cache);

  bwd_destroy(&chrono_dial_white);
}
/** Load a savegame directly from the startup window. */
void
misc_callback_startup_load(const gchar *filename)
{
#ifdef DEBUG
    printf("misc_callback_startup_load\n");
#endif

    gtk_widget_hide(window.splash);

    if(load_save_load_game(filename, TRUE))
	window_destroy(&window.splash);
    else
	gtk_widget_show(window.splash);
}
Exemple #14
0
static void destroy_ui(void) {
  
  int nresult = ((s_time[0]-'0')*100)  + ((s_time[2]-'0')*10) + (s_time[3]-'0');
  persist_write_int(s_key, nresult);
  
  app_timer_cancel(s_AppTimer);
  window_destroy(s_window);
  text_layer_destroy(s_textlayer_title);
  text_layer_destroy(s_textlayer_subtitle);
  text_layer_destroy(s_textlayer_time);
  text_layer_destroy(s_textlayer_desc);
  text_layer_destroy(s_textlayer_destination);
  layer_destroy(s_hilite);
}
Exemple #15
0
static void destroy_ui() {
  window_destroy(s_window);
  gbitmap_destroy(s_icon_vol_up);
  gbitmap_destroy(s_icon_pause);
  gbitmap_destroy(s_icon_play);
  gbitmap_destroy(s_icon_vol_dn);
  gbitmap_destroy(s_icon_speaker);
  layer_destroy(s_lyr_background);
  action_bar_layer_destroy(s_action_bar);
  text_layer_destroy(s_txt_title);
  text_layer_destroy(s_txt_artist);
  bitmap_layer_destroy(s_bmp_speaker);
  layer_destroy(s_lyr_volume);
}
Exemple #16
0
static void destroy_ui(void) {
  window_destroy(s_window);
  layer_destroy(s_fibo_layer);
  layer_destroy(s_arc5x5_layer);
  layer_destroy(s_arc3x3_layer);
  layer_destroy(s_arc2x2_layer);
  layer_destroy(s_arc1x1L_layer);
  layer_destroy(s_arc1x1R_layer);
  layer_destroy(s_charge_layer);
  layer_destroy(s_bluetooth_layer);
  text_layer_destroy(s_time_layer);
  text_layer_destroy(s_date_layer);
  text_layer_destroy(s_week_layer);
}
void handle_deinit(void) {
	// Destroy the text layers
	text_layer_destroy(time_layer);
	text_layer_destroy(date_layer);
	text_layer_destroy(info_layer);
	text_layer_destroy(year_layer);
	layer_destroy(line_layer);
	
	// Unsubsribe from tick timer
	tick_timer_service_unsubscribe();
	
	// Destroy the window
	window_destroy(window);
}
Exemple #18
0
static void
demoapp_destroy(struct demoapp *app)
{
	if (app->triangle)
		triangle_destroy(app->triangle);

	if (app->egl)
		egl_state_destroy(app->egl);

	widget_destroy(app->subsurface);
	widget_destroy(app->widget);
	window_destroy(app->window);
	free(app);
}
Exemple #19
0
void handle_deinit(void) 
{
	layer_remove_from_parent(bitmap_layer_get_layer(leafs_layer));
  	bitmap_layer_destroy(leafs_layer);
 	gbitmap_destroy(leafs);
	
	tick_timer_service_unsubscribe();
	
	layer_destroy(text_layer_get_layer(text_time_layer));
	layer_destroy(text_layer_get_layer(text_date_layer));
	layer_destroy(text_layer_get_layer(text_score_layer));
	
	window_destroy(window);
}
Exemple #20
0
gchar *return_color(gchar *start_value) {
	Tcolsel *csd;
	gchar *return_text;

	csd = colsel_dialog(NULL,start_value, 1, 0, 0);
	DEBUG_MSG("return color, started\n");
	gtk_grab_add(csd->win);
	gtk_main();

	return_text = g_strdup(csd->returnval);
	window_destroy(csd->win);
	DEBUG_MSG("return_color, the new gtk_main stopped, return_text=%s, %p\n", return_text, return_text);
	return return_text;
}
Exemple #21
0
static void deinit() {
    for (int i = 0; i < TOTAL_IMAGE_SLOTS; i++) {
        unload_digit_image_from_slot(i);
    }    
    window_destroy(window);
	// Destroy inverter if last screen was inverted
	if (!(was_BTconnected_last_time))  {
		inverter_layer_destroy(inv_layer);
	}
	qtp_app_deinit();
	tick_timer_service_unsubscribe();
	bluetooth_connection_service_unsubscribe();
//	battery_state_service_unsubscribe();	
}
static void prv_window_unload(Window *window) {
  GoalStarGoalEventWindowData *data = window_get_user_data(window);

  if (data) {
    if (data->goal_reached_sequence_timer) {
      app_timer_cancel(data->goal_reached_sequence_timer);
    }
    layer_destroy(data->goal_reached_sequence_layer);
    gdraw_command_sequence_destroy(data->goal_reached_sequence);
    window_destroy(data->window);
  }

  free(data);
}
Exemple #23
0
static void destroy_ui(void) {
  window_destroy(s_window);
  text_layer_destroy(s_textlayer_time);
  text_layer_destroy(s_textlayer_date);
  bitmap_layer_destroy(s_condition_day1);
  bitmap_layer_destroy(s_condition_day2);
  bitmap_layer_destroy(s_condition_day3);
  bitmap_layer_destroy(s_bitmaplayer_4);
  bitmap_layer_destroy(s_bitmaplayer_1);
  text_layer_destroy(s_textlayer_day3);
  text_layer_destroy(s_textlayer_day2);
  gbitmap_destroy(s_res_image_01d);
  gbitmap_destroy(s_res_image_02d);
  gbitmap_destroy(s_res_image_03d);
}
Exemple #24
0
void handle_deinit(void) {
	// Destroy the text layer
  text_layer_destroy(hour_layer);
  text_layer_destroy(date_layer);
  text_layer_destroy(day_layer);
  bitmap_layer_destroy(bluetooth_layer);
  text_layer_destroy(battery_layer);
  
  inverter_layer_destroy(i_date_layer);
	
	// Destroy the window
	window_destroy(window);
  bluetooth_connection_service_unsubscribe();
  battery_state_service_unsubscribe();
}
Exemple #25
0
/* Should be called when a button that creates filters is destroyed; it
   destroys any filter dialog created by that button. */
void
filter_button_destroy_cb(GtkWidget *button, gpointer user_data _U_)
{
    GtkWidget *filter_w;

    /* Is there a filter edit/selection dialog associated with this
       button? */
    filter_w = (GtkWidget *)g_object_get_data(G_OBJECT(button), E_FILT_DIALOG_PTR_KEY);

    if (filter_w != NULL) {
        /* Yes.  Break the association, and destroy the dialog. */
        g_object_set_data(G_OBJECT(button), E_FILT_DIALOG_PTR_KEY, NULL);
        window_destroy(filter_w);
    }
}
Exemple #26
0
static void
close_handler(struct window *window, void *data)
{
	struct image *image = data;

	*image->image_counter -= 1;

	if (*image->image_counter == 0)
		display_exit(image->display);

	widget_destroy(image->widget);
	window_destroy(image->window);

	free(image);
}
Exemple #27
0
void gui_windows_deinit(void)
{
	g_source_remove(linecache_tag);

	while (windows != NULL)
		window_destroy(windows->data);

	signal_remove("gui window create override", (SIGNAL_FUNC) sig_window_create_override);
	signal_remove("window created", (SIGNAL_FUNC) gui_window_created);
	signal_remove("window destroyed", (SIGNAL_FUNC) gui_window_destroyed);
	signal_remove("window changed", (SIGNAL_FUNC) signal_window_changed);
	signal_remove("window item changed", (SIGNAL_FUNC) signal_window_item_update);
	signal_remove("window name changed", (SIGNAL_FUNC) signal_window_item_update);
	signal_remove("window item remove", (SIGNAL_FUNC) signal_window_item_update);
}
Exemple #28
0
void
capture_prefs_destroy(GtkWidget *w)
{
	GtkWidget *caller = gtk_widget_get_toplevel(w);
	GtkWidget *dlg;

	/* Is there an interface descriptions dialog associated with this
	   Preferences dialog? */
	dlg = g_object_get_data(G_OBJECT(caller), IFOPTS_DIALOG_PTR_KEY);

	if (dlg != NULL) {
		/* Yes.  Destroy it. */
		window_destroy(dlg);
	}
}
Exemple #29
0
static void window_unload(Window *window) {
  text_layer_destroy(s_brackets_layer);
  text_layer_destroy(s_date_layer);
  text_layer_destroy(s_time_layer);
  text_layer_destroy(s_battery_layer);

  layer_destroy(s_dashes_layer);

  for (size_t i = 0; i < ARRAY_LENGTH(s_fonts); i++) {
    fonts_unload_custom_font(s_fonts[i]);
  }

  window_destroy(s_window);
  s_window = NULL;
}
Exemple #30
0
static void deinit(void) {
	layer_destroy(display_layer);
	text_layer_destroy(date_layer);
	text_layer_destroy(percent_layer);
	bitmap_layer_destroy(battery_layer);
	bitmap_layer_destroy(charge_layer);
	inverter_layer_destroy(battfill_layer);
	fonts_unload_custom_font(font);
	fonts_unload_custom_font(font_tiny);
	gbitmap_destroy(battery_outline);
	gbitmap_destroy(battery_charge);
	tick_timer_service_unsubscribe();
	battery_state_service_unsubscribe();
	window_destroy(window);
}