Commit acfdca4c authored by Morten Welinder's avatar Morten Welinder

GUI: Disable history item if we have none.

This happens on Mint.  The underlying cause needs to be figured out.
parent fdb43346
2018-04-30 Morten Welinder <terra@gnome.org>
* src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Make full history item
2018-04-29 Morten Welinder <terra@gnome.org>
* configure.ac: Post-release bump.
......
......@@ -73,10 +73,7 @@ gnm_ft_category_get_templates_list (GnmFTCategory *category,
return NULL;
while ((d_name = g_dir_read_name (dir)) != NULL) {
gint name_len;
name_len = strlen (d_name);
if (name_len > 4 && strcmp (d_name + name_len - 4, ".xml") == 0) {
if (g_str_has_suffix (d_name, ".xml")) {
gchar *full_entry_name;
GnmFT *ft;
......
......@@ -21,16 +21,14 @@ gnm_history_item_label (gchar const *uri, int accel_number)
{
GString *res = g_string_new (NULL);
char *basename, *tmp;
int len;
basename = go_basename_from_uri (uri);
if (basename == NULL)
basename = g_strdup ("(invalid file name)");
/* Remove .gnumeric, if present. */
len = strlen (basename);
if (len > 9 && strcmp (basename + len - 9, ".gnumeric") == 0)
basename[len - 9] = 0;
if (g_str_has_suffix (basename, ".gnumeric"))
basename[strlen (basename) - 9] = 0;
if (accel_number <= 9)
g_string_append_printf (res, "_%d ", accel_number);
......
......@@ -4208,11 +4208,13 @@ cb_file_history_activate (GObject *action, WBCGtk *wbcg)
}
static void
wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg)
wbc_gtk_reload_recent_file_menu (WBCGtk *wbcg)
{
WBCGtk *gtk = (WBCGtk *)wbcg;
GSList *history, *ptr;
unsigned i;
gboolean any_history;
GtkAction *full_history;
if (gtk->file_history.merge_id != 0)
gtk_ui_manager_remove_ui (gtk->ui, gtk->file_history.merge_id);
......@@ -4227,6 +4229,7 @@ wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg)
/* create the actions */
history = gnm_app_history_get_list (3);
any_history = (history != NULL);
for (i = 1, ptr = history; ptr != NULL ; ptr = ptr->next, i++) {
GtkActionEntry entry;
GtkAction *action;
......@@ -4268,6 +4271,9 @@ wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg)
GTK_UI_MANAGER_AUTO, TRUE);
g_free (name);
}
full_history = wbcg_find_action (wbcg, "FileHistoryFull");
g_object_set (G_OBJECT (full_history), "sensitive", any_history, NULL);
}
static void
......
......@@ -889,7 +889,7 @@ xml_sax_sheet_zoom (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
static void
xml_sax_print_margins_unit (GsfXMLIn *xin, xmlChar const **attrs,
double *points, GtkUnit *desired_display)
double *points, GtkUnit *desired_display)
{
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
double pts;
......@@ -3672,8 +3672,8 @@ gnm_xml_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_context
GnmCellRegion *
gnm_xml_cellregion_read (WorkbookControl *wbc, GOIOContext *io_context,
Sheet *sheet,
const char *buffer, int length)
Sheet *sheet,
const char *buffer, int length)
{
WorkbookView *wb_view;
GsfInput *input;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment