[gnumeric] GUI: Disable history item if we have none.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Disable history item if we have none.
- Date: Mon, 30 Apr 2018 19:04:54 +0000 (UTC)
commit acfdca4c6e22b5153c330fe864b55f853d0cba9f
Author: Morten Welinder <terra gnome org>
Date: Mon Apr 30 15:03:44 2018 -0400
GUI: Disable history item if we have none.
This happens on Mint. The underlying cause needs to be figured out.
ChangeLog | 4 ++++
src/file-autoft.c | 5 +----
src/history.c | 6 ++----
src/wbc-gtk.c | 8 +++++++-
src/xml-sax-read.c | 6 +++---
5 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 390106e..60c9482 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+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.
diff --git a/src/file-autoft.c b/src/file-autoft.c
index 7ba9ebb..f565b4d 100644
--- a/src/file-autoft.c
+++ b/src/file-autoft.c
@@ -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;
diff --git a/src/history.c b/src/history.c
index e3d85bd..93aaad6 100644
--- a/src/history.c
+++ b/src/history.c
@@ -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);
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index bec22f0..c16b681 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -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
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 3d1bc95..746d2ee 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]