[goffice] Compilation: tend to the dead kittens.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Compilation: tend to the dead kittens.
- Date: Thu, 9 Jul 2020 21:51:54 +0000 (UTC)
commit a77139897a69540d3f28d15f01a47db88a2e0f25
Author: Morten Welinder <terra gnome org>
Date: Thu Jul 9 17:51:28 2020 -0400
Compilation: tend to the dead kittens.
configure.ac | 2 +-
goffice/app/io-context.c | 5 +----
goffice/gtk/goffice-gtk.c | 18 ++++++++++++------
goffice/utils/go-file.c | 8 ++++++--
goffice/utils/go-format.c | 6 +++---
5 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8518dfaf..839d1e6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -660,7 +660,7 @@ SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GOFFICE_CFLAGS"
LIBS="$GOFFICE_LIBS $LIBS"
-AC_CHECK_FUNCS(gtk_widget_class_set_css_name)
+AC_CHECK_FUNCS(g_file_info_get_modification_date_time gtk_widget_class_set_css_name
gdk_display_get_monitor_at_window)
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
diff --git a/goffice/app/io-context.c b/goffice/app/io-context.c
index a8bf9e19..97537e2e 100644
--- a/goffice/app/io-context.c
+++ b/goffice/app/io-context.c
@@ -287,11 +287,8 @@ go_io_progress_update (GOIOContext *ioc, gdouble f)
f + PROGRESS_UPDATE_STEP > 1);
/* The use of fabs here means we can set progress back if we need to. */
if (at_end || fabs (f - ioc->last_progress) >= PROGRESS_UPDATE_STEP) {
- GTimeVal tv;
- double t;
+ double t = g_get_monotonic_time () / 1000000.0;
- (void) g_get_current_time (&tv);
- t = tv.tv_sec + tv.tv_usec / 1000000.0;
if (at_end || t - ioc->last_time >= PROGRESS_UPDATE_PERIOD_SEC) {
GOCmdContext *cc;
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index 9fd6c59e..f5170a5f 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -972,7 +972,6 @@ save_info_state_free (SaveInfoState *state)
static void
cb_format_combo_changed (GtkComboBox *combo, SaveInfoState *state)
{
- GOImageFormatInfo const *format_info;
gboolean sensitive;
int i;
@@ -1571,8 +1570,6 @@ go_menu_position_below (GtkMenu *menu,
GtkWidget *widget = GTK_WIDGET (user_data);
gint sx, sy;
GtkRequisition req;
- GdkScreen *screen;
- gint monitor_num;
GdkRectangle monitor;
GdkWindow *window = gtk_widget_get_window (widget);
GtkAllocation size;
@@ -1598,9 +1595,18 @@ go_menu_position_below (GtkMenu *menu,
*x = sx + size.width - req.width;
*y = sy;
- screen = gtk_widget_get_screen (widget);
- monitor_num = gdk_screen_get_monitor_at_window (screen, window);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+#ifdef HAVE_GDK_DISPLAY_GET_MONITOR_AT_WINDOW
+ gdk_monitor_get_geometry
+ (gdk_display_get_monitor_at_window
+ (gtk_widget_get_display (widget), window),
+ &monitor);
+#else
+ {
+ GdkScreen *screen = gtk_widget_get_screen (widget);
+ gint monitor_num = gdk_screen_get_monitor_at_window (screen, window);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ }
+#endif
if (*x < monitor.x)
*x = monitor.x;
diff --git a/goffice/utils/go-file.c b/goffice/utils/go-file.c
index 03db88cb..e5b538f4 100644
--- a/goffice/utils/go-file.c
+++ b/goffice/utils/go-file.c
@@ -975,8 +975,8 @@ go_file_get_date_changed (char const *uri)
*
* Determine the last modification time of @uri.
*
- * Returns: (transfer full): the modification time of the file, or %NULL
- * if it could not be determined.
+ * Returns: (transfer full) (nullable): the modification time of the
+ * file.
**/
GDateTime *
go_file_get_modtime (char const *uri)
@@ -990,9 +990,13 @@ go_file_get_modtime (char const *uri)
G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (info) {
+#ifdef HAVE_G_FILE_INFO_GET_MODIFICATION_DATE_TIME
+ modtime = g_file_info_get_modification_date_time (info);
+#else
GTimeVal tv;
g_file_info_get_modification_time (info, &tv);
modtime = g_date_time_new_from_timeval_utc (&tv);
+#endif
g_object_unref (info);
}
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 93e9f766..b14b12a9 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -2857,9 +2857,9 @@ fill_with_char (GString *str, PangoLayout *layout, gsize fill_pos,
gap = n * fill_utf8_len;
g_string_set_size (str, str->len + gap);
- g_memmove (str->str + fill_pos + gap,
- str->str + fill_pos,
- str->len - (fill_pos + gap));
+ memmove (str->str + fill_pos + gap,
+ str->str + fill_pos,
+ str->len - (fill_pos + gap));
while (n > 0) {
memcpy (str->str + fill_pos, fill_utf8, fill_utf8_len);
fill_pos += fill_utf8_len;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]