Example #1
0
static void refresh_pbar1(void)
{
  gchar buffer[32];
  gfloat rate;

  info_update.percentage = (float) info_update.count / info_update.total;

  if(p_win.pbar1 != NULL)
    {
    info_update.percentage = (float) info_update.count / info_update.total;

      /* Refresh if necessary (for speeding up !) */
      if( (info_update.percentage - info_update.prev_percentage) < 0.05)
	{
	  if( (info_update.percentage - info_update.prev_percentage) < 0)
	    info_update.prev_percentage = info_update.percentage;
      else
	    return;
	}
      else
	info_update.prev_percentage = info_update.percentage;

      rate = dr->count / toCURRENT(dr->start);
      g_snprintf(buffer, 32, "Rate: %1.1f Kbytes/s", rate / 1000);
      gtk_label_set_text(GTK_LABEL(p_win.label_rate), buffer);
      gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(p_win.pbar1), info_update.percentage);
      
      GTK_REFRESH();
    }
}
Example #2
0
void fs_send_file(const gchar *filename)
{
	int err;

	// set pbar title
	if(tifiles_file_is_flash(filename)) 
	{
		create_pbar_(FNCT_SEND_APP, _("Sending app(s)"));
	} 
	else if(tifiles_file_is_group(filename)) 
	{
		create_pbar_(FNCT_SEND_VAR, _("Sending var(s)"));
	} 
	else if(tifiles_file_is_backup(filename)) 
	{
		create_pbar_(FNCT_SEND_BACKUP, _("Restoring"));
	} 
	else if(tifiles_file_is_single(filename)) 
	{
		create_pbar_(FNCT_SEND_VAR, _("Sending var(s)"));
	}
	else if(tifiles_file_is_tigroup(filename))
	{
		create_pbar_type5(_("Restoring"));
	}

	// note that core is currently not bkpt-interruptible when
	// transferring file
	GTK_REFRESH();
	err = ti68k_linkport_send_file(filename);
	handle_error();
	destroy_pbar();	
}
Example #3
0
static void refresh_pbar1(void)
{
	gchar buffer[32];
	gfloat rate, avg;
  
	if (p_win.pbar1 != NULL) 
	{
		if(calc_update.cnt1 > calc_update.max1)
			calc_update.cnt1 = calc_update.max1;

		if(calc_update.max1 != 0)
			gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(p_win.pbar1), 
				(gdouble)calc_update.cnt1 / calc_update.max1);

		if(p_win.label_rate != NULL)
		{
			rate = calc_update.rate;
			filter_shift();
			avg = filter_compute(rate);

			g_snprintf(buffer, 32, "Rate: %1.1f Kbytes/s", avg);
			gtk_label_set_text(GTK_LABEL(p_win.label_rate), buffer);
		}
		GTK_REFRESH();
	}
}
Example #4
0
static void gt_label(void)
{
  if(p_win.label == NULL) return;
  gtk_label_set_text(GTK_LABEL(p_win.label), info_update.label_text);
  
  GTK_REFRESH();
}
Example #5
0
/* Splash Screen Initialization Function */
void splash_screen_start(void)
{
    GtkWidget *image, *vbox, *ver_lbl;
    GdkColor color;
    GdkPixbuf *pixbuf;
    gchar *version_string;

    // Is Splash Screen started?
    if (splashscreen.enabled == 1)
        return;

    // Make the Splash Screen
     splashscreen.splash = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title(GTK_WINDOW(splashscreen.splash), "GFM Loading...");
     gtk_window_set_position(GTK_WINDOW(splashscreen.splash), GTK_WIN_POS_CENTER_ALWAYS);
     gtk_window_set_decorated(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_role(GTK_WINDOW(splashscreen.splash), "splash");
     gtk_window_set_resizable(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_default_size(GTK_WINDOW(splashscreen.splash), 150, 110); // 150x110 pixels

     // Set the Colors
     color.red = 65535;
     color.green = 65535;
     color.blue = 65535;
     gtk_widget_modify_bg(splashscreen.splash, GTK_STATE_NORMAL, &color);

     // Create a VBOX
     vbox = gtk_vbox_new(FALSE, 0);
     gtk_container_add(GTK_CONTAINER(splashscreen.splash), vbox);
     gtk_widget_show(vbox);

     // Set the Text Label
     splashscreen.text = gtk_label_new(_("Starting Group File Manager..."));
     gtk_box_pack_end(GTK_BOX(vbox), splashscreen.text, FALSE, FALSE, 0);
     gtk_widget_show(splashscreen.text);

     // Set the Version
     version_string = g_strconcat("Version ", GFM_VERSION, NULL);
     ver_lbl = gtk_label_new(version_string);
     gtk_box_pack_end(GTK_BOX(vbox), ver_lbl, FALSE, FALSE, 0);
     gtk_widget_show(ver_lbl);
     g_free(version_string);

     // Setup the Splash Logo
     pixbuf = create_pixbuf("gfm.xpm");
     image = gtk_image_new_from_pixbuf(pixbuf);
     gtk_box_pack_end(GTK_BOX(vbox), image, FALSE, FALSE, 0);
     g_object_unref(pixbuf);

     // Lets show the Splash Screen now
     gtk_widget_show(image);
     gtk_widget_show(splashscreen.splash);

     // Lets Make sure this works
     GTK_REFRESH(); // Defintion in support.h

     // Ok, done
     splashscreen.enabled = 1;
     return;
}
Example #6
0
// note: info_update.label_text is encoded in UTF8 but variable names ('%s')
// are encoded according to tifiles_translate_set_encoding().
// This should be treated here but given that encoding is set to UTF8, there
// is nothing to do...
static void gtk_label(void)
{
#ifndef DISABLE_UPDATE
	if (pbar_wnd.label == NULL)
		return;

	gtk_label_set_text(GTK_LABEL(pbar_wnd.label), gtk_update.text);

	GTK_REFRESH();
#endif
}
Example #7
0
static void refresh_pbar3(void)
{
	gchar buffer[32];

	if(pbar_wnd.label_part != NULL)
	{
		g_snprintf(buffer, 32, "%i/%i: ", gtk_update.cnt3, gtk_update.max3);
		gtk_label_set_text(GTK_LABEL(pbar_wnd.label_part), buffer);

		GTK_REFRESH();
	}
}
Example #8
0
static void refresh_pbar3(void)
{
	if(p_win.label_part != NULL)
	{
		gchar *str;

		str = g_strdup_printf("%i/%i: ", calc_update.cnt3, calc_update.max3);
		gtk_label_set_text(GTK_LABEL(p_win.label_part), str);

		GTK_REFRESH();
	}
}
Example #9
0
static void refresh_pbar2(void)
{
	if (pbar_wnd.pbar2 != NULL) 
	{
		if(gtk_update.cnt2 > gtk_update.max2)
			gtk_update.cnt2 = gtk_update.max2;

		if(gtk_update.max2 != 0)
			gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar_wnd.pbar2), 
				(gdouble)gtk_update.cnt2 / gtk_update.max2);

		GTK_REFRESH();
	}
}
Example #10
0
static void refresh_pbar2(void)
{
	if (p_win.pbar2 != NULL) 
	{
		if(calc_update.cnt2 > calc_update.max2)
			calc_update.cnt2 = calc_update.max2;

		if(calc_update.max2 != 0)
			gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(p_win.pbar2), 
				(gdouble)calc_update.cnt2 / calc_update.max2);

		GTK_REFRESH();
	}
}
Example #11
0
/* Set new Splash Screen Text */
int splash_screen_message(char *message)
{
    // Enabled?
    if (!splashscreen.enabled)
        return -1;

    // Update Label
    gtk_label_set_text(GTK_LABEL(splashscreen.text), (gchar *)message);

    // Refresh GTK+
    GTK_REFRESH();
		
		// Return
    return 0;
}
Example #12
0
static void refresh_pbar2(void)
{
  if(p_win.pbar2 != NULL)
    {
      /* Refresh if necessary (for speeding up !) */
      if( (info_update.main_percentage - info_update.prev_main_percentage) 
	  < 0.05)
	return;
      else
	info_update.prev_main_percentage = info_update.main_percentage;
      
      gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(p_win.pbar2), info_update.main_percentage);
      
      GTK_REFRESH();
    }
}
Example #13
0
// Used for sending vars
// Note: user_data is a string:
// - such as "<FLASH>" for sending var into FLASH (ti83+/84+/89/92+/v200)
// - such as "" for sending var in the default folder
// - such as "foo" for sending var in the 'foo' folder
// - unused for sending FLASH files
void on_tilp_send(const gchar *user_data)
{
	gchar *target;
	FileEntry *f;
	int ret1 = -1;
	int ret2 = -1;

	if (local.selection0 == NULL && local.selection2 == NULL && local.selection5 == NULL)
		return;

	tilp_local_contents_load();
	
	// send apps
	if(local.selection3 || (local.selection5 && local.selection3))
	{
		f = (FileEntry *) local.selection3->data;

		// send os upgrades
		if(tifiles_file_is_flash(f->name) || tifiles_file_is_tigroup(f->name)) 
		{
			if(tifiles_file_test(f->name, TIFILE_OS, options.calc_model))
			{
				if (tilp_calc_send_os(f->name) != 0)
					return;
			} 
			else if(tifiles_file_is_app(f->name))
			{
				ret1 = tilp_calc_send_app();
				if(!ret1)
				{
					// update dirlist (caching, avoid to request dirlist again)
					tilp_local_update_applist();
					ctree_refresh();
					labels_refresh();
				}
			}
		} 
	}

	// send vars
	if(local.selection1 || (local.selection5 && local.selection1))
	{
		// note: dst_folder must be a copy b/c the user_data
		// pointer is no longer valid after dirlist_remote
		target = g_strdup(user_data);

		// change target folder
		if(strcmp(target, "") && strcmp(target, "<FLASH>"))
			tilp_local_change_folder(target);

		// and wait for action
		if (display_action_dbox(target) == BUTTON2) 
		{
			g_free(target);
			tilp_local_contents_unload();
			return;
		}

		// needed: avoid box locking/flickering !
		GTK_REFRESH();

		ret2 = tilp_calc_send_var();
		if(!ret2)
		{
			// update dirlist (caching, avoid to request dirlist again)
			tilp_local_update_varlist();
			ctree_refresh();
			labels_refresh();
		}

		g_free(target);
	}

	tilp_local_contents_unload();
}
Example #14
0
static void gtk_refresh(void)
{
#ifndef DISABLE_UPDATE
	GTK_REFRESH();
#endif
}
Example #15
0
gint display_send_files_dbox()
{
	const gchar *ext;
	gchar **filenames, **ptr;
	int err;
	static gchar *folder = NULL;

	// Check for null cable
	if(link_cable.link_type != LINK_NUL)
	{
		tiemu_error(0, "You can't use direct file loading when a cable is set. Change cable to 'null' in the Link Options menu item.");
		return -1;
	}

    // set mask
    switch(tihw.calc_type) 
	{
    case TI92:
        ext = "*.92?";
		break;
	default:
        ext = "*.89?;*.92?;*.9x?;*.9X?;*.v2?;*.V2?";
        break;
    }

	// get filename
	if(folder == NULL)
		folder = g_strdup(inst_paths.base_dir);

	filenames = create_fsels(folder, NULL, (char *)ext);
	if(!filenames)
		return 0;

	// keep folder
	g_free(folder);
	folder = g_path_get_dirname(filenames[0]);

    // check extension
	for(ptr = filenames; *ptr; ptr++)
	{
		if(!tifiles_is_a_ti_file(*ptr) || !tifiles_is_ti9x(tifiles_which_calc_type(*ptr))) 
		{
			msg_box(_("Error"), _("This file is not a valid TI file."));
			g_strfreev(filenames);
			return -1;
		}

		// set pbar title
#if 1
		if(tifiles_is_a_tib_file(*ptr) || tifiles_is_a_flash_file(*ptr)) 
		{
			create_pbar_type5(_("Flash"), "");
		} 
		else if(tifiles_is_a_backup_file(*ptr)) 
		{
			create_pbar_type3(_("Backup"));
		} 
		else if(tifiles_is_a_group_file(*ptr)) 
		{
			create_pbar_type5(_("Sending group file"), "");
		} 
		else if(tifiles_is_a_single_file(*ptr)) 
		{
			create_pbar_type4(_("Sending variable"), "");
		}
#endif

		// note that core is currently not bkpt-interruptible when
		// transferring file
		GTK_REFRESH();
		err = ti68k_linkport_send_file(*ptr);
		handle_error();
		destroy_pbar();	
	}

	g_strfreev(filenames);
	return 0;
}
Example #16
0
static void gt_refresh(void)
{
	GTK_REFRESH();
}