cleanup status bar code: convert pStatusBar_Change from macro to function, convert pStatusBar_Ctx from global to local

This commit is contained in:
riccardom 2009-01-03 21:10:56 +00:00
parent 0a351b29db
commit fc31ff0d29
1 changed files with 10 additions and 7 deletions

View File

@ -333,8 +333,14 @@ float nds_screen_size_ratio = 1.0f;
static BOOL regMainLoop = FALSE; static BOOL regMainLoop = FALSE;
static gint pStatusBar_Ctx; static inline void pStatusBar_Change (const char *message)
#define pStatusBar_Change(t) gtk_statusbar_pop(GTK_STATUSBAR(pStatusBar), pStatusBar_Ctx); gtk_statusbar_push(GTK_STATUSBAR(pStatusBar), pStatusBar_Ctx, t) {
gint pStatusBar_Ctx;
pStatusBar_Ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(pStatusBar), "Global");
gtk_statusbar_pop(GTK_STATUSBAR(pStatusBar), pStatusBar_Ctx);
gtk_statusbar_push(GTK_STATUSBAR(pStatusBar), pStatusBar_Ctx, message);
}
gboolean EmuLoop(gpointer data); gboolean EmuLoop(gpointer data);
@ -1599,6 +1605,7 @@ common_gtk_main( struct configured_features *my_config)
GtkAccelGroup * accel_group; GtkAccelGroup * accel_group;
GtkWidget *pVBox; GtkWidget *pVBox;
GtkWidget *pMenuBar; GtkWidget *pMenuBar;
gint pStatusBar_Ctx;
#ifdef GTKGLEXT_AVAILABLE #ifdef GTKGLEXT_AVAILABLE
GdkGLConfig *glconfig; GdkGLConfig *glconfig;
@ -1846,14 +1853,10 @@ common_gtk_main( struct configured_features *my_config)
nds_screen_widget = pDrawingArea; nds_screen_widget = pDrawingArea;
} }
/* Création de la barre d'état */ /* Status bar */
pStatusBar = gtk_statusbar_new(); pStatusBar = gtk_statusbar_new();
pStatusBar_Ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(pStatusBar), "Global"); pStatusBar_Ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(pStatusBar), "Global");
pStatusBar_Change("Desmume"); pStatusBar_Change("Desmume");
gtk_box_pack_end(GTK_BOX(pVBox), pStatusBar, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(pVBox), pStatusBar, FALSE, FALSE, 0);
gtk_widget_show_all(pWindow); gtk_widget_show_all(pWindow);