/usr/share/help/gl/gnome-devel-demos/progressbar.c.page is in gnome-devel-docs 3.28.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | <?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="progressbar.c" xml:lang="gl">
<info>
<title type="text">ProgressBar (C)</title>
<link type="guide" xref="c#display-widgets"/>
<link type="seealso" xref="spinner.c"/>
<revision version="0.1" date="2012-06-16" status="draft"/>
<credit type="author copyright">
<name>Monica Kochofar</name>
<email its:translate="no">monicakochofar@gmail.com</email>
<years>2012</years>
</credit>
<desc>A widget which indicates progress visually</desc>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Fran Dieguez</mal:name>
<mal:email>frandieguez@gnome.org</mal:email>
<mal:years>2012-2013.</mal:years>
</mal:credit>
</info>
<title>ProgressBar</title>
<media type="video" mime="application/ogv" src="media/progressbar_fill.ogv"/>
<p>This ProgressBar "fills in" by a fraction of the bar until it is full.</p>
<code mime="text/x-csrc" style="numbered">
#include <gtk/gtk.h>
static gboolean
fill (gpointer user_data)
{
GtkWidget *progress_bar = user_data;
/*Get the current progress*/
gdouble fraction;
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
/*Increase the bar by 10% each time this function is called*/
fraction += 0.1;
/*Fill in the bar with the new fraction*/
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
/*Ensures that the fraction stays below 1.0*/
if (fraction < 1.0)
return TRUE;
return FALSE;
}
static void
activate (GtkApplication *app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *progress_bar;
gdouble fraction = 0.0;
/*Create a window with a title, and a default size*/
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "ProgressBar Example");
gtk_window_set_default_size (GTK_WINDOW (window), 220, 20);
/*Create a progressbar and add it to the window*/
progress_bar = gtk_progress_bar_new ();
gtk_container_add (GTK_CONTAINER (window), progress_bar);
/*Fill in the given fraction of the bar. Has to be between 0.0-1.0 inclusive*/
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
/*Use the created fill function every 500 milliseconds*/
g_timeout_add (500, fill, GTK_PROGRESS_BAR (progress_bar));
gtk_widget_show_all (window);
}
int
main (int argc, char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
</code>
<p>Neste exemplo empregaremos o seguinte:</p>
<list>
<item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html">GtkApplication</link></p></item>
<item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkWindow.html">GtkWindow</link></p></item>
<item><p><link href="http://developer.gnome.org/gtk3/stable/GtkProgressBar.html">GtkProgressBar</link></p></item>
<item><p><link href="http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-timeout-add">G_Timeout</link></p></item>
</list>
</page>
|