早上好,我目前正在编写一个 GTK+3.0 应用程序,我正在笔记本中显示日历,并且显示正常,但我需要用西班牙语显示月份的 3 个字母缩写。我已经查看了 Pango Docs,但没有资助任何有用的东西,任何帮助将不胜感激。提前致谢。
代码如下:
#include <gtk/gtk.h>
static void destroy (GtkWidget*, gpointer) ;
static gboolean delete_event (GtkWidget*, GdkEvent*, gpointer) ;
static void switch_page(GtkButton*, GtkNotebook*) ;
int main(int argc, char *argv[])
{
GtkWidget *window, *label, *notebook ;
GtkWidget *label1, *label2, *label3, *label4, *label5, *registro, *calendario, *child3, *child4, *child5 ;
GtkWidget *calendar ;
/* Initialize GTK+ and all its supporting libraries */
gtk_init (&argc, &argv) ;
/* Create a new window , give it a title and display it to the user */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL) ;
gtk_window_set_title(GTK_WINDOW(window), "SVNT Sistema de Vizualizacion de eventos de red");
gtk_container_set_border_width (GTK_CONTAINER (window), 10) ;
gtk_widget_set_size_request(window, 1024,600);
/* Notebook definition */
notebook = gtk_notebook_new() ;
label1 = gtk_label_new ("Registro de Fallecidos") ;
label2 = gtk_label_new ("Calendario") ;
label3 = gtk_label_new ("Contabilidad") ;
label4 = gtk_label_new ("Estadisticas") ;
label5 = gtk_label_new ("Utiles") ;
registro = gtk_label_new ("Aqui se mostrara un formulario para registrar los eventos de red") ;
calendario = gtk_calendar_new () ;
child3 = gtk_label_new ("En esta seccion se llevaran los gastos y las donaciones") ;
child4 = gtk_label_new ("Muestra de Estadisticas ") ;
child5 = gtk_label_new ("Salvas de la base de Datos") ;
/* signal handling*/
/* Connect the main window to the destroy and delete_event signals */
g_signal_connect(G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
g_signal_connect(G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL);
/* notebook signals , note the two tabs are connected to the same signal */
g_signal_connect(G_OBJECT(registro), "clicked", G_CALLBACK(switch_page),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(calendario), "clicked", G_CALLBACK(switch_page),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child3), "clicked", G_CALLBACK(switch_page),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child4), "clicked", G_CALLBACK(switch_page),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child5), "clicked", G_CALLBACK(switch_page),(gpointer)notebook) ;
/*Append to pages in notebook container*/
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), registro, label1) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), calendario, label2) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child3, label3) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child4, label4) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child5, label5) ;
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
/* Create a new GtkLabel widget that is selectable */
label = gtk_label_new("hola mundo");
gtk_label_set_selectable(GTK_LABEL(label), FALSE) ;
/* Add the widgets as a children widgets of the main window */
// gtk_container_add(GTK_CONTAINER(window),label);
gtk_container_add(GTK_CONTAINER(window), notebook) ;
gtk_widget_show_all(window) ;
/* Hand control over to the main loop */
gtk_main() ;
return 0 ;
}
/* Switch to the next or previous GtkNotebook page */
static void switch_page(GtkButton *button, GtkNotebook *notebook)
{
gint page = gtk_notebook_get_current_page(notebook) ;
if (page == 0)
{
gtk_notebook_set_current_page(notebook, 1) ;
}
else
{
gtk_notebook_set_current_page(notebook, 0) ;
}
}
/* Stop the GTK+ main loop function when the window is destroyed */
static void destroy(GtkWidget *window, gpointer data)
{
gtk_main_quit();
}
/* Return FALSE to destroy the widget. by returning TRUE, you can cancel
a delete-event. this can be used to confirm quitting the application */
static gboolean delete_event(GtkWidget *window, GdkEvent *event, gpointer data)
{
return FALSE ;
}