Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntenore Gatta <antenore@simbiosi.org>2020-05-20 10:47:49 +0300
committerAntenore Gatta <antenore@simbiosi.org>2020-05-20 10:47:49 +0300
commita38345d85dbb97def21eca8b7cffda761ac34333 (patch)
treea626fe06669d7ac626fe7926514d7aa90094074c
parent9db063938beb4fa7312e74393155a19a2ac5ad74 (diff)
parent713f4915923451550fa7f893381fdf3b563e32d4 (diff)
Merge branch 'deprecations' into 'master'
Cleaning up glib deprecations See merge request Remmina/Remmina!2058
-rw-r--r--Doxyfile4
-rw-r--r--plugins/vnc/vnc_plugin.c23
-rw-r--r--plugins/vnc/vnc_plugin.h2
-rw-r--r--src/remmina_pref.c7
-rw-r--r--src/remmina_stats_sender.c20
-rw-r--r--src/remmina_utils.c11
-rw-r--r--src/rmnews.c42
7 files changed, 60 insertions, 49 deletions
diff --git a/Doxyfile b/Doxyfile
index a28d1677a..82987a6a6 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -58,7 +58,7 @@ PROJECT_LOGO = ./data/desktop/96x96/apps/org.remmina.Remmina.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../RemminaDoc/docs
+OUTPUT_DIRECTORY = ../RemminaDoc/public
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -950,7 +950,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE = README.md
+USE_MDFILE_AS_MAINPAGE = Home.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
diff --git a/plugins/vnc/vnc_plugin.c b/plugins/vnc/vnc_plugin.c
index 3fc45fb06..d6047a638 100644
--- a/plugins/vnc/vnc_plugin.c
+++ b/plugins/vnc/vnc_plugin.c
@@ -690,24 +690,25 @@ static gboolean remmina_plugin_vnc_queue_cuttext(RemminaPluginVncCuttextParam *p
TRACE_CALL(__func__);
RemminaProtocolWidget *gp = param->gp;
RemminaPluginVncData *gpdata = GET_PLUGIN_DATA(gp);
- GTimeVal t;
+ GDateTime *t;
glong diff;
const char *cur_charset;
gchar *text;
gsize br, bw;
if (GTK_IS_WIDGET(gp) && gpdata->connected) {
- g_get_current_time(&t);
- diff = (t.tv_sec - gpdata->clipboard_timer.tv_sec) * 10
- + (t.tv_usec - gpdata->clipboard_timer.tv_usec) / 100000;
+ t = g_date_time_new_now_utc();
+ diff = g_date_time_difference(t, gpdata->clipboard_timer) / 100000; // tenth of second
if (diff >= 10) {
+ g_date_time_unref(gpdata->clipboard_timer);
gpdata->clipboard_timer = t;
/* Convert text from VNC latin-1 to current GTK charset (usually UTF-8) */
g_get_charset(&cur_charset);
text = g_convert_with_fallback(param->text, param->textlen, cur_charset, "ISO-8859-1", "?", &br, &bw, NULL);
gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), text, bw);
g_free(text);
- }
+ } else
+ g_date_time_unref(t);
}
g_free(param->text);
g_free(param);
@@ -1510,7 +1511,7 @@ static void remmina_plugin_vnc_on_cuttext_request(GtkClipboard *clipboard, const
{
TRACE_CALL(__func__);
RemminaPluginVncData *gpdata = GET_PLUGIN_DATA(gp);
- GTimeVal t;
+ GDateTime *t;
glong diff;
gsize br, bw;
gchar *latin1_text;
@@ -1518,12 +1519,11 @@ static void remmina_plugin_vnc_on_cuttext_request(GtkClipboard *clipboard, const
if (text) {
/* A timer (1 second) to avoid clipboard "loopback": text cut out from VNC won’t paste back into VNC */
- g_get_current_time(&t);
- diff = (t.tv_sec - gpdata->clipboard_timer.tv_sec) * 10
- + (t.tv_usec - gpdata->clipboard_timer.tv_usec) / 100000;
+ t = g_date_time_new_now_utc();
+ diff = g_date_time_difference(t, gpdata->clipboard_timer) / 100000; // tenth of second
if (diff < 10)
return;
-
+ g_date_time_unref(gpdata->clipboard_timer);
gpdata->clipboard_timer = t;
/* Convert text from current charset to latin-1 before sending to remote server.
* See RFC6143 7.5.6 */
@@ -1648,6 +1648,7 @@ static gboolean remmina_plugin_vnc_close_connection_timeout(RemminaProtocolWidge
gpdata->vnc_buffer = NULL;
}
g_ptr_array_free(gpdata->pressed_keys, TRUE);
+ g_date_time_unref(gpdata->clipboard_timer);
remmina_plugin_vnc_event_free_all(gp);
g_queue_free(gpdata->vnc_event_queue);
pthread_mutex_destroy(&gpdata->vnc_event_queue_mutex);
@@ -1805,7 +1806,7 @@ static void remmina_plugin_vnc_init(RemminaProtocolWidget *gp)
g_signal_connect(G_OBJECT(gpdata->drawing_area), "draw", G_CALLBACK(remmina_plugin_vnc_on_draw), gp);
gpdata->auth_first = TRUE;
- g_get_current_time(&gpdata->clipboard_timer);
+ gpdata->clipboard_timer = g_date_time_new_now_utc();
gpdata->listen_sock = -1;
gpdata->pressed_keys = g_ptr_array_new();
gpdata->vnc_event_queue = g_queue_new();
diff --git a/plugins/vnc/vnc_plugin.h b/plugins/vnc/vnc_plugin.h
index 3e766e94b..771e8ea03 100644
--- a/plugins/vnc/vnc_plugin.h
+++ b/plugins/vnc/vnc_plugin.h
@@ -67,7 +67,7 @@ typedef struct _RemminaPluginVncData {
guint queuedraw_handler;
gulong clipboard_handler;
- GTimeVal clipboard_timer;
+ GDateTime *clipboard_timer;
cairo_surface_t * queuecursor_surface;
gint queuecursor_x, queuecursor_y;
diff --git a/src/remmina_pref.c b/src/remmina_pref.c
index 496b4f2b7..e62ebbba9 100644
--- a/src/remmina_pref.c
+++ b/src/remmina_pref.c
@@ -73,13 +73,14 @@ static void remmina_pref_gen_secret(void)
TRACE_CALL(__func__);
guchar s[32];
gint i;
- GTimeVal gtime;
+ GDateTime *gtime;
GKeyFile *gkeyfile;
gchar *content;
gsize length;
- g_get_current_time(&gtime);
- srand(gtime.tv_sec);
+ gtime = g_date_time_new_now_utc();
+ srand(g_date_time_to_unix(gtime));
+ g_date_time_unref(gtime);
for (i = 0; i < 32; i++) {
s[i] = (guchar)(rand() % 256);
diff --git a/src/remmina_stats_sender.c b/src/remmina_stats_sender.c
index 3a6f38241..a71458886 100644
--- a/src/remmina_stats_sender.c
+++ b/src/remmina_stats_sender.c
@@ -83,7 +83,8 @@ static void soup_callback(SoupSession *session, SoupMessage *msg, gpointer user_
gchar *s = (gchar*)user_data;
SoupBuffer *sb;
gboolean passed;
- GTimeVal t;
+ GDateTime *gdt;
+ gint64 unixts;
g_free(s);
@@ -92,6 +93,10 @@ static void soup_callback(SoupSession *session, SoupMessage *msg, gpointer user_
return;
}
+ gdt = g_date_time_new_now_utc();
+ unixts = g_date_time_to_unix(gdt);
+ g_date_time_to_unix(gdt);
+
passed = FALSE;
sb = soup_message_body_flatten(msg->response_body);
remmina_debug("STATS script response: %.40s\n", sb->data);
@@ -103,8 +108,7 @@ static void soup_callback(SoupSession *session, SoupMessage *msg, gpointer user_
soup_buffer_free(sb);
if (passed) {
- g_get_current_time(&t);
- remmina_pref.periodic_usage_stats_last_sent = t.tv_sec;
+ remmina_pref.periodic_usage_stats_last_sent = unixts;
remmina_pref_save();
}
@@ -303,17 +307,21 @@ gboolean remmina_stat_sender_can_send()
static gboolean remmina_stats_sender_periodic_check(gpointer user_data)
{
TRACE_CALL(__func__);
- GTimeVal t;
+ GDateTime *gdt;
+ gint64 unixts;
glong next;
+ gdt = g_date_time_new_now_utc();
+ unixts = g_date_time_to_unix(gdt);
+ g_date_time_to_unix(gdt);
+
if (!remmina_stat_sender_can_send())
return G_SOURCE_REMOVE;
/* Calculate "next" upload time based on last sent time */
next = remmina_pref.periodic_usage_stats_last_sent + PERIODIC_UPLOAD_INTERVAL_SEC;
- g_get_current_time(&t);
/* If current time is after "next" or clock is going back (but > 1/1/2018), then do send stats */
- if (t.tv_sec > next || (t.tv_sec < remmina_pref.periodic_usage_stats_last_sent && t.tv_sec > 1514764800)) {
+ if (unixts > next || (unixts < remmina_pref.periodic_usage_stats_last_sent && unixts > 1514764800)) {
remmina_stats_sender_send(FALSE);
}
diff --git a/src/remmina_utils.c b/src/remmina_utils.c
index a92472291..9d36a63ef 100644
--- a/src/remmina_utils.c
+++ b/src/remmina_utils.c
@@ -440,13 +440,14 @@ const gchar* remmina_utils_get_os_info()
remmina_utils_get_kernel_name(),
remmina_utils_get_kernel_release(),
remmina_utils_get_kernel_arch());
- if (!kernel_string || kernel_string[0] == '\0')
+ if (!kernel_string || kernel_string[0] == '\0') {
if(kernel_string)
g_free(kernel_string);
kernel_string = g_strdup_printf("%s;%s;%s\n",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN");
+ }
return kernel_string;
}
@@ -511,21 +512,21 @@ gchar* remmina_gen_random_uuid()
{
TRACE_CALL(__func__);
GRand *rand;
- GTimeVal t;
+ GDateTime *gdt;
gchar *result;
int i;
static char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
result = g_malloc0(15);
- g_get_current_time(&t);
- rand = g_rand_new_with_seed((guint32)t.tv_sec ^ (guint32)t.tv_usec);
+ gdt = g_date_time_new_now_utc();
+ rand = g_rand_new_with_seed((guint32)g_date_time_to_unix(gdt));
+ g_date_time_unref(gdt);
for (i = 0; i < 7; i++) {
result[i] = alpha[g_rand_int_range(rand, 0, sizeof(alpha) - 1)];
}
- g_rand_set_seed(rand, (guint32)t.tv_usec);
for (i = 0; i < 7; i++) {
result[i + 7] = alpha[g_rand_int_range(rand, 0, sizeof(alpha) - 1)];
}
diff --git a/src/rmnews.c b/src/rmnews.c
index e40598c25..29b9b6288 100644
--- a/src/rmnews.c
+++ b/src/rmnews.c
@@ -234,32 +234,34 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d
FILE *output_file = NULL;
gchar *filesha = NULL;
gchar *filesha_after = NULL;
- GTimeVal t;
+ GDateTime *gdt;
+ gint64 unixts;
g_info("Status code %d", msg->status_code);
name = soup_message_get_uri(msg)->path;
+ gdt = g_date_time_new_now_utc();
+ unixts = g_date_time_to_unix(gdt);
+ g_date_time_unref(gdt);
+
if (SOUP_STATUS_IS_CLIENT_ERROR(msg->status_code)) {
g_info("Status 404 - Release file not available");
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
}
if (SOUP_STATUS_IS_SERVER_ERROR(msg->status_code)) {
g_info("Server not available");
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
}
if (SOUP_STATUS_IS_TRANSPORT_ERROR(msg->status_code)) {
g_info("Transport Error");
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
}
@@ -271,8 +273,7 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d
g_warning("%s: %d %s (0x%x)\n", name, msg->status_code, msg->reason_phrase, flags);
else
g_warning("%s: %d %s (no handshake status)\n", name, msg->status_code, msg->reason_phrase);
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
} else if (SOUP_STATUS_IS_TRANSPORT_ERROR(msg->status_code)) {
@@ -295,8 +296,7 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d
g_free(uri_string);
soup_uri_free(uri);
}
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
} else if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
@@ -311,15 +311,13 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d
output_file = fopen(output_file_path, "w");
if (!output_file) {
g_printerr("Error trying to create file %s.\n", output_file_path);
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
}
} else {
g_warning("Cannot open output file for writing, because output_file_path is NULL");
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
remmina_pref_save();
return;
}
@@ -341,8 +339,7 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d
if (!kioskmode && kioskmode == FALSE)
rmnews_show_news(parent);
} else {
- g_get_current_time(&t);
- remmina_pref.periodic_rmnews_last_get = t.tv_sec;
+ remmina_pref.periodic_rmnews_last_get = unixts;
}
/* Increase counter with number of successful GETs */
remmina_pref.periodic_rmnews_get_count = remmina_pref.periodic_rmnews_get_count + 1;
@@ -502,12 +499,15 @@ void rmnews_get_news()
static gboolean rmnews_periodic_check(gpointer user_data)
{
TRACE_CALL(__func__);
- GTimeVal t;
+ GDateTime *gdt;
+ gint64 unixts;
glong next = 0;
srand(time(NULL));
- g_get_current_time(&t);
+ gdt = g_date_time_new_now_utc();
+ unixts = g_date_time_to_unix(gdt);
+ g_date_time_unref(gdt);
/* if remmina_pref is not writable ... */
if (remmina_pref_is_rw() == FALSE && remmina_pref.periodic_rmnews_last_get == 0) {
@@ -515,12 +515,12 @@ static gboolean rmnews_periodic_check(gpointer user_data)
/* We randmoly set periodic_rmnews_last_get to a a day between today
* and 7 days ago */
g_debug ("Setting a random periodic_rmnews_last_get");
- remmina_pref.periodic_rmnews_last_get = t.tv_sec - eweekdays[randidx];
+ remmina_pref.periodic_rmnews_last_get = unixts - eweekdays[randidx];
}
g_debug ("periodic_rmnews_last_get is %ld", remmina_pref.periodic_rmnews_last_get);
next = remmina_pref.periodic_rmnews_last_get + RMNEWS_INTERVAL_SEC;
- if (t.tv_sec > next || (t.tv_sec < remmina_pref.periodic_rmnews_last_get && t.tv_sec > 1514764800))
+ if (unixts > next || (unixts < remmina_pref.periodic_rmnews_last_get && unixts > 1514764800))
rmnews_get_news();
return G_SOURCE_CONTINUE;
}