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> 2018-04-29 Morten Welinder <terra@gnome.org>
* configure.ac: Post-release bump. * configure.ac: Post-release bump.
......
...@@ -73,10 +73,7 @@ gnm_ft_category_get_templates_list (GnmFTCategory *category, ...@@ -73,10 +73,7 @@ gnm_ft_category_get_templates_list (GnmFTCategory *category,
return NULL; return NULL;
while ((d_name = g_dir_read_name (dir)) != NULL) { while ((d_name = g_dir_read_name (dir)) != NULL) {
gint name_len; if (g_str_has_suffix (d_name, ".xml")) {
name_len = strlen (d_name);
if (name_len > 4 && strcmp (d_name + name_len - 4, ".xml") == 0) {
gchar *full_entry_name; gchar *full_entry_name;
GnmFT *ft; GnmFT *ft;
......
...@@ -21,16 +21,14 @@ gnm_history_item_label (gchar const *uri, int accel_number) ...@@ -21,16 +21,14 @@ gnm_history_item_label (gchar const *uri, int accel_number)
{ {
GString *res = g_string_new (NULL); GString *res = g_string_new (NULL);
char *basename, *tmp; char *basename, *tmp;
int len;
basename = go_basename_from_uri (uri); basename = go_basename_from_uri (uri);
if (basename == NULL) if (basename == NULL)
basename = g_strdup ("(invalid file name)"); basename = g_strdup ("(invalid file name)");
/* Remove .gnumeric, if present. */ /* Remove .gnumeric, if present. */
len = strlen (basename); if (g_str_has_suffix (basename, ".gnumeric"))
if (len > 9 && strcmp (basename + len - 9, ".gnumeric") == 0) basename[strlen (basename) - 9] = 0;
basename[len - 9] = 0;
if (accel_number <= 9) if (accel_number <= 9)
g_string_append_printf (res, "_%d ", accel_number); g_string_append_printf (res, "_%d ", accel_number);
......
...@@ -4208,11 +4208,13 @@ cb_file_history_activate (GObject *action, WBCGtk *wbcg) ...@@ -4208,11 +4208,13 @@ cb_file_history_activate (GObject *action, WBCGtk *wbcg)
} }
static void static void
wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg) wbc_gtk_reload_recent_file_menu (WBCGtk *wbcg)
{ {
WBCGtk *gtk = (WBCGtk *)wbcg; WBCGtk *gtk = (WBCGtk *)wbcg;
GSList *history, *ptr; GSList *history, *ptr;
unsigned i; unsigned i;
gboolean any_history;
GtkAction *full_history;
if (gtk->file_history.merge_id != 0) if (gtk->file_history.merge_id != 0)
gtk_ui_manager_remove_ui (gtk->ui, gtk->file_history.merge_id); 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) ...@@ -4227,6 +4229,7 @@ wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg)
/* create the actions */ /* create the actions */
history = gnm_app_history_get_list (3); history = gnm_app_history_get_list (3);
any_history = (history != NULL);
for (i = 1, ptr = history; ptr != NULL ; ptr = ptr->next, i++) { for (i = 1, ptr = history; ptr != NULL ; ptr = ptr->next, i++) {
GtkActionEntry entry; GtkActionEntry entry;
GtkAction *action; GtkAction *action;
...@@ -4268,6 +4271,9 @@ wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg) ...@@ -4268,6 +4271,9 @@ wbc_gtk_reload_recent_file_menu (WBCGtk const *wbcg)
GTK_UI_MANAGER_AUTO, TRUE); GTK_UI_MANAGER_AUTO, TRUE);
g_free (name); g_free (name);
} }
full_history = wbcg_find_action (wbcg, "FileHistoryFull");
g_object_set (G_OBJECT (full_history), "sensitive", any_history, NULL);
} }
static void static void
......
...@@ -889,7 +889,7 @@ xml_sax_sheet_zoom (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob) ...@@ -889,7 +889,7 @@ xml_sax_sheet_zoom (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
static void static void
xml_sax_print_margins_unit (GsfXMLIn *xin, xmlChar const **attrs, 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) { for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
double pts; double pts;
...@@ -3672,8 +3672,8 @@ gnm_xml_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_context ...@@ -3672,8 +3672,8 @@ gnm_xml_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_context
GnmCellRegion * GnmCellRegion *
gnm_xml_cellregion_read (WorkbookControl *wbc, GOIOContext *io_context, gnm_xml_cellregion_read (WorkbookControl *wbc, GOIOContext *io_context,
Sheet *sheet, Sheet *sheet,
const char *buffer, int length) const char *buffer, int length)
{ {
WorkbookView *wb_view; WorkbookView *wb_view;
GsfInput *input; 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