diff options
| author | rootavish <[email protected]> | 2014-08-11 06:45:41 +0530 | 
|---|---|---|
| committer | rootavish <[email protected]> | 2014-08-11 06:45:41 +0530 | 
| commit | 020b11e5f204453614c7c45287d9b39c376d1e4a (patch) | |
| tree | 0a44a205457fd0ca509a285344726b2e2378aed4 | |
| parent | 1548bcb4629a6a41641a0188003215b3098aa5fc (diff) | |
| parent | 1bdae54253b68f2042f1d7f43ac0f36654c9b432 (diff) | |
| download | atril-020b11e5f204453614c7c45287d9b39c376d1e4a.tar.bz2 atril-020b11e5f204453614c7c45287d9b39c376d1e4a.tar.xz | |
Merge remote-tracking branch 'upstream/master' into epub
| -rw-r--r-- | backend/ps/ev-spectre.c | 16 | ||||
| -rw-r--r-- | libdocument/ev-document-misc.c | 2 | ||||
| -rw-r--r-- | shell/ev-window.c | 26 | 
3 files changed, 32 insertions, 12 deletions
| diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index d28325ba..b0489b78 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -224,7 +224,21 @@ static char *  ps_document_get_page_label (EvDocument *document,  			    EvPage     *page)  { -	return g_strdup (spectre_page_get_label ((SpectrePage *)page->backend_page)); +        const gchar *label = spectre_page_get_label ((SpectrePage *)page->backend_page); +        gchar       *utf8; + +        if (!label) +                return NULL; + +        if (g_utf8_validate (label, -1, NULL)) +                return g_strdup (label); + +        /* Try with latin1 and ASCII encondings */ +        utf8 = g_convert (label, -1, "utf-8", "latin1", NULL, NULL, NULL); +        if (!utf8) +                utf8 = g_convert (label, -1, "utf-8", "ASCII", NULL, NULL, NULL); + +        return utf8;  }  static EvDocumentInfo * diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index d597127f..6099b7fa 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -56,7 +56,7 @@ create_thumbnail_frame (int        width,  	}  	/* make sure no one is passing us garbage */ -	g_assert (width_r >= 0 && height_r >= 0); +	g_return_val_if_fail (width_r >= 0 && height_r >= 0, NULL);  	retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,  				 TRUE, 8, diff --git a/shell/ev-window.c b/shell/ev-window.c index fda6f68b..c1e389b3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -42,6 +42,7 @@  #include <gtk/gtk.h>  #include <libmate-desktop/mate-aboutdialog.h> +#include <libmate-desktop/mate-gsettings.h>  #include "egg-editable-toolbar.h"  #include "egg-toolbar-editor.h" @@ -429,12 +430,12 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)  	if (has_document && !ev_print_operation_exists_for_document(document))  		ok_to_print = FALSE; -	if (has_document && +	if (has_document && ev_window->priv->lockdown_settings &&  	    g_settings_get_boolean (ev_window->priv->lockdown_settings, MATE_LOCKDOWN_SAVE)) {  		ok_to_copy = FALSE;  	} -	if (has_document && +	if (has_document && ev_window->priv->lockdown_settings &&  	    g_settings_get_boolean (ev_window->priv->lockdown_settings, MATE_LOCKDOWN_PRINT)) {  		ok_to_print = FALSE;  	} @@ -1438,12 +1439,14 @@ ev_window_setup_document (EvWindow *ev_window)  				  ev_window);  	} -	if (!ev_window->priv->lockdown_settings) -		ev_window->priv->lockdown_settings = g_settings_new (MATE_LOCKDOWN_SCHEMA); -	g_signal_connect (ev_window->priv->lockdown_settings, -				 "changed", -				 G_CALLBACK (lockdown_changed), -				 ev_window); +	if (mate_gsettings_schema_exists (MATE_LOCKDOWN_SCHEMA)) { +		if (!ev_window->priv->lockdown_settings) +			ev_window->priv->lockdown_settings = g_settings_new (MATE_LOCKDOWN_SCHEMA); +		g_signal_connect (ev_window->priv->lockdown_settings, +					 "changed", +					 G_CALLBACK (lockdown_changed), +					 ev_window); +	}  	ev_window_setup_action_sensitivity (ev_window); @@ -3417,8 +3420,11 @@ ev_window_print_range (EvWindow *ev_window,  	ev_print_operation_set_print_settings (op, print_settings);  	ev_print_operation_set_default_page_setup (op, print_page_setup); -	ev_print_operation_set_embed_page_setup (op, !g_settings_get_boolean (ev_window->priv->lockdown_settings, -									     MATE_LOCKDOWN_PRINT_SETUP)); +	if (ev_window->priv->lockdown_settings) +		ev_print_operation_set_embed_page_setup (op, !g_settings_get_boolean (ev_window->priv->lockdown_settings, +												 MATE_LOCKDOWN_PRINT_SETUP)); +	else +		ev_print_operation_set_embed_page_setup (op, TRUE);  	g_object_unref (print_settings);  	g_object_unref (print_page_setup); | 
