Author: rjek
Date: Mon Aug 14 23:13:02 2006
New Revision: 2844
URL:
http://svn.semichrome.net?rev=2844&view=rev
Log:
Working throbber in glade branch of nsgtk
Added:
branches/rjek/glade/gtk/throbber.gif (with props)
Modified:
branches/rjek/glade/gtk/gtk_gui.c
branches/rjek/glade/gtk/gtk_throbber.c
branches/rjek/glade/gtk/gtk_throbber.h
branches/rjek/glade/gtk/gtk_window.c
branches/rjek/glade/gtk/netsurf.glade
Modified: branches/rjek/glade/gtk/gtk_gui.c
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_gui.c?rev=2844&...
==============================================================================
--- branches/rjek/glade/gtk/gtk_gui.c (original)
+++ branches/rjek/glade/gtk/gtk_gui.c Mon Aug 14 23:13:02 2006
@@ -27,6 +27,7 @@
#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/options.h"
#include "netsurf/gtk/gtk_gui.h"
+#include "netsurf/gtk/gtk_throbber.h"
#include "netsurf/render/box.h"
#include "netsurf/render/form.h"
#include "netsurf/render/html.h"
@@ -98,6 +99,8 @@
char buf[PATH_MAX];
gtk_init(&argc, &argv);
+
+ nsgtk_throbber_initialise("./gtk/throbber.gif");
gladeWindows = glade_xml_new("./gtk/netsurf.glade", NULL, NULL);
wndChoices = glade_xml_get_widget(gladeWindows, "wndChoices");
Modified: branches/rjek/glade/gtk/gtk_throbber.c
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_throbber.c?rev=2844...
==============================================================================
--- branches/rjek/glade/gtk/gtk_throbber.c (original)
+++ branches/rjek/glade/gtk/gtk_throbber.c Mon Aug 14 23:13:02 2006
@@ -11,7 +11,7 @@
#include "netsurf/image/gifread.h"
#include "netsurf/gtk/gtk_throbber.h"
-struct nsgtk_throbber *nsgtk_throbber;
+struct nsgtk_throbber *nsgtk_throbber = NULL;
bool nsgtk_throbber_initialise(const char *fn)
{
@@ -31,7 +31,6 @@
gif = (struct gif_animation *)malloc(sizeof(struct gif_animation));
throb = (struct nsgtk_throbber *)malloc(sizeof(struct nsgtk_throbber));
- nsgtk_throbber = throb;
/* discover the size of the data file. */
fseek(fh, 0, SEEK_END);
@@ -113,5 +112,19 @@
}
*/
+ nsgtk_throbber = throb;
+
return true;
}
+
+void nsgtk_throbber_finalise(void)
+{
+ int i;
+
+ for (i = 0; i < nsgtk_throbber->nframes; i++)
+ gdk_pixbuf_unref(nsgtk_throbber->framedata[i]);
+
+ free(nsgtk_throbber);
+
+ nsgtk_throbber = NULL;
+}
Modified: branches/rjek/glade/gtk/gtk_throbber.h
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_throbber.h?rev=2844...
==============================================================================
--- branches/rjek/glade/gtk/gtk_throbber.h (original)
+++ branches/rjek/glade/gtk/gtk_throbber.h Mon Aug 14 23:13:02 2006
@@ -19,5 +19,6 @@
extern struct nsgtk_throbber *nsgtk_throbber;
bool nsgtk_throbber_initialise(const char *fn);
+void nsgtk_throbber_finalise(void);
#endif /* __GTK_THROBBER_H__ */
Modified: branches/rjek/glade/gtk/gtk_window.c
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_window.c?rev=2844&a...
==============================================================================
--- branches/rjek/glade/gtk/gtk_window.c (original)
+++ branches/rjek/glade/gtk/gtk_window.c Mon Aug 14 23:13:02 2006
@@ -24,6 +24,7 @@
#include "netsurf/gtk/gtk_gui.h"
#include "netsurf/gtk/gtk_plotters.h"
#include "netsurf/gtk/gtk_window.h"
+#include "netsurf/gtk/gtk_throbber.h"
#include "netsurf/render/box.h"
#include "netsurf/render/font.h"
#include "netsurf/render/form.h"
@@ -46,6 +47,7 @@
GtkMenuItem *forward_menu;
GtkMenuItem *stop_menu;
GtkMenuItem *reload_menu;
+ GtkImage *throbber;
GladeXML *xml;
@@ -54,6 +56,7 @@
int target_width, target_height;
int caretx, carety, careth;
gui_pointer_shape current_pointer;
+ int throb_frame;
struct gtk_history_window *history_window;
@@ -96,8 +99,9 @@
static gboolean nsgtk_window_size_allocate_event(GtkWidget *, GtkAllocation *,
gpointer);
-static void nsgtk_perform_deferred_resize(void *p);
+static void nsgtk_perform_deferred_resize(void *);
static void nsgtk_window_update_back_forward(struct gui_window *);
+static void nsgtk_throb(void *);
static gboolean nsgtk_window_back_button_clicked(GtkWidget *, gpointer);
static gboolean nsgtk_window_forward_button_clicked(GtkWidget *, gpointer);
@@ -398,6 +402,20 @@
gtk_widget_queue_draw(GTK_WIDGET(g->history_window->drawing_area));
}
+void nsgtk_throb(void *p)
+{
+ struct gui_window *g = p;
+
+ if (g->throb_frame >= (nsgtk_throbber->nframes - 1))
+ g->throb_frame = 1;
+ else
+ g->throb_frame++;
+
+ gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[
+ g->throb_frame]);
+
+ schedule(10, nsgtk_throb, p);
+}
/* signal handling functions for the toolbar and URL bar */
gboolean nsgtk_window_back_button_clicked(GtkWidget *widget, gpointer data)
@@ -656,6 +674,7 @@
g->forward_menu = GTK_MENU_ITEM(GET_WIDGET("forward"));
g->stop_menu = GTK_MENU_ITEM(GET_WIDGET("stop"));
g->reload_menu = GTK_MENU_ITEM(GET_WIDGET("reload"));
+ g->throbber = GTK_IMAGE(GET_WIDGET("throbber"));
/* connect our scrollbars to the viewport */
gtk_viewport_set_hadjustment(GTK_VIEWPORT(GET_WIDGET("viewport1")),
@@ -722,6 +741,10 @@
gtk_scrolled_window_add_with_viewport(g->history_window->scrolled,
GTK_WIDGET(g->history_window->drawing_area));
gtk_widget_show(GTK_WIDGET(g->history_window->drawing_area));
+
+ /* set up the throbber. */
+ gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[0]);
+ g->throb_frame = 0;
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
@@ -953,6 +976,8 @@
gtk_widget_set_sensitive(GTK_WIDGET(g->reload_button), FALSE);
nsgtk_window_update_back_forward(g);
+
+ schedule(10, nsgtk_throb, g);
}
void gui_window_stop_throbber(struct gui_window* g)
@@ -963,6 +988,10 @@
gtk_widget_set_sensitive(GTK_WIDGET(g->reload_menu), TRUE);
nsgtk_window_update_back_forward(g);
+
+ schedule_remove(nsgtk_throb, g);
+
+ gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[0]);
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
Modified: branches/rjek/glade/gtk/netsurf.glade
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/netsurf.glade?rev=2844&...
==============================================================================
--- branches/rjek/glade/gtk/netsurf.glade (original)
+++ branches/rjek/glade/gtk/netsurf.glade Mon Aug 14 23:13:02 2006
@@ -4171,13 +4171,13 @@
<property name="is_important">False</property>
<child>
- <widget class="GtkImage" id="throbble">
+ <widget class="GtkImage" id="throbber">
<property name="visible">True</property>
<property name="icon_size">4</property>
<property name="icon_name">gtk-yes</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
- <property name="xpad">0</property>
+ <property name="xpad">2</property>
<property name="ypad">0</property>
</widget>
</child>
Added: branches/rjek/glade/gtk/throbber.gif
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/throbber.gif?rev=2844&a...
==============================================================================
Binary file - no diff available.
Propchange: branches/rjek/glade/gtk/throbber.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream