+2005-05-31 Nikolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * backend/ev-page-cache.c: (ev_page_cache_init),
+ (_ev_page_cache_new), (ev_page_cache_get_max_label_chars):
+ * backend/ev-page-cache.h:
+ * shell/ev-page-action.c: (page_changed_cb):
+
+ Set page action entry width depending on labels width. Fix
+ for bug 305202.
+
2005-05-31 Marco Pesenti Gritti <mpg@redhat.com>
* backend/ev-link.c: (ev_link_class_init):
char *title;
char **page_labels;
+ gint max_label_chars;
gboolean has_labels;
gboolean uniform;
ev_page_cache_init (EvPageCache *page_cache)
{
page_cache->current_page = -1;
+ page_cache->max_label_chars = 0;
}
static void
ev_document_get_page_size (document, i, &page_width, &page_height);
page_cache->page_labels[i] = ev_document_get_page_label (document, i);
-
- if (!page_cache->has_labels && page_cache->page_labels[i] != NULL) {
- gchar *expected_label;
+
+ if (page_cache->page_labels[i] != NULL) {
+
+ page_cache->max_label_chars = MAX(page_cache->max_label_chars,
+ g_utf8_strlen (page_cache->page_labels[i], 256));
+ if (!page_cache->has_labels) {
+ gchar *expected_label;
- expected_label = g_strdup_printf ("%d", i + 1);
- if (strcmp (expected_label, page_cache->page_labels[i]))
- page_cache->has_labels = TRUE;
- g_free (expected_label);
+ expected_label = g_strdup_printf ("%d", i + 1);
+ if (strcmp (expected_label, page_cache->page_labels[i]))
+ page_cache->has_labels = TRUE;
+ g_free (expected_label);
+ }
}
if (page_width > page_cache->max_width_page_width) {
*height = page_cache->max_height_page_height * scale;
}
+gint
+ev_page_cache_get_max_label_chars (EvPageCache *page_cache)
+{
+ g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), 0);
+
+ return page_cache->max_label_chars;
+}
gchar *
ev_page_cache_get_page_label (EvPageCache *page_cache,
g_assert (proxy);
if (page_cache != NULL && page >= 0) {
+
+ gtk_entry_set_width_chars (GTK_ENTRY (proxy->entry),
+ CLAMP (ev_page_cache_get_max_label_chars (page_cache),
+ 4, 12));
+
gchar *page_label = ev_page_cache_get_page_label (page_cache, page);
gtk_entry_set_text (GTK_ENTRY (proxy->entry), page_label);
gtk_editable_set_position (GTK_EDITABLE (proxy->entry), -1);
g_free (page_label);
+
} else {
gtk_entry_set_text (GTK_ENTRY (proxy->entry), "");
}