diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkdockstation.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c index 49f4fa1..69544f7 100644 --- a/src/gtkext/gtkdockstation.c +++ b/src/gtkext/gtkdockstation.c @@ -30,6 +30,8 @@ #include "easygtk.h" #include "iodamarshal.h" +#include "../params.h" +#include "../common/extstr.h" @@ -206,20 +208,32 @@ static gboolean gtk_dock_station_switch_panel(GtkNotebook *notebook, gpointer *p void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const char *caption) { + size_t max; /* Taille maximale des titres */ + char *str; /* Titre des prochaines fois */ GtkWidget *label; /* Etiquette d'onglet */ - label = qck_create_label(NULL, NULL, caption); + max = get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_TAB); + + str = ellipsis(strdup(caption), max); + label = qck_create_label(NULL, NULL, str); + free(str); g_signal_handlers_disconnect_by_func(station->notebook, G_CALLBACK(gtk_dock_station_switch_panel), station); gtk_notebook_insert_page(station->notebook, widget, label, -1); + gtk_widget_set_tooltip_text(label, caption); g_signal_connect(station->notebook, "switch-page", G_CALLBACK(gtk_dock_station_switch_panel), station); gtk_notebook_set_show_tabs(station->notebook, gtk_notebook_get_n_pages(station->notebook) > 1); + str = g_object_get_data(G_OBJECT(widget), "title"); + if (str != NULL) free(str); + max = get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_HEADER); + g_object_set_data(G_OBJECT(widget), "title", ellipsis(strdup(caption), max)); + gtk_dock_panel_update_title(station, widget, caption); gtk_notebook_set_current_page(station->notebook, -1); @@ -315,32 +329,16 @@ void gtk_dock_panel_remove_widget(GtkDockStation *station, GtkWidget *widget) void gtk_dock_panel_update_title(GtkDockStation *station, GtkWidget *widget, const char *caption) { char *str; /* Valeur finale reconstituée */ - gint index; /* Indice de l'onglet actif */ - - /* Sauvegarde pour une prochaine fois */ - - str = g_object_get_data(G_OBJECT(widget), "title"); - if (str != NULL) free(str); - - g_object_set_data(G_OBJECT(widget), "title", strdup(caption)); - - /* Mise à jour de l'affichage */ - - index = gtk_notebook_get_current_page(station->notebook); - - if (index == gtk_notebook_page_num(station->notebook, widget)) - { - str = calloc(strlen("<b>") + strlen(caption) + strlen("</b>") + 1, sizeof(char)); - strcpy(str, "<b>"); - strcat(str, caption); - strcat(str, "</b>"); + str = calloc(strlen("<b>") + strlen(caption) + strlen("</b>") + 1, sizeof(char)); - gtk_label_set_markup(station->title, str); + strcpy(str, "<b>"); + strcat(str, caption); + strcat(str, "</b>"); - free(str); + gtk_label_set_markup(station->title, str); - } + free(str); } |