mirror of
https://gitlab.com/Remmina/Remmina.git
synced 2025-04-29 08:22:32 +08:00
Code cleaning
This commit is contained in:
parent
76e75d22e8
commit
bda68a0fc9
210
src/rcw.c
210
src/rcw.c
@ -94,14 +94,14 @@ struct _RemminaConnectionWindowPriv {
|
||||
gdouble floating_toolbar_opacity;
|
||||
|
||||
/* Various delayed and timer event source ids */
|
||||
guint acs_eventsourceid; // timeout
|
||||
guint spf_eventsourceid; // idle
|
||||
guint grab_retry_eventsourceid; // timeout
|
||||
guint acs_eventsourceid; // timeout
|
||||
guint spf_eventsourceid; // idle
|
||||
guint grab_retry_eventsourceid; // timeout
|
||||
guint delayed_grab_eventsourceid;
|
||||
guint ftb_hide_eventsource; // timeout
|
||||
guint tar_eventsource; // timeout
|
||||
guint hidetb_eventsource; // timeout
|
||||
guint dwp_eventsourceid; // timeout
|
||||
guint ftb_hide_eventsource; // timeout
|
||||
guint tar_eventsource; // timeout
|
||||
guint hidetb_eventsource; // timeout
|
||||
guint dwp_eventsourceid; // timeout
|
||||
|
||||
GtkWidget * toolbar;
|
||||
GtkWidget * grid;
|
||||
@ -117,7 +117,7 @@ struct _RemminaConnectionWindowPriv {
|
||||
GtkToolItem * toolitem_multimon;
|
||||
GtkToolItem * toolitem_preferences;
|
||||
GtkToolItem * toolitem_tools;
|
||||
GtkToolItem * toolitem_new;
|
||||
GtkToolItem * toolitem_new;
|
||||
GtkToolItem * toolitem_duplicate;
|
||||
GtkToolItem * toolitem_screenshot;
|
||||
GtkWidget * fullscreen_option_button;
|
||||
@ -171,7 +171,6 @@ typedef struct _RemminaConnectionObject {
|
||||
gboolean dynres_unlocked;
|
||||
|
||||
gulong deferred_open_size_allocate_handler;
|
||||
|
||||
} RemminaConnectionObject;
|
||||
|
||||
enum {
|
||||
@ -219,6 +218,7 @@ static void rcw_class_init(RemminaConnectionWindowClass *klass)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
GtkCssProvider *provider;
|
||||
|
||||
provider = gtk_css_provider_new();
|
||||
|
||||
/* It’s important to remove padding, border and shadow from GtkViewport or
|
||||
@ -358,7 +358,6 @@ static void rcw_class_init(RemminaConnectionWindowClass *klass)
|
||||
rcw_signals[TOOLBARPLACE_SIGNAL] = g_signal_new("toolbar-place", G_TYPE_FROM_CLASS(klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaConnectionWindowClass, toolbar_place), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
}
|
||||
|
||||
static RemminaConnectionObject *rcw_get_cnnobj_at_page(RemminaConnectionWindow *cnnwin, gint npage)
|
||||
@ -427,6 +426,7 @@ static void rcw_kp_ungrab(RemminaConnectionWindow *cnnwin)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
GdkDisplay *display;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 24, 0)
|
||||
GdkSeat *seat;
|
||||
#else
|
||||
@ -456,13 +456,13 @@ static void rcw_kp_ungrab(RemminaConnectionWindow *cnnwin)
|
||||
return;
|
||||
|
||||
#if DEBUG_KB_GRABBING
|
||||
printf("DEBUG_KB_GRABBING: --- ungrabbing\n");
|
||||
printf("DEBUG_KB_GRABBING: --- ungrabbing\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 24, 0)
|
||||
/* We can use gtk_seat_grab()/_ungrab() only after GTK 3.24 */
|
||||
/* We can use gtk_seat_grab()/_ungrab() only after GTK 3.24 */
|
||||
gdk_seat_ungrab(seat);
|
||||
#else
|
||||
if (keyboard != NULL) {
|
||||
@ -475,7 +475,6 @@ static void rcw_kp_ungrab(RemminaConnectionWindow *cnnwin)
|
||||
#endif
|
||||
cnnwin->priv->kbcaptured = FALSE;
|
||||
cnnwin->priv->pointer_captured = FALSE;
|
||||
|
||||
}
|
||||
|
||||
static gboolean rcw_keyboard_grab_retry(gpointer user_data)
|
||||
@ -522,23 +521,23 @@ static void rcw_pointer_grab(RemminaConnectionWindow *cnnwin)
|
||||
display = gtk_widget_get_display(GTK_WIDGET(cnnwin));
|
||||
seat = gdk_display_get_default_seat(display);
|
||||
ggs = gdk_seat_grab(seat, gtk_widget_get_window(GTK_WIDGET(cnnwin)),
|
||||
GDK_SEAT_CAPABILITY_ALL_POINTING, TRUE, NULL, NULL, NULL, NULL);
|
||||
GDK_SEAT_CAPABILITY_ALL_POINTING, TRUE, NULL, NULL, NULL, NULL);
|
||||
if (ggs != GDK_GRAB_SUCCESS) {
|
||||
#if DEBUG_KB_GRABBING
|
||||
printf("DEBUG_KB_GRABBING: GRAB of POINTER failed. GdkGrabStatus: %d\n", (int)ggs);
|
||||
printf("DEBUG_KB_GRABBING: GRAB of POINTER failed. GdkGrabStatus: %d\n", (int)ggs);
|
||||
#endif
|
||||
} else {
|
||||
cnnwin->priv->pointer_captured = TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void rcw_keyboard_grab(RemminaConnectionWindow *cnnwin)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
GdkDisplay *display;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 24, 0)
|
||||
GdkSeat *seat;
|
||||
#else
|
||||
@ -600,7 +599,7 @@ static void rcw_keyboard_grab(RemminaConnectionWindow *cnnwin)
|
||||
#endif
|
||||
if (ggs != GDK_GRAB_SUCCESS) {
|
||||
#if DEBUG_KB_GRABBING
|
||||
printf("GRAB of keyboard failed.\n");
|
||||
printf("GRAB of keyboard failed.\n");
|
||||
#endif
|
||||
/* Reschedule grabbing in half a second if not already done */
|
||||
if (cnnwin->priv->grab_retry_eventsourceid == 0)
|
||||
@ -733,6 +732,7 @@ gboolean rcw_notify_widget_toolbar_placement(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
GType rcwtype;
|
||||
|
||||
rcwtype = rcw_get_type();
|
||||
if (G_TYPE_CHECK_INSTANCE_TYPE(widget, rcwtype)) {
|
||||
g_signal_emit_by_name(G_OBJECT(widget), "toolbar-place");
|
||||
@ -845,6 +845,7 @@ static gboolean rcw_floating_toolbar_make_invisible(gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindowPriv *priv = (RemminaConnectionWindowPriv *)data;
|
||||
|
||||
gtk_widget_set_opacity(GTK_WIDGET(priv->overlay_ftb_overlay), 0.0);
|
||||
priv->ftb_hide_eventsource = 0;
|
||||
return G_SOURCE_REMOVE;
|
||||
@ -897,6 +898,7 @@ void rco_set_scrolled_policy(RemminaConnectionObject *cnnobj, GtkScrolledWindow
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaScaleMode scalemode;
|
||||
|
||||
scalemode = get_current_allowed_scale_mode(cnnobj, NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(scrolled_window,
|
||||
scalemode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC,
|
||||
@ -1319,30 +1321,34 @@ static void rcw_toolbar_fullscreen(GtkToolItem *toggle, RemminaConnectionWindow
|
||||
|
||||
RemminaProtocolWidget *gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto);
|
||||
|
||||
if (remmina_protocol_widget_get_multimon (gp) >= 1) {
|
||||
if (remmina_protocol_widget_get_multimon(gp) >= 1) {
|
||||
REMMINA_DEBUG("Fullscreen on all monitor");
|
||||
gdk_window_set_fullscreen_mode (gtk_widget_get_window(GTK_WIDGET(toggle)), GDK_FULLSCREEN_ON_ALL_MONITORS);
|
||||
} else
|
||||
gdk_window_set_fullscreen_mode(gtk_widget_get_window(GTK_WIDGET(toggle)), GDK_FULLSCREEN_ON_ALL_MONITORS);
|
||||
} else {
|
||||
REMMINA_DEBUG("Fullscreen on one monitor");
|
||||
}
|
||||
|
||||
if ((toggle != NULL && toggle == cnnwin->priv->toolitem_fullscreen))
|
||||
if ((toggle != NULL && toggle == cnnwin->priv->toolitem_fullscreen)) {
|
||||
if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle))) {
|
||||
if (remmina_protocol_widget_get_multimon (gp) >= 1)
|
||||
if (remmina_protocol_widget_get_multimon(gp) >= 1)
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(cnnwin->priv->toolitem_multimon), TRUE);
|
||||
rcw_switch_viewmode(cnnwin, cnnwin->priv->fss_view_mode);
|
||||
} else
|
||||
rcw_switch_viewmode(cnnwin, SCROLLED_WINDOW_MODE);
|
||||
else
|
||||
if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(cnnwin->priv->toolitem_multimon)))
|
||||
rcw_switch_viewmode(cnnwin, cnnwin->priv->fss_view_mode);
|
||||
else
|
||||
} else {
|
||||
rcw_switch_viewmode(cnnwin, SCROLLED_WINDOW_MODE);
|
||||
}
|
||||
} else
|
||||
if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(cnnwin->priv->toolitem_multimon))) {
|
||||
rcw_switch_viewmode(cnnwin, cnnwin->priv->fss_view_mode);
|
||||
} else {
|
||||
rcw_switch_viewmode(cnnwin, SCROLLED_WINDOW_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
static void rco_viewport_fullscreen_mode(GtkWidget *widget, RemminaConnectionObject *cnnobj)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindow *newwin;
|
||||
|
||||
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
return;
|
||||
cnnobj->cnnwin->priv->fss_view_mode = VIEWPORT_FULLSCREEN_MODE;
|
||||
@ -1354,6 +1360,7 @@ static void rco_scrolled_fullscreen_mode(GtkWidget *widget, RemminaConnectionObj
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindow *newwin;
|
||||
|
||||
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
return;
|
||||
cnnobj->cnnwin->priv->fss_view_mode = SCROLLED_FULLSCREEN_MODE;
|
||||
@ -1422,6 +1429,7 @@ static void rcw_scaler_option_popdown(GtkWidget *widget, RemminaConnectionWindow
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindowPriv *priv = cnnwin->priv;
|
||||
|
||||
if (priv->toolbar_is_reconfiguring)
|
||||
return;
|
||||
priv->sticky = FALSE;
|
||||
@ -1685,7 +1693,7 @@ static void rcw_toolbar_multi_monitor_mode(GtkToolItem *toggle, RemminaConnectio
|
||||
remmina_file_set_int(cnnobj->remmina_file, "multimon", 1);
|
||||
remmina_file_save(cnnobj->remmina_file);
|
||||
remmina_protocol_widget_call_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto),
|
||||
REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON, 0);
|
||||
REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON, 0);
|
||||
if (!gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(cnnwin->priv->toolitem_fullscreen)))
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(cnnwin->priv->toolitem_fullscreen), TRUE);
|
||||
} else {
|
||||
@ -2043,8 +2051,8 @@ static void rcw_toolbar_tools(GtkToolItem *toggle, RemminaConnectionWindow *cnnw
|
||||
menuitem = gtk_menu_item_new_with_label(_("Send clipboard content as keystrokes"));
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(submenu_keystrokes), menuitem);
|
||||
g_signal_connect_swapped(G_OBJECT(menuitem), "activate",
|
||||
G_CALLBACK(remmina_protocol_widget_send_clipboard),
|
||||
REMMINA_PROTOCOL_WIDGET(cnnobj->proto));
|
||||
G_CALLBACK(remmina_protocol_widget_send_clipboard),
|
||||
REMMINA_PROTOCOL_WIDGET(cnnobj->proto));
|
||||
gtk_widget_show(menuitem);
|
||||
}
|
||||
g_strfreev(keystrokes);
|
||||
@ -2102,15 +2110,17 @@ static void rcw_toolbar_screenshot(GtkToolItem *toggle, RemminaConnectionWindow
|
||||
gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto);
|
||||
|
||||
gchar *denyclip = remmina_pref_get_value("deny_screenshot_clipboard");
|
||||
REMMINA_DEBUG ("deny_screenshot_clipboard is set to %s", denyclip);
|
||||
|
||||
REMMINA_DEBUG("deny_screenshot_clipboard is set to %s", denyclip);
|
||||
|
||||
GtkClipboard *c = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
|
||||
|
||||
// Ask the plugin if it can give us a screenshot
|
||||
if (remmina_protocol_widget_plugin_screenshot(gp, &rpsd)) {
|
||||
// Good, we have a screenshot from the plugin !
|
||||
|
||||
REMMINA_DEBUG("Screenshot from plugin: w=%d h=%d bpp=%d bytespp=%d\n",
|
||||
rpsd.width, rpsd.height, rpsd.bitsPerPixel, rpsd.bytesPerPixel);
|
||||
rpsd.width, rpsd.height, rpsd.bitsPerPixel, rpsd.bytesPerPixel);
|
||||
|
||||
width = rpsd.width;
|
||||
height = rpsd.height;
|
||||
@ -2126,7 +2136,7 @@ static void rcw_toolbar_screenshot(GtkToolItem *toggle, RemminaConnectionWindow
|
||||
|
||||
srcsurface = cairo_image_surface_create_for_data(rpsd.buffer, cairo_format, width, height, stride);
|
||||
// Transfer the PixBuf in the main clipboard selection
|
||||
if (denyclip && (g_strcmp0 (denyclip, "true")))
|
||||
if (denyclip && (g_strcmp0(denyclip, "true")))
|
||||
gtk_clipboard_set_image(c, gdk_pixbuf_get_from_surface(
|
||||
srcsurface, 0, 0, width, height));
|
||||
surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
|
||||
@ -2161,7 +2171,7 @@ static void rcw_toolbar_screenshot(GtkToolItem *toggle, RemminaConnectionWindow
|
||||
g_print("gdk_pixbuf_get_from_window failed\n");
|
||||
|
||||
// Transfer the PixBuf in the main clipboard selection
|
||||
if (denyclip && (g_strcmp0 (denyclip, "true")))
|
||||
if (denyclip && (g_strcmp0(denyclip, "true")))
|
||||
gtk_clipboard_set_image(c, screenshot);
|
||||
// Prepare the destination Cairo surface.
|
||||
surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
|
||||
@ -2226,6 +2236,7 @@ static void rcw_toolbar_disconnect(GtkToolItem *toggle, RemminaConnectionWindow
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionObject *cnnobj;
|
||||
|
||||
if (cnnwin->priv->toolbar_is_reconfiguring)
|
||||
return;
|
||||
if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return;
|
||||
@ -2249,9 +2260,8 @@ static void rcw_toolbar_grab(GtkToolItem *toggle, RemminaConnectionWindow *cnnwi
|
||||
printf("DEBUG_KB_GRABBING: Grabbing for button\n");
|
||||
#endif
|
||||
rcw_keyboard_grab(cnnobj->cnnwin);
|
||||
if (cnnobj->cnnwin->priv->pointer_entered) {
|
||||
if (cnnobj->cnnwin->priv->pointer_entered)
|
||||
rcw_pointer_grab(cnnobj->cnnwin);
|
||||
}
|
||||
} else {
|
||||
rcw_kp_ungrab(cnnobj->cnnwin);
|
||||
}
|
||||
@ -2271,7 +2281,7 @@ rcw_create_toolbar(RemminaConnectionWindow *cnnwin, gint mode)
|
||||
GdkDisplay *display;
|
||||
gint n_monitors;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
display = gdk_display_get_default();
|
||||
n_monitors = gdk_display_get_n_monitors(display);
|
||||
|
||||
cnnobj = rcw_get_visible_cnnobj(cnnwin);
|
||||
@ -2391,7 +2401,7 @@ rcw_create_toolbar(RemminaConnectionWindow *cnnwin, gint mode)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(toolitem), FALSE);
|
||||
else
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toolitem),
|
||||
remmina_file_get_int(cnnobj->remmina_file, "multimon", FALSE));
|
||||
remmina_file_get_int(cnnobj->remmina_file, "multimon", FALSE));
|
||||
}
|
||||
|
||||
/* Dynamic Resolution Update */
|
||||
@ -2440,7 +2450,7 @@ rcw_create_toolbar(RemminaConnectionWindow *cnnwin, gint mode)
|
||||
priv->scaler_option_button = widget;
|
||||
|
||||
/* Separator */
|
||||
toolitem = gtk_separator_tool_item_new ();
|
||||
toolitem = gtk_separator_tool_item_new();
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
|
||||
gtk_widget_show(GTK_WIDGET(toolitem));
|
||||
|
||||
@ -2607,10 +2617,11 @@ static void rco_update_toolbar(RemminaConnectionObject *cnnobj)
|
||||
/* REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON */
|
||||
toolitem = priv->toolitem_multimon;
|
||||
gint hasmultimon = remmina_protocol_widget_query_feature_by_type(REMMINA_PROTOCOL_WIDGET(cnnobj->proto),
|
||||
REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON);
|
||||
REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON);
|
||||
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(toolitem), cnnobj->connected);
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toolitem),
|
||||
remmina_file_get_int(cnnobj->remmina_file, "multimon", FALSE));
|
||||
remmina_file_get_int(cnnobj->remmina_file, "multimon", FALSE));
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(toolitem), hasmultimon);
|
||||
|
||||
toolitem = priv->toolitem_grab;
|
||||
@ -2643,24 +2654,26 @@ static void rco_update_toolbar(RemminaConnectionObject *cnnobj)
|
||||
|
||||
bg = g_strdup(remmina_pref.grab_color);
|
||||
if (!gdk_rgba_parse(&rgba, bg)) {
|
||||
REMMINA_DEBUG ("%s cannot be parsed as a color", bg);
|
||||
REMMINA_DEBUG("%s cannot be parsed as a color", bg);
|
||||
bg = g_strdup("#00FF00");
|
||||
} else
|
||||
REMMINA_DEBUG ("Using %s as background color", bg);
|
||||
} else {
|
||||
REMMINA_DEBUG("Using %s as background color", bg);
|
||||
}
|
||||
|
||||
if (remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE))
|
||||
if (remmina_file_get_int(cnnobj->remmina_file, "keyboard_grab", FALSE)) {
|
||||
if (remmina_pref_get_boolean("grab_color_switch"))
|
||||
format = g_strconcat("<span bgcolor=\"", bg, "\" size=\"large\"><b>(G:ON) - \%s</b></span>", NULL);
|
||||
else
|
||||
format = "<big><b>(G:ON) - \%s</b></big>";
|
||||
else
|
||||
} else {
|
||||
format = "<big><b>(G:OFF) - \%s</b></big>";
|
||||
}
|
||||
gchar *markup;
|
||||
|
||||
markup = g_markup_printf_escaped (format, str);
|
||||
gtk_label_set_markup (GTK_LABEL (priv->floating_toolbar_label), markup);
|
||||
g_free (markup);
|
||||
g_free (bg);
|
||||
markup = g_markup_printf_escaped(format, str);
|
||||
gtk_label_set_markup(GTK_LABEL(priv->floating_toolbar_label), markup);
|
||||
g_free(markup);
|
||||
g_free(bg);
|
||||
}
|
||||
|
||||
priv->toolbar_is_reconfiguring = FALSE;
|
||||
@ -2688,7 +2701,7 @@ static gboolean rcw_floating_toolbar_on_enter(GtkWidget *widget, GdkEventCrossin
|
||||
}
|
||||
|
||||
static gboolean rcw_on_enter_notify_event(GtkWidget *widget, GdkEventCrossing *event,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
#if DEBUG_KB_GRABBING
|
||||
@ -2698,7 +2711,7 @@ static gboolean rcw_on_enter_notify_event(GtkWidget *widget, GdkEventCrossing *e
|
||||
}
|
||||
|
||||
static gboolean rcw_on_leave_notify_event(GtkWidget *widget, GdkEventCrossing *event,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)widget;
|
||||
@ -2720,7 +2733,7 @@ static gboolean rcw_on_leave_notify_event(GtkWidget *widget, GdkEventCrossing *e
|
||||
|
||||
|
||||
static gboolean rco_leave_protocol_widget(GtkWidget *widget, GdkEventCrossing *event,
|
||||
RemminaConnectionObject *cnnobj)
|
||||
RemminaConnectionObject *cnnobj)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
|
||||
@ -2805,9 +2818,8 @@ gboolean rco_enter_protocol_widget(GtkWidget *widget, GdkEventCrossing *event,
|
||||
#endif
|
||||
|
||||
RemminaConnectionWindowPriv *priv = cnnobj->cnnwin->priv;
|
||||
if (!priv->sticky && event->mode == GDK_CROSSING_NORMAL) {
|
||||
if (!priv->sticky && event->mode == GDK_CROSSING_NORMAL)
|
||||
rcw_floating_toolbar_show(cnnobj->cnnwin, FALSE);
|
||||
}
|
||||
|
||||
priv->pointer_entered = TRUE;
|
||||
|
||||
@ -2870,7 +2882,6 @@ static void rcw_focus_in(RemminaConnectionWindow *cnnwin)
|
||||
printf("DEBUG_KB_GRABBING: Received focus in on rcw, but a condition will prevent to grab\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void rcw_focus_out(RemminaConnectionWindow *cnnwin)
|
||||
@ -2896,6 +2907,7 @@ rcw_floating_toolbar_hide(RemminaConnectionWindow *cnnwin)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindowPriv *priv = cnnwin->priv;
|
||||
|
||||
priv->hidetb_eventsource = 0;
|
||||
rcw_floating_toolbar_show(cnnwin, FALSE);
|
||||
return G_SOURCE_REMOVE;
|
||||
@ -3175,17 +3187,17 @@ static gboolean rcw_map_event(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
|
||||
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow*)widget;
|
||||
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)widget;
|
||||
RemminaConnectionObject *cnnobj;
|
||||
RemminaProtocolWidget *gp;
|
||||
|
||||
if (cnnwin->priv->toolbar_is_reconfiguring) return FALSE;
|
||||
if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return FALSE;
|
||||
|
||||
gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto);
|
||||
REMMINA_DEBUG ("Mapping: %s", gtk_widget_get_name(widget));
|
||||
if (remmina_protocol_widget_map_event(gp)) {
|
||||
REMMINA_DEBUG ("Called plugin mapping function");
|
||||
}
|
||||
REMMINA_DEBUG("Mapping: %s", gtk_widget_get_name(widget));
|
||||
if (remmina_protocol_widget_map_event(gp))
|
||||
REMMINA_DEBUG("Called plugin mapping function");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3193,17 +3205,17 @@ static gboolean rcw_unmap_event(GtkWidget *widget, GdkEvent *event, gpointer dat
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
|
||||
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow*)widget;
|
||||
RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)widget;
|
||||
RemminaConnectionObject *cnnobj;
|
||||
RemminaProtocolWidget *gp;
|
||||
|
||||
if (cnnwin->priv->toolbar_is_reconfiguring) return FALSE;
|
||||
if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return FALSE;
|
||||
|
||||
gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto);
|
||||
REMMINA_DEBUG ("Unmapping: %s", gtk_widget_get_name(widget));
|
||||
if (remmina_protocol_widget_unmap_event(gp)) {
|
||||
REMMINA_DEBUG ("Called plugin mapping function");
|
||||
}
|
||||
REMMINA_DEBUG("Unmapping: %s", gtk_widget_get_name(widget));
|
||||
if (remmina_protocol_widget_unmap_event(gp))
|
||||
REMMINA_DEBUG("Called plugin mapping function");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3213,33 +3225,34 @@ static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpo
|
||||
RemminaConnectionObject *cnnobj;
|
||||
gint target_monitor;
|
||||
|
||||
REMMINA_DEBUG ("Mapping: %s", gtk_widget_get_name(widget));
|
||||
REMMINA_DEBUG("Mapping: %s", gtk_widget_get_name(widget));
|
||||
|
||||
if (!REMMINA_IS_CONNECTION_WINDOW(widget)) {
|
||||
REMMINA_DEBUG ("Remmina Connection Window undefined, cannot go fullscreen");
|
||||
REMMINA_DEBUG("Remmina Connection Window undefined, cannot go fullscreen");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow *)data;
|
||||
cnnobj = rcw_get_visible_cnnobj((RemminaConnectionWindow*)widget);
|
||||
cnnobj = rcw_get_visible_cnnobj((RemminaConnectionWindow *)widget);
|
||||
//cnnobj = g_object_get_data(G_OBJECT(widget), "cnnobj");
|
||||
if (!cnnobj) {
|
||||
REMMINA_DEBUG ("Remmina Connection Object undefined, cannot go fullscreen");
|
||||
REMMINA_DEBUG("Remmina Connection Object undefined, cannot go fullscreen");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RemminaProtocolWidget *gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto);
|
||||
if (!gp) {
|
||||
REMMINA_DEBUG ("Remmina Protocol Widget undefined, cannot go fullscreen");
|
||||
}
|
||||
|
||||
if (remmina_protocol_widget_get_multimon (gp) >= 1) {
|
||||
if (!gp)
|
||||
REMMINA_DEBUG("Remmina Protocol Widget undefined, cannot go fullscreen");
|
||||
|
||||
if (remmina_protocol_widget_get_multimon(gp) >= 1) {
|
||||
REMMINA_DEBUG("Fullscreen on all monitor");
|
||||
gdk_window_set_fullscreen_mode (gtk_widget_get_window(widget), GDK_FULLSCREEN_ON_ALL_MONITORS);
|
||||
gdk_window_set_fullscreen_mode(gtk_widget_get_window(widget), GDK_FULLSCREEN_ON_ALL_MONITORS);
|
||||
gdk_window_fullscreen(gtk_widget_get_window(widget));
|
||||
return TRUE;
|
||||
} else
|
||||
} else {
|
||||
REMMINA_DEBUG("Fullscreen on one monitor");
|
||||
}
|
||||
|
||||
target_monitor = GPOINTER_TO_INT(data);
|
||||
|
||||
@ -3259,9 +3272,8 @@ static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpo
|
||||
gtk_window_fullscreen(GTK_WINDOW(widget));
|
||||
#endif
|
||||
|
||||
if (remmina_protocol_widget_map_event(gp)) {
|
||||
REMMINA_DEBUG ("Called plugin mapping function");
|
||||
}
|
||||
if (remmina_protocol_widget_map_event(gp))
|
||||
REMMINA_DEBUG("Called plugin mapping function");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -3517,7 +3529,7 @@ static gboolean rcw_on_switch_page_finalsel(gpointer user_data)
|
||||
rcw_floating_toolbar_show(cnnobj->cnnwin, TRUE);
|
||||
if (!priv->hidetb_eventsource)
|
||||
priv->hidetb_eventsource = g_timeout_add(TB_HIDE_TIME_TIME, (GSourceFunc)
|
||||
rcw_floating_toolbar_hide, cnnobj->cnnwin);
|
||||
rcw_floating_toolbar_hide, cnnobj->cnnwin);
|
||||
rco_update_toolbar(cnnobj);
|
||||
rcw_grab_focus(cnnobj->cnnwin);
|
||||
if (priv->view_mode != SCROLLED_WINDOW_MODE)
|
||||
@ -3646,13 +3658,13 @@ static RemminaConnectionWindow *rcw_create_scrolled(gint width, gint height, gbo
|
||||
GtkWidget *grid;
|
||||
GtkWidget *toolbar;
|
||||
GtkNotebook *notebook;
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
GtkSettings *settings = gtk_settings_get_default();
|
||||
|
||||
cnnwin = rcw_new(FALSE, 0);
|
||||
gtk_widget_realize(GTK_WIDGET(cnnwin));
|
||||
|
||||
gtk_window_set_default_size(GTK_WINDOW(cnnwin), width, height);
|
||||
g_object_set (settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
g_object_set(settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
|
||||
/* Create the toolbar */
|
||||
toolbar = rcw_create_toolbar(cnnwin, SCROLLED_WINDOW_MODE);
|
||||
@ -3697,8 +3709,9 @@ static RemminaConnectionWindow *rcw_create_scrolled(gint width, gint height, gbo
|
||||
* call unrealize() and will destroy a GtkSocket */
|
||||
gtk_widget_show(grid);
|
||||
gtk_widget_show(GTK_WIDGET(cnnwin));
|
||||
GtkWindowGroup * wingrp = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (wingrp, GTK_WINDOW(cnnwin));
|
||||
GtkWindowGroup *wingrp = gtk_window_group_new();
|
||||
|
||||
gtk_window_group_add_window(wingrp, GTK_WINDOW(cnnwin));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(cnnwin), NULL);
|
||||
|
||||
if (maximize)
|
||||
@ -3716,6 +3729,7 @@ static void rcw_create_overlay_ftb_overlay(RemminaConnectionWindow *cnnwin)
|
||||
|
||||
GtkWidget *revealer;
|
||||
RemminaConnectionWindowPriv *priv;
|
||||
|
||||
priv = cnnwin->priv;
|
||||
|
||||
if (priv->overlay_ftb_overlay != NULL) {
|
||||
@ -3729,9 +3743,11 @@ static void rcw_create_overlay_ftb_overlay(RemminaConnectionWindow *cnnwin)
|
||||
priv->overlay_ftb_overlay = gtk_event_box_new();
|
||||
|
||||
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
|
||||
|
||||
GtkWidget *handle = gtk_drawing_area_new();
|
||||
|
||||
gtk_widget_set_size_request(handle, 4, 4);
|
||||
gtk_widget_set_name(handle, "ftb-handle");
|
||||
|
||||
@ -3759,6 +3775,7 @@ static void rcw_create_overlay_ftb_overlay(RemminaConnectionWindow *cnnwin)
|
||||
priv->revealer = revealer;
|
||||
|
||||
GtkWidget *fr;
|
||||
|
||||
fr = gtk_frame_new(NULL);
|
||||
gtk_container_add(GTK_CONTAINER(priv->overlay_ftb_overlay), fr);
|
||||
gtk_container_add(GTK_CONTAINER(fr), vbox);
|
||||
@ -3793,10 +3810,9 @@ static void rcw_create_overlay_ftb_overlay(RemminaConnectionWindow *cnnwin)
|
||||
dnd_targets_ftb, sizeof dnd_targets_ftb / sizeof *dnd_targets_ftb, GDK_ACTION_MOVE);
|
||||
g_signal_connect_after(GTK_WIDGET(priv->overlay_ftb_overlay), "drag-begin", G_CALLBACK(rcw_ftb_drag_begin), cnnwin);
|
||||
|
||||
if (remmina_pref.fullscreen_toolbar_visibility == FLOATING_TOOLBAR_VISIBILITY_DISABLE) {
|
||||
if (remmina_pref.fullscreen_toolbar_visibility == FLOATING_TOOLBAR_VISIBILITY_DISABLE)
|
||||
/* toolbar in fullscreenmode disabled, hide everything */
|
||||
gtk_widget_hide(fr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3857,6 +3873,7 @@ RemminaConnectionWindow *rcw_create_fullscreen(GtkWindow *old, gint view_mode)
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionWindow *cnnwin;
|
||||
GtkNotebook *notebook;
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 22, 0)
|
||||
gint n_monitors;
|
||||
gint i;
|
||||
@ -3913,8 +3930,8 @@ RemminaConnectionWindow *rcw_create_fullscreen(GtkWindow *old, gint view_mode)
|
||||
g_signal_connect(GTK_WIDGET(cnnwin->priv->overlay), "drag-drop", G_CALLBACK(rcw_ftb_drag_drop), cnnwin);
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(cnnwin));
|
||||
GtkWindowGroup * wingrp = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (wingrp, GTK_WINDOW(cnnwin));
|
||||
GtkWindowGroup *wingrp = gtk_window_group_new();
|
||||
gtk_window_group_add_window(wingrp, GTK_WINDOW(cnnwin));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(cnnwin), NULL);
|
||||
|
||||
return cnnwin;
|
||||
@ -4236,6 +4253,7 @@ void rco_on_desktop_resize(RemminaProtocolWidget *gp, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionObject *cnnobj = gp->cnnobj;
|
||||
|
||||
if (cnnobj && cnnobj->cnnwin && cnnobj->cnnwin->priv->view_mode != SCROLLED_WINDOW_MODE)
|
||||
rco_check_resize(cnnobj);
|
||||
}
|
||||
@ -4244,6 +4262,7 @@ void rco_on_update_align(RemminaProtocolWidget *gp, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionObject *cnnobj = gp->cnnobj;
|
||||
|
||||
remmina_protocol_widget_update_alignment(cnnobj);
|
||||
}
|
||||
|
||||
@ -4251,6 +4270,7 @@ void rco_on_lock_dynres(RemminaProtocolWidget *gp, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionObject *cnnobj = gp->cnnobj;
|
||||
|
||||
cnnobj->dynres_unlocked = FALSE;
|
||||
rco_update_toolbar(cnnobj);
|
||||
}
|
||||
@ -4259,6 +4279,7 @@ void rco_on_unlock_dynres(RemminaProtocolWidget *gp, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaConnectionObject *cnnobj = gp->cnnobj;
|
||||
|
||||
cnnobj->dynres_unlocked = TRUE;
|
||||
rco_update_toolbar(cnnobj);
|
||||
}
|
||||
@ -4367,6 +4388,7 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec
|
||||
if (kioskmode)
|
||||
view_mode = VIEWPORT_FULLSCREEN_MODE;
|
||||
gint ismultimon = remmina_file_get_int(cnnobj->remmina_file, "multimon", 0);
|
||||
|
||||
if (ismultimon)
|
||||
view_mode = VIEWPORT_FULLSCREEN_MODE;
|
||||
|
||||
@ -4470,8 +4492,14 @@ GtkWidget *rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnec
|
||||
return cnnobj->proto;
|
||||
}
|
||||
|
||||
GtkWindow* rcw_get_gtkwindow(RemminaConnectionObject *cnnobj) { return &cnnobj->cnnwin->window; }
|
||||
GtkWidget* rcw_get_gtkviewport(RemminaConnectionObject *cnnobj) { return cnnobj->viewport; }
|
||||
GtkWindow *rcw_get_gtkwindow(RemminaConnectionObject *cnnobj)
|
||||
{
|
||||
return &cnnobj->cnnwin->window;
|
||||
}
|
||||
GtkWidget *rcw_get_gtkviewport(RemminaConnectionObject *cnnobj)
|
||||
{
|
||||
return cnnobj->viewport;
|
||||
}
|
||||
|
||||
void rcw_set_delete_confirm_mode(RemminaConnectionWindow *cnnwin, RemminaConnectionWindowOnDeleteConfirmMode mode)
|
||||
{
|
||||
|
@ -166,9 +166,10 @@ void remmina_file_generate_filename(RemminaFile *remminafile)
|
||||
s = NULL;
|
||||
|
||||
g_autofree gchar *filename = g_strdelimit(g_ascii_strdown(g_strstrip(g_string_free(filenamestr, FALSE)), -1),
|
||||
invalid_chars, '-');
|
||||
invalid_chars, '-');
|
||||
|
||||
GDir *dir = g_dir_open(remmina_file_get_datadir(), 0, NULL);
|
||||
|
||||
if (dir != NULL)
|
||||
remminafile->filename = g_strdup_printf("%s/%s.remmina", remmina_file_get_datadir(), filename);
|
||||
else
|
||||
@ -192,7 +193,7 @@ void remmina_file_set_statefile(RemminaFile *remminafile)
|
||||
else
|
||||
g_free(remminafile->statefile);
|
||||
|
||||
gchar *basename = g_path_get_basename (remminafile->filename);
|
||||
gchar *basename = g_path_get_basename(remminafile->filename);
|
||||
gchar *cachedir = g_build_path("/", g_get_user_cache_dir(), "remmina", NULL);
|
||||
GString *fname = g_string_new(g_strdup(basename));
|
||||
|
||||
@ -214,10 +215,10 @@ remmina_file_copy(const gchar *filename)
|
||||
|
||||
remminafile = remmina_file_load(filename);
|
||||
remmina_file_set_string(remminafile,
|
||||
"name",
|
||||
g_strdup_printf(
|
||||
"COPY %s",
|
||||
remmina_file_get_string(remminafile, "name")));
|
||||
"name",
|
||||
g_strdup_printf(
|
||||
"COPY %s",
|
||||
remmina_file_get_string(remminafile, "name")));
|
||||
|
||||
if (remminafile)
|
||||
remmina_file_generate_filename(remminafile);
|
||||
@ -290,7 +291,6 @@ static void upgrade_sshkeys_202001(RemminaFile *remminafile)
|
||||
const gchar *val;
|
||||
|
||||
if (remmina_file_get_string(remminafile, "ssh_enabled")) {
|
||||
|
||||
/* Upgrade ssh params from remmina pre 1.4 */
|
||||
|
||||
ssh_enabled = remmina_file_get_int(remminafile, "ssh_enabled", 0);
|
||||
@ -337,9 +337,7 @@ static void upgrade_sshkeys_202001(RemminaFile *remminafile)
|
||||
/* Real key removal will be done by remmina_file_save() */
|
||||
|
||||
remmina_file_set_int(remminafile, "ssh_tunnel_enabled", ssh_enabled);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RemminaFile *
|
||||
@ -361,13 +359,12 @@ remmina_file_load(const gchar *filename)
|
||||
if (g_file_test(filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) {
|
||||
if (!g_key_file_load_from_file(gkeyfile, filename, G_KEY_FILE_NONE, NULL)) {
|
||||
g_key_file_free(gkeyfile);
|
||||
REMMINA_DEBUG ("Unable to load remmina profile file %s: g_key_file_load_from_file() returned NULL.\n", filename);
|
||||
REMMINA_DEBUG("Unable to load remmina profile file %s: g_key_file_load_from_file() returned NULL.\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_key_file_has_key(gkeyfile, KEYFILE_GROUP_REMMINA, "name", NULL)) {
|
||||
|
||||
remminafile = remmina_file_new_empty();
|
||||
|
||||
protocol_plugin = NULL;
|
||||
@ -385,7 +382,6 @@ remmina_file_load(const gchar *filename)
|
||||
remminafile->filename = g_strdup(filename);
|
||||
gchar **keys = g_key_file_get_keys(gkeyfile, KEYFILE_GROUP_REMMINA, NULL, NULL);
|
||||
if (keys) {
|
||||
|
||||
for (i = 0; keys[i]; i++) {
|
||||
key = keys[i];
|
||||
if (protocol_plugin && remmina_plugin_manager_is_encrypted_setting(protocol_plugin, key)) {
|
||||
@ -424,11 +420,10 @@ remmina_file_load(const gchar *filename)
|
||||
}
|
||||
|
||||
upgrade_sshkeys_202001(remminafile);
|
||||
|
||||
}
|
||||
g_strfreev(keys);
|
||||
} else {
|
||||
REMMINA_DEBUG ("Unable to load remmina profile file %s: cannot find key name= in section remmina.\n", filename);
|
||||
REMMINA_DEBUG("Unable to load remmina profile file %s: cannot find key name= in section remmina.\n", filename);
|
||||
remminafile = NULL;
|
||||
}
|
||||
|
||||
@ -459,20 +454,19 @@ void remmina_file_set_string_ref(RemminaFile *remminafile, const gchar *setting,
|
||||
return;
|
||||
}
|
||||
g_hash_table_insert(remminafile->settings, g_strdup(setting), value);
|
||||
} else
|
||||
} else {
|
||||
g_hash_table_insert(remminafile->settings, g_strdup(setting), g_strdup(""));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void remmina_file_set_state(RemminaFile *remminafile, const gchar *setting, const gchar *value)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
|
||||
if(value && value[0] != 0) {
|
||||
if (value && value[0] != 0)
|
||||
g_hash_table_insert(remminafile->states, g_strdup(setting), g_strdup(value));
|
||||
} else
|
||||
else
|
||||
g_hash_table_insert(remminafile->states, g_strdup(setting), g_strdup(""));
|
||||
|
||||
}
|
||||
|
||||
const gchar *
|
||||
@ -536,7 +530,7 @@ gchar *remmina_file_format_properties(RemminaFile *remminafile, const gchar *set
|
||||
remmina_utils_string_replace_all(fmt_str, "%p", remmina_file_get_string(remminafile, "name"));
|
||||
remmina_utils_string_replace_all(fmt_str, "%g", remmina_file_get_string(remminafile, "group"));
|
||||
|
||||
now = g_date_time_new_now_local ();
|
||||
now = g_date_time_new_now_local();
|
||||
date_str = g_date_time_format(now, "%FT%TZ");
|
||||
remmina_utils_string_replace_all(fmt_str, "%d", date_str);
|
||||
g_free(date_str);
|
||||
@ -550,8 +544,8 @@ void remmina_file_set_int(RemminaFile *remminafile, const gchar *setting, gint v
|
||||
TRACE_CALL(__func__);
|
||||
if (remminafile)
|
||||
g_hash_table_insert(remminafile->settings,
|
||||
g_strdup(setting),
|
||||
g_strdup_printf("%i", value));
|
||||
g_strdup(setting),
|
||||
g_strdup_printf("%i", value));
|
||||
}
|
||||
|
||||
void remmina_file_set_state_int(RemminaFile *remminafile, const gchar *setting, gint value)
|
||||
@ -559,8 +553,8 @@ void remmina_file_set_state_int(RemminaFile *remminafile, const gchar *setting,
|
||||
TRACE_CALL(__func__);
|
||||
if (remminafile)
|
||||
g_hash_table_insert(remminafile->states,
|
||||
g_strdup(setting),
|
||||
g_strdup_printf("%i", value));
|
||||
g_strdup(setting),
|
||||
g_strdup_printf("%i", value));
|
||||
}
|
||||
|
||||
gint remmina_file_get_int(RemminaFile *remminafile, const gchar *setting, gint default_value)
|
||||
@ -589,9 +583,9 @@ gint remmina_file_get_state_int(RemminaFile *remminafile, const gchar *setting,
|
||||
|
||||
// sscanf uses the set language to convert the float.
|
||||
// therefore '.' and ',' cannot be used interchangeably.
|
||||
gdouble remmina_file_get_double(RemminaFile *remminafile,
|
||||
const gchar *setting,
|
||||
gdouble default_value)
|
||||
gdouble remmina_file_get_double(RemminaFile * remminafile,
|
||||
const gchar * setting,
|
||||
gdouble default_value)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
gchar *value;
|
||||
@ -604,10 +598,10 @@ gdouble remmina_file_get_double(RemminaFile *remminafile,
|
||||
// https://stackoverflow.com/questions/10075294/converting-string-to-a-double-variable-in-c
|
||||
gdouble d;
|
||||
gint ret = sscanf(value, "%lf", &d);
|
||||
if (ret != 1) {
|
||||
|
||||
if (ret != 1)
|
||||
// failed.
|
||||
d = default_value;
|
||||
}
|
||||
|
||||
// TOO VERBOSE: REMMINA_DEBUG("Double value is: %lf", d);
|
||||
return d;
|
||||
@ -615,9 +609,9 @@ gdouble remmina_file_get_double(RemminaFile *remminafile,
|
||||
|
||||
// sscanf uses the set language to convert the float.
|
||||
// therefore '.' and ',' cannot be used interchangeably.
|
||||
gdouble remmina_file_get_state_double(RemminaFile *remminafile,
|
||||
const gchar *setting,
|
||||
gdouble default_value)
|
||||
gdouble remmina_file_get_state_double(RemminaFile * remminafile,
|
||||
const gchar * setting,
|
||||
gdouble default_value)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
gchar *value;
|
||||
@ -630,10 +624,10 @@ gdouble remmina_file_get_state_double(RemminaFile *remminafile,
|
||||
// https://stackoverflow.com/questions/10075294/converting-string-to-a-double-variable-in-c
|
||||
gdouble d;
|
||||
gint ret = sscanf(value, "%lf", &d);
|
||||
if (ret != 1) {
|
||||
|
||||
if (ret != 1)
|
||||
// failed.
|
||||
d = default_value;
|
||||
}
|
||||
|
||||
// TOO VERBOSE: REMMINA_DEBUG("Double value is: %lf", d);
|
||||
return d;
|
||||
@ -712,14 +706,14 @@ void remmina_file_save(RemminaFile *remminafile)
|
||||
if ((gkeystate = remmina_file_get_keystate(remminafile)) == NULL)
|
||||
return;
|
||||
|
||||
REMMINA_DEBUG ("Saving profile");
|
||||
REMMINA_DEBUG("Saving profile");
|
||||
/* get disablepasswordstoring */
|
||||
nopasswdsave = remmina_file_get_int(remminafile, "disablepasswordstoring", 0);
|
||||
/* Identify the protocol plugin and get pointers to its RemminaProtocolSetting structs */
|
||||
proto = (gchar *)g_hash_table_lookup(remminafile->settings, "protocol");
|
||||
if (proto)
|
||||
if (proto) {
|
||||
protocol_plugin = (RemminaProtocolPlugin *)remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, proto);
|
||||
else {
|
||||
} else {
|
||||
REMMINA_CRITICAL("Saving settings for unknown protocol:", proto);
|
||||
protocol_plugin = NULL;
|
||||
}
|
||||
@ -732,7 +726,7 @@ void remmina_file_save(RemminaFile *remminafile)
|
||||
if (remmina_plugin_manager_is_encrypted_setting(protocol_plugin, key)) {
|
||||
if (remminafile->filename && g_strcmp0(remminafile->filename, remmina_pref_file)) {
|
||||
if (secret_service_available && nopasswdsave == 0) {
|
||||
REMMINA_DEBUG ("We have a secret and disablepasswordstoring=0");
|
||||
REMMINA_DEBUG("We have a secret and disablepasswordstoring=0");
|
||||
if (value && value[0]) {
|
||||
if (g_strcmp0(value, ".") != 0)
|
||||
secret_plugin->store_password(remminafile, key, value);
|
||||
@ -742,7 +736,7 @@ void remmina_file_save(RemminaFile *remminafile)
|
||||
secret_plugin->delete_password(remminafile, key);
|
||||
}
|
||||
} else {
|
||||
REMMINA_DEBUG ("We have a password and disablepasswordstoring=0");
|
||||
REMMINA_DEBUG("We have a password and disablepasswordstoring=0");
|
||||
if (value && value[0] && nopasswdsave == 0) {
|
||||
s = remmina_crypt_encrypt(value);
|
||||
g_key_file_set_string(gkeyfile, KEYFILE_GROUP_REMMINA, key, s);
|
||||
@ -754,7 +748,7 @@ void remmina_file_save(RemminaFile *remminafile)
|
||||
if (secret_service_available && nopasswdsave == 1) {
|
||||
if (value && value[0]) {
|
||||
if (g_strcmp0(value, ".") != 0) {
|
||||
REMMINA_DEBUG ("Deleting the secret in the keyring as disablepasswordstoring=1");
|
||||
REMMINA_DEBUG("Deleting the secret in the keyring as disablepasswordstoring=1");
|
||||
secret_plugin->delete_password(remminafile, key);
|
||||
g_key_file_set_string(gkeyfile, KEYFILE_GROUP_REMMINA, key, ".");
|
||||
}
|
||||
@ -777,28 +771,25 @@ void remmina_file_save(RemminaFile *remminafile)
|
||||
/* Store gkeyfile to disk (password are already sent to keyring) */
|
||||
content = g_key_file_to_data(gkeyfile, &length, NULL);
|
||||
|
||||
if (g_file_set_contents(remminafile->filename, content, length, &err)) {
|
||||
REMMINA_DEBUG ("Profile saved");
|
||||
} else {
|
||||
if (g_file_set_contents(remminafile->filename, content, length, &err))
|
||||
REMMINA_DEBUG("Profile saved");
|
||||
else
|
||||
REMMINA_WARNING("Remmina connection profile cannot be saved, with error %d (%s)", err->code, err->message);
|
||||
}
|
||||
if (err != NULL)
|
||||
g_error_free (err);
|
||||
g_error_free(err);
|
||||
|
||||
g_free(content), content = NULL;
|
||||
/* Saving states */
|
||||
g_hash_table_iter_init(&iter, remminafile->states);
|
||||
while (g_hash_table_iter_next(&iter, (gpointer *)&key, (gpointer *)&value)) {
|
||||
while (g_hash_table_iter_next(&iter, (gpointer *)&key, (gpointer *)&value))
|
||||
g_key_file_set_string(gkeyfile, KEYFILE_GROUP_STATE, key, value);
|
||||
}
|
||||
content = g_key_file_to_data(gkeystate, &length, NULL);
|
||||
if (g_file_set_contents(remminafile->statefile, content, length, &err)) {
|
||||
REMMINA_DEBUG ("Connection profile states saved");
|
||||
} else {
|
||||
if (g_file_set_contents(remminafile->statefile, content, length, &err))
|
||||
REMMINA_DEBUG("Connection profile states saved");
|
||||
else
|
||||
REMMINA_WARNING("Remmina connection profile cannot be saved, with error %d (%s)", err->code, err->message);
|
||||
}
|
||||
if (err != NULL)
|
||||
g_error_free (err);
|
||||
g_error_free(err);
|
||||
g_free(content), content = NULL;
|
||||
g_key_file_free(gkeyfile);
|
||||
g_key_file_free(gkeystate);
|
||||
@ -852,7 +843,7 @@ remmina_file_get_icon_name(RemminaFile *remminafile)
|
||||
plugin = (RemminaProtocolPlugin *)remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL,
|
||||
remmina_file_get_string(remminafile, "protocol"));
|
||||
if (!plugin)
|
||||
return g_strconcat (REMMINA_APP_ID, "-symbolic", NULL);
|
||||
return g_strconcat(REMMINA_APP_ID, "-symbolic", NULL);
|
||||
|
||||
return remmina_file_get_int(remminafile, "ssh_tunnel_enabled", FALSE) ? plugin->icon_name_ssh : plugin->icon_name;
|
||||
}
|
||||
@ -888,19 +879,20 @@ remmina_file_get_state(RemminaFile *remminafile, const gchar *setting)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GKeyFile) key_file = g_key_file_new ();
|
||||
g_autoptr(GKeyFile) key_file = g_key_file_new();
|
||||
|
||||
if (!g_key_file_load_from_file (key_file, remminafile->statefile, G_KEY_FILE_NONE, &error)) {
|
||||
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
|
||||
REMMINA_CRITICAL ("Could not load the state file. %s", error->message);
|
||||
if (!g_key_file_load_from_file(key_file, remminafile->statefile, G_KEY_FILE_NONE, &error)) {
|
||||
if (!g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
|
||||
REMMINA_CRITICAL("Could not load the state file. %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_autofree gchar *val = g_key_file_get_string (key_file, KEYFILE_GROUP_STATE, setting, &error);
|
||||
g_autofree gchar *val = g_key_file_get_string(key_file, KEYFILE_GROUP_STATE, setting, &error);
|
||||
|
||||
if (val == NULL &&
|
||||
!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
|
||||
REMMINA_CRITICAL ("Could not find \"%s\" in the \"%s\" state file. %s",
|
||||
setting, remminafile->statefile, error->message);
|
||||
!g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
|
||||
REMMINA_CRITICAL("Could not find \"%s\" in the \"%s\" state file. %s",
|
||||
setting, remminafile->statefile, error->message);
|
||||
return NULL;
|
||||
}
|
||||
return val && val[0] ? val : NULL;
|
||||
@ -910,22 +902,22 @@ void remmina_file_state_last_success(RemminaFile *remminafile)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
|
||||
g_autoptr(GKeyFile) key_statefile = g_key_file_new ();
|
||||
g_autoptr(GKeyFile) key_remminafile = g_key_file_new ();
|
||||
g_autoptr(GKeyFile) key_statefile = g_key_file_new();
|
||||
g_autoptr(GKeyFile) key_remminafile = g_key_file_new();
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
const gchar *date = NULL;
|
||||
GDateTime *d = g_date_time_new_now_utc();
|
||||
|
||||
date = g_strdup_printf("%d%02d%02d",
|
||||
g_date_time_get_year(d),
|
||||
g_date_time_get_month(d),
|
||||
g_date_time_get_day_of_month(d));
|
||||
g_date_time_get_year(d),
|
||||
g_date_time_get_month(d),
|
||||
g_date_time_get_day_of_month(d));
|
||||
|
||||
g_key_file_set_string (key_statefile, KEYFILE_GROUP_STATE, "last_success", date);
|
||||
g_key_file_set_string(key_statefile, KEYFILE_GROUP_STATE, "last_success", date);
|
||||
|
||||
if (!g_key_file_save_to_file (key_statefile, remminafile->statefile, &error)) {
|
||||
REMMINA_CRITICAL ("Could not save the key file. %s", error->message);
|
||||
if (!g_key_file_save_to_file(key_statefile, remminafile->statefile, &error)) {
|
||||
REMMINA_CRITICAL("Could not save the key file. %s", error->message);
|
||||
return;
|
||||
}
|
||||
/* Delete old pre-1.5 keys */
|
||||
@ -941,6 +933,7 @@ void remmina_file_unsave_passwords(RemminaFile *remminafile)
|
||||
const RemminaProtocolSetting *setting_iter;
|
||||
RemminaProtocolPlugin *protocol_plugin;
|
||||
gchar *proto;
|
||||
|
||||
protocol_plugin = NULL;
|
||||
|
||||
remmina_file_set_string(remminafile, "password", NULL);
|
||||
@ -953,12 +946,11 @@ void remmina_file_unsave_passwords(RemminaFile *remminafile)
|
||||
if (setting_iter) {
|
||||
while (setting_iter->type != REMMINA_PROTOCOL_SETTING_TYPE_END) {
|
||||
// TOO VERBOSE: g_debug("setting name: %s", setting_iter->name);
|
||||
if (setting_iter->name == NULL) {
|
||||
if (setting_iter->name == NULL)
|
||||
g_error("Internal error: a setting name in protocol plugin %s is null. Please fix RemminaProtocolSetting struct content.", proto);
|
||||
} else {
|
||||
else
|
||||
if (remmina_plugin_manager_is_encrypted_setting(protocol_plugin, setting_iter->name))
|
||||
remmina_file_set_string(remminafile, remmina_plugin_manager_get_canonical_setting_name(setting_iter), NULL);
|
||||
}
|
||||
setting_iter++;
|
||||
}
|
||||
}
|
||||
@ -999,10 +991,10 @@ remmina_file_get_datetime(RemminaFile *remminafile)
|
||||
|
||||
guint64 mtime;
|
||||
|
||||
if (remminafile->statefile) {
|
||||
if (remminafile->statefile)
|
||||
//REMMINA_DEBUG ("remminafile->statefile: %s", remminafile->statefile);
|
||||
file = g_file_new_for_path(remminafile->statefile);
|
||||
} else
|
||||
else
|
||||
file = g_file_new_for_path(remminafile->filename);
|
||||
|
||||
info = g_file_query_info(file,
|
||||
@ -1022,11 +1014,11 @@ remmina_file_get_datetime(RemminaFile *remminafile)
|
||||
if (last_success) {
|
||||
//REMMINA_DEBUG ("Last success is %s", last_success);
|
||||
GDateTime *dt;
|
||||
dt = g_date_time_new_from_iso8601 (g_strconcat (last_success,"T00:00:00Z", NULL), NULL);
|
||||
dt = g_date_time_new_from_iso8601(g_strconcat(last_success, "T00:00:00Z", NULL), NULL);
|
||||
if (dt) {
|
||||
//REMMINA_DEBUG("Converting last_success");
|
||||
mtime = g_ascii_strtoull (g_date_time_format(dt, "%s"), NULL, 10);
|
||||
g_date_time_unref (dt);
|
||||
mtime = g_ascii_strtoull(g_date_time_format(dt, "%s"), NULL, 10);
|
||||
g_date_time_unref(dt);
|
||||
} else {
|
||||
//REMMINA_DEBUG("dt was null");
|
||||
mtime = 191543400;
|
||||
@ -1043,6 +1035,7 @@ remmina_file_get_datetime(RemminaFile *remminafile)
|
||||
strftime(time_string, sizeof(time_string), "%F - %T", ptm);
|
||||
|
||||
gchar *modtime_string = g_locale_to_utf8(time_string, -1, NULL, NULL, NULL);
|
||||
|
||||
return modtime_string;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ gchar *remmina_file_get_datadir(void)
|
||||
TRACE_CALL(__func__);
|
||||
const gchar *dir = ".remmina";
|
||||
int i;
|
||||
|
||||
/* From preferences, datadir_path */
|
||||
remminadir = remmina_pref_get_value("datadir_path");
|
||||
if (remminadir != NULL && strlen(remminadir) > 0)
|
||||
@ -79,6 +80,7 @@ gchar *remmina_file_get_datadir(void)
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
/* /usr/local/share/remmina */
|
||||
const gchar *const *dirs = g_get_system_data_dirs();
|
||||
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
for (i = 0; dirs[i] != NULL; ++i) {
|
||||
remminadir = g_build_path("/", dirs[i], "remmina", NULL);
|
||||
@ -122,14 +124,14 @@ void remmina_file_manager_init(void)
|
||||
/* Get and create the XDG_DATA_HOME directory */
|
||||
remminadir = remmina_pref_get_value("datadir_path");
|
||||
if (g_mkdir_with_parents(remminadir, 0750) == 0) {
|
||||
REMMINA_DEBUG ("Initialized the \"%s\" data folder", remminadir);
|
||||
REMMINA_DEBUG("Initialized the \"%s\" data folder", remminadir);
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
} else {
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
/* Get and create the XDG_DATA_HOME directory */
|
||||
remminadir = g_build_path("/", g_get_user_data_dir(), "remmina", NULL);
|
||||
if (g_mkdir_with_parents(remminadir, 0750) == 0)
|
||||
REMMINA_DEBUG ("Initialized the \"%s\" data folder", remminadir);
|
||||
REMMINA_DEBUG("Initialized the \"%s\" data folder", remminadir);
|
||||
else
|
||||
REMMINA_CRITICAL("Cannot create the \"%s\" data folder", remminadir);
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
@ -152,6 +154,7 @@ void remmina_file_manager_init(void)
|
||||
|
||||
/* XDG_DATA_DIRS, i.e. /usr/local/share/remmina */
|
||||
const gchar *const *dirs = g_get_system_data_dirs();
|
||||
|
||||
g_free(remminadir), remminadir = NULL;
|
||||
for (i = 0; dirs[i] != NULL; ++i) {
|
||||
remminadir = g_build_path("/", dirs[i], "remmina", NULL);
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
typedef struct _RemminaIcon {
|
||||
AppIndicator * icon;
|
||||
gboolean indicator_connected;
|
||||
gboolean indicator_connected;
|
||||
RemminaAvahi * avahi;
|
||||
guint32 popup_time;
|
||||
gchar * autostart_file;
|
||||
@ -310,10 +310,10 @@ gboolean remmina_icon_is_available(void)
|
||||
return FALSE;
|
||||
|
||||
if (remmina_icon.indicator_connected == FALSE) {
|
||||
REMMINA_DEBUG ("Indicator is not connected to panel, thus it cannot be displayed.");
|
||||
REMMINA_DEBUG("Indicator is not connected to panel, thus it cannot be displayed.");
|
||||
return FALSE;
|
||||
} else {
|
||||
REMMINA_DEBUG ("Indicator is connected to panel, thus it can be displayed.");
|
||||
REMMINA_DEBUG("Indicator is connected to panel, thus it can be displayed.");
|
||||
return TRUE;
|
||||
}
|
||||
/** Special treatment under GNOME Shell
|
||||
@ -325,7 +325,7 @@ gboolean remmina_icon_is_available(void)
|
||||
}
|
||||
|
||||
static void
|
||||
remmina_icon_connection_changed_cb (AppIndicator *indicator, gboolean connected, gpointer data)
|
||||
remmina_icon_connection_changed_cb(AppIndicator *indicator, gboolean connected, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
remmina_icon.indicator_connected = connected;
|
||||
@ -343,13 +343,14 @@ void remmina_icon_init(void)
|
||||
/* Print on stdout the availability of appindicators on DBUS */
|
||||
sni_supported = remmina_sysinfo_is_appindicator_available();
|
||||
|
||||
g_autofree gchar* wmname = g_ascii_strdown(remmina_sysinfo_get_wm_name (), -1);
|
||||
g_autofree gchar *wmname = g_ascii_strdown(remmina_sysinfo_get_wm_name(), -1);
|
||||
//TRANSLATORS: These are Linux desktop components to show icons in the system tray, after the “ there's the Desktop Name (like GNOME).
|
||||
g_autofree gchar *msg = g_strconcat (
|
||||
_("StatusNotifier/Appindicator support in “"),
|
||||
wmname,
|
||||
"”:",
|
||||
NULL);
|
||||
g_autofree gchar *msg = g_strconcat(
|
||||
_("StatusNotifier/Appindicator support in “"),
|
||||
wmname,
|
||||
"”:",
|
||||
NULL);
|
||||
|
||||
if (sni_supported) {
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s your desktop does support it"), msg);
|
||||
@ -359,22 +360,18 @@ void remmina_icon_init(void)
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s not supported natively by your Desktop Environment. libappindicator will try to fallback to GtkStatusIcon/xembed"), msg);
|
||||
}
|
||||
if (g_strrstr(wmname, "mate") != NULL) {
|
||||
if (g_strrstr(wmname, "mate") != NULL)
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s You may need to install, and use XApp Status Applet"), msg);
|
||||
}
|
||||
if (g_strrstr(wmname, "kde") != NULL) {
|
||||
if (g_strrstr(wmname, "kde") != NULL)
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s You may need to install, and use KStatusNotifierItem"), msg);
|
||||
}
|
||||
if (g_strrstr(wmname, "plasma") != NULL) {
|
||||
if (g_strrstr(wmname, "plasma") != NULL)
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s You may need to install, and use XEmbed SNI Proxy"), msg);
|
||||
}
|
||||
if (g_strrstr(wmname, "gnome") != NULL) {
|
||||
if (g_strrstr(wmname, "gnome") != NULL)
|
||||
//TRANSLATORS: %s is a placeholder for "StatusNotifier/Appindicator suppor in “DESKTOP NAME”: "
|
||||
REMMINA_INFO(_("%s You may need to install, and use Gnome Shell Extension Appindicator"), msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -408,7 +405,7 @@ void remmina_icon_init(void)
|
||||
remmina_icon_create_autostart_file();
|
||||
}
|
||||
// "connected" property means a visible indicator, otherwise could be hidden. or fall back to GtkStatusIcon
|
||||
g_signal_connect (G_OBJECT(remmina_icon.icon), "connection-changed", G_CALLBACK(remmina_icon_connection_changed_cb), NULL);
|
||||
g_signal_connect(G_OBJECT(remmina_icon.icon), "connection-changed", G_CALLBACK(remmina_icon_connection_changed_cb), NULL);
|
||||
g_object_get(G_OBJECT(remmina_icon.icon), "connected", &remmina_icon.indicator_connected, NULL);
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,12 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define REMMINA_INFO(fmt, ...) _remmina_info(fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_MESSAGE(fmt, ...) _remmina_message(fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_DEBUG(fmt, ...) _remmina_debug(__func__, fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_WARNING(fmt, ...) _remmina_warning(__func__, fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_ERROR(fmt, ...) _remmina_error(__func__, fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_CRITICAL(fmt, ...) _remmina_critical(__func__, fmt, ##__VA_ARGS__)
|
||||
#define REMMINA_INFO(fmt, ...) _remmina_info(fmt, ## __VA_ARGS__)
|
||||
#define REMMINA_MESSAGE(fmt, ...) _remmina_message(fmt, ## __VA_ARGS__)
|
||||
#define REMMINA_DEBUG(fmt, ...) _remmina_debug(__func__, fmt, ## __VA_ARGS__)
|
||||
#define REMMINA_WARNING(fmt, ...) _remmina_warning(__func__, fmt, ## __VA_ARGS__)
|
||||
#define REMMINA_ERROR(fmt, ...) _remmina_error(__func__, fmt, ## __VA_ARGS__)
|
||||
#define REMMINA_CRITICAL(fmt, ...) _remmina_critical(__func__, fmt, ## __VA_ARGS__)
|
||||
|
||||
void remmina_log_start(void);
|
||||
gboolean remmina_log_running(void);
|
||||
|
@ -89,33 +89,33 @@ const gchar *supported_mime_types[] = {
|
||||
};
|
||||
|
||||
static GActionEntry app_actions[] = {
|
||||
{ "about", remmina_main_on_action_application_about, NULL, NULL, NULL },
|
||||
{ "news", remmina_main_on_action_application_news, NULL, NULL, NULL },
|
||||
{ "default", remmina_main_on_action_application_default, NULL, NULL, NULL },
|
||||
{ "mpchange", remmina_main_on_action_application_mpchange, NULL, NULL, NULL },
|
||||
{ "plugins", remmina_main_on_action_application_plugins, NULL, NULL, NULL },
|
||||
{ "preferences", remmina_main_on_action_application_preferences, "i", NULL, NULL },
|
||||
{ "dark", remmina_main_on_action_application_dark_theme, NULL, NULL, NULL },
|
||||
{ "debug", remmina_main_on_action_help_debug, NULL, NULL, NULL },
|
||||
{ "community", remmina_main_on_action_help_community, NULL, NULL, NULL },
|
||||
{ "donations", remmina_main_on_action_help_donations, NULL, NULL, NULL },
|
||||
{ "homepage", remmina_main_on_action_help_homepage, NULL, NULL, NULL },
|
||||
{ "wiki", remmina_main_on_action_help_wiki, NULL, NULL, NULL },
|
||||
{ "quit", remmina_main_on_action_application_quit, NULL, NULL, NULL },
|
||||
{ "about", remmina_main_on_action_application_about, NULL, NULL, NULL },
|
||||
{ "news", remmina_main_on_action_application_news, NULL, NULL, NULL },
|
||||
{ "default", remmina_main_on_action_application_default, NULL, NULL, NULL },
|
||||
{ "mpchange", remmina_main_on_action_application_mpchange, NULL, NULL, NULL },
|
||||
{ "plugins", remmina_main_on_action_application_plugins, NULL, NULL, NULL },
|
||||
{ "preferences", remmina_main_on_action_application_preferences, "i", NULL, NULL },
|
||||
{ "dark", remmina_main_on_action_application_dark_theme, NULL, NULL, NULL },
|
||||
{ "debug", remmina_main_on_action_help_debug, NULL, NULL, NULL },
|
||||
{ "community", remmina_main_on_action_help_community, NULL, NULL, NULL },
|
||||
{ "donations", remmina_main_on_action_help_donations, NULL, NULL, NULL },
|
||||
{ "homepage", remmina_main_on_action_help_homepage, NULL, NULL, NULL },
|
||||
{ "wiki", remmina_main_on_action_help_wiki, NULL, NULL, NULL },
|
||||
{ "quit", remmina_main_on_action_application_quit, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static GActionEntry main_actions[] = {
|
||||
{ "connect", remmina_main_on_action_connection_connect, NULL, NULL, NULL },
|
||||
{ "copy", remmina_main_on_action_connection_copy, NULL, NULL, NULL },
|
||||
{ "delete", remmina_main_on_action_connection_delete, NULL, NULL, NULL },
|
||||
{ "edit", remmina_main_on_action_connection_edit, NULL, NULL, NULL },
|
||||
{ "exttools", remmina_main_on_action_connection_external_tools, NULL, NULL, NULL },
|
||||
{ "new", remmina_main_on_action_connection_new, NULL, NULL, NULL },
|
||||
{ "export", remmina_main_on_action_tools_export, NULL, NULL, NULL },
|
||||
{ "import", remmina_main_on_action_tools_import, NULL, NULL, NULL },
|
||||
{ "expand", remmina_main_on_action_expand, NULL, NULL, NULL },
|
||||
{ "collapse", remmina_main_on_action_collapse, NULL, NULL, NULL },
|
||||
{ "search", remmina_main_on_action_search_toggle, NULL, NULL, NULL },
|
||||
{ "connect", remmina_main_on_action_connection_connect, NULL, NULL, NULL },
|
||||
{ "copy", remmina_main_on_action_connection_copy, NULL, NULL, NULL },
|
||||
{ "delete", remmina_main_on_action_connection_delete, NULL, NULL, NULL },
|
||||
{ "edit", remmina_main_on_action_connection_edit, NULL, NULL, NULL },
|
||||
{ "exttools", remmina_main_on_action_connection_external_tools, NULL, NULL, NULL },
|
||||
{ "new", remmina_main_on_action_connection_new, NULL, NULL, NULL },
|
||||
{ "export", remmina_main_on_action_tools_export, NULL, NULL, NULL },
|
||||
{ "import", remmina_main_on_action_tools_import, NULL, NULL, NULL },
|
||||
{ "expand", remmina_main_on_action_expand, NULL, NULL, NULL },
|
||||
{ "collapse", remmina_main_on_action_collapse, NULL, NULL, NULL },
|
||||
{ "search", remmina_main_on_action_search_toggle, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static GtkTargetEntry remmina_drop_types[] =
|
||||
@ -248,7 +248,7 @@ void remmina_main_on_destroy_event()
|
||||
/* Invalidate remminamain->window to avoid multiple destructions */
|
||||
remminamain->window = NULL;
|
||||
/* Destroy remminamain struct, later. We can't destroy
|
||||
important objects like the builder now */
|
||||
* important objects like the builder now */
|
||||
g_idle_add(remmina_main_idle_destroy, NULL);
|
||||
}
|
||||
}
|
||||
@ -293,7 +293,7 @@ static void remmina_main_show_snap_welcome()
|
||||
}
|
||||
|
||||
if (need_snap_interface_connections && !remmina_pref.prevent_snap_welcome_message) {
|
||||
dlgbuilder = remmina_public_gtk_builder_new_from_resource ("/org/remmina/Remmina/src/../data/ui/remmina_snap_info_dialog.glade");
|
||||
dlgbuilder = remmina_public_gtk_builder_new_from_resource("/org/remmina/Remmina/src/../data/ui/remmina_snap_info_dialog.glade");
|
||||
dsa = GTK_WIDGET(gtk_builder_get_object(dlgbuilder, "dontshowagain"));
|
||||
if (dlgbuilder) {
|
||||
parent = remmina_main_get_window();
|
||||
@ -331,17 +331,18 @@ static gboolean remmina_main_selection_func(GtkTreeSelection *selection, GtkTree
|
||||
remmina_main_clear_selection_data();
|
||||
|
||||
gtk_tree_model_get(model, &iter,
|
||||
NAME_COLUMN, &remminamain->priv->selected_name,
|
||||
FILENAME_COLUMN, &remminamain->priv->selected_filename,
|
||||
-1);
|
||||
NAME_COLUMN, &remminamain->priv->selected_name,
|
||||
FILENAME_COLUMN, &remminamain->priv->selected_filename,
|
||||
-1);
|
||||
|
||||
context_id = gtk_statusbar_get_context_id(remminamain->statusbar_main, "status");
|
||||
gtk_statusbar_pop(remminamain->statusbar_main, context_id);
|
||||
if (remminamain->priv->selected_filename) {
|
||||
g_snprintf(buf, sizeof(buf), "%s (%s)", remminamain->priv->selected_name, remminamain->priv->selected_filename);
|
||||
gtk_statusbar_push(remminamain->statusbar_main, context_id, buf);
|
||||
} else
|
||||
} else {
|
||||
gtk_statusbar_push(remminamain->statusbar_main, context_id, remminamain->priv->selected_name);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -351,6 +352,7 @@ static void remmina_main_load_file_list_callback(RemminaFile *remminafile, gpoin
|
||||
TRACE_CALL(__func__);
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
|
||||
store = GTK_LIST_STORE(user_data);
|
||||
gchar *datetime;
|
||||
|
||||
@ -486,7 +488,7 @@ static void remmina_main_load_file_tree_callback(RemminaFile *remminafile, gpoin
|
||||
remmina_file_get_string(remminafile, "group"));
|
||||
|
||||
datetime = remmina_file_get_datetime(remminafile);
|
||||
REMMINA_DEBUG ("The date is %s", datetime);
|
||||
REMMINA_DEBUG("The date is %s", datetime);
|
||||
gtk_tree_store_append(store, &child, (found ? &iter : NULL));
|
||||
gtk_tree_store_set(store, &child,
|
||||
PROTOCOL_COLUMN, remmina_file_get_icon_name(remminafile),
|
||||
@ -659,11 +661,12 @@ static void remmina_main_load_files()
|
||||
remmina_main_select_file(save_selected_filename);
|
||||
g_free(save_selected_filename);
|
||||
}
|
||||
gtk_tree_view_column_set_widget (remminamain->column_files_list_date, NULL);
|
||||
gtk_tree_view_column_set_widget(remminamain->column_files_list_date, NULL);
|
||||
|
||||
GtkWidget *label = gtk_tree_view_column_get_button(remminamain->column_files_list_date);
|
||||
|
||||
GtkWidget *label = gtk_tree_view_column_get_button (remminamain->column_files_list_date);
|
||||
gtk_widget_set_tooltip_text(GTK_WIDGET(label),
|
||||
_("The latest successful connection attempt, or a pre-computed date"));
|
||||
_("The latest successful connection attempt, or a pre-computed date"));
|
||||
/* Show in the status bar the total number of connections found */
|
||||
g_snprintf(buf, sizeof(buf), ngettext("Total %i item.", "Total %i items.", items_count), items_count);
|
||||
context_id = gtk_statusbar_get_context_id(remminamain->statusbar_main, "status");
|
||||
@ -763,7 +766,7 @@ void remmina_main_on_action_connection_new(GSimpleAction *action, GVariant *para
|
||||
remmina_main_load_files();
|
||||
}
|
||||
|
||||
static gboolean remmina_main_search_key_event (GtkWidget *search_entry, GdkEventKey *event, gpointer user_data)
|
||||
static gboolean remmina_main_search_key_event(GtkWidget *search_entry, GdkEventKey *event, gpointer user_data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
if (event->keyval == GDK_KEY_Escape) {
|
||||
@ -774,7 +777,7 @@ static gboolean remmina_main_search_key_event (GtkWidget *search_entry, GdkEvent
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean remmina_main_tree_row_activated (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
|
||||
static gboolean remmina_main_tree_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
if (gtk_tree_view_row_expanded(tree, path))
|
||||
@ -874,7 +877,8 @@ void remmina_main_on_action_connection_delete(GSimpleAction *action, GVariant *p
|
||||
void remmina_main_on_accel_application_preferences(GSimpleAction *action, GVariant *param, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
GVariant *v = g_variant_new ("i", 0);
|
||||
GVariant *v = g_variant_new("i", 0);
|
||||
|
||||
remmina_main_on_action_application_preferences(NULL, v, NULL);
|
||||
}
|
||||
|
||||
@ -883,22 +887,25 @@ void remmina_main_on_action_application_preferences(GSimpleAction *action, GVari
|
||||
TRACE_CALL(__func__);
|
||||
GtkSettings *settings;
|
||||
|
||||
REMMINA_DEBUG ("Opening the preferences");
|
||||
REMMINA_DEBUG("Opening the preferences");
|
||||
gint32 tab_num;
|
||||
|
||||
if (param) {
|
||||
REMMINA_DEBUG ("Parameter passed to preferences of type %s", g_variant_get_type_string(param));
|
||||
tab_num = g_variant_get_int32 (param);
|
||||
REMMINA_DEBUG ("We got a parameter for the preferences: %d", tab_num);
|
||||
} else
|
||||
REMMINA_DEBUG("Parameter passed to preferences of type %s", g_variant_get_type_string(param));
|
||||
tab_num = g_variant_get_int32(param);
|
||||
REMMINA_DEBUG("We got a parameter for the preferences: %d", tab_num);
|
||||
} else {
|
||||
tab_num = 0;
|
||||
}
|
||||
|
||||
if (remmina_unlock_new(remminamain->window) == 0)
|
||||
return;
|
||||
GtkWidget *widget = remmina_pref_dialog_new(tab_num, remminamain->window);
|
||||
|
||||
gtk_widget_show_all(widget);
|
||||
/* Switch to a dark theme if the user enabled it */
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_set (settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
settings = gtk_settings_get_default();
|
||||
g_object_set(settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
}
|
||||
|
||||
void remmina_main_on_action_application_default(GSimpleAction *action, GVariant *param, gpointer data)
|
||||
@ -1052,7 +1059,7 @@ void remmina_main_on_action_application_dark_theme(GSimpleAction *action, GVaria
|
||||
TRACE_CALL(__func__);
|
||||
GtkSettings *settings;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
settings = gtk_settings_get_default();
|
||||
|
||||
if (gtk_switch_get_active(remminamain->switch_dark_mode))
|
||||
remmina_pref.dark_theme = 1;
|
||||
@ -1060,7 +1067,7 @@ void remmina_main_on_action_application_dark_theme(GSimpleAction *action, GVaria
|
||||
remmina_pref.dark_theme = 0;
|
||||
remmina_pref_save();
|
||||
|
||||
g_object_set (settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
g_object_set(settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
}
|
||||
|
||||
void remmina_main_on_action_help_homepage(GSimpleAction *action, GVariant *param, gpointer data)
|
||||
@ -1102,10 +1109,10 @@ void remmina_main_on_action_application_about(GSimpleAction *action, GVariant *p
|
||||
void remmina_main_on_action_application_news(GSimpleAction *action, GVariant *param, gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
REMMINA_DEBUG ("Setting news counters to 0");
|
||||
REMMINA_DEBUG("Setting news counters to 0");
|
||||
remmina_pref.periodic_rmnews_last_get = 0;
|
||||
remmina_pref.periodic_rmnews_get_count = 0;
|
||||
REMMINA_DEBUG ("Saving preferences");
|
||||
REMMINA_DEBUG("Saving preferences");
|
||||
remmina_pref_save();
|
||||
};
|
||||
|
||||
@ -1149,7 +1156,7 @@ static gboolean remmina_main_quickconnect(void)
|
||||
if (g_strrstr(server, "/") != NULL)
|
||||
return FALSE;
|
||||
//if (g_str_has_suffix (server, "/"))
|
||||
//return FALSE;
|
||||
//return FALSE;
|
||||
if (is_empty(server))
|
||||
return FALSE;
|
||||
|
||||
@ -1157,10 +1164,10 @@ static gboolean remmina_main_quickconnect(void)
|
||||
server_trimmed = g_strdup(server);
|
||||
g_strstrip(server_trimmed);
|
||||
gchar **strings = g_strsplit(server_trimmed, ":", 2);
|
||||
if (strings[0]!=NULL) {
|
||||
|
||||
if (strings[0] != NULL)
|
||||
if (g_hostname_is_ip_address(strings[0]))
|
||||
g_stpcpy(server, server_trimmed);
|
||||
}
|
||||
|
||||
remmina_file_set_string(remminafile, "sound", "off");
|
||||
remmina_file_set_string(remminafile, "server", server);
|
||||
@ -1200,13 +1207,14 @@ void remmina_main_on_action_search_toggle(GSimpleAction *action, GVariant *param
|
||||
TRACE_CALL(__func__);
|
||||
REMMINA_DEBUG("Search toggle triggered");
|
||||
gboolean toggle_status = gtk_toggle_button_get_active(remminamain->search_toggle);
|
||||
|
||||
gtk_search_bar_set_search_mode(remminamain->search_bar, toggle_status);
|
||||
if (toggle_status) {
|
||||
REMMINA_DEBUG("Search toggle is active");
|
||||
gtk_widget_grab_focus (GTK_WIDGET(remminamain->entry_quick_connect_server));
|
||||
gtk_widget_grab_focus(GTK_WIDGET(remminamain->entry_quick_connect_server));
|
||||
} else {
|
||||
REMMINA_DEBUG("Search toggle is not active, focus is tree_files_list");
|
||||
gtk_widget_grab_focus (GTK_WIDGET(remminamain->tree_files_list));
|
||||
gtk_widget_grab_focus(GTK_WIDGET(remminamain->tree_files_list));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1345,8 +1353,8 @@ static void remmina_main_init(void)
|
||||
|
||||
REMMINA_DEBUG("Initializing the Remmina main window");
|
||||
/* Switch to a dark theme if the user enabled it */
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_set (settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
settings = gtk_settings_get_default();
|
||||
g_object_set(settings, "gtk-application-prefer-dark-theme", remmina_pref.dark_theme, NULL);
|
||||
|
||||
remminamain->priv->expanded_group = remmina_string_array_new_from_string(remmina_pref.expanded_group);
|
||||
if (!kioskmode && kioskmode == FALSE)
|
||||
@ -1389,7 +1397,7 @@ static void remmina_main_init(void)
|
||||
/** @todo Set entry_quick_connect_server as default search entry. Weirdly. This does not work yet. */
|
||||
gtk_tree_view_set_search_entry(remminamain->tree_files_list, GTK_ENTRY(remminamain->entry_quick_connect_server));
|
||||
if (remmina_pref.hide_searchbar)
|
||||
gtk_widget_grab_focus (GTK_WIDGET(remminamain->tree_files_list));
|
||||
gtk_widget_grab_focus(GTK_WIDGET(remminamain->tree_files_list));
|
||||
/* Load the files list */
|
||||
remmina_main_load_files();
|
||||
|
||||
@ -1423,7 +1431,7 @@ GtkWidget *remmina_main_new(void)
|
||||
remminamain = g_new0(RemminaMain, 1);
|
||||
remminamain->priv = g_new0(RemminaMainPriv, 1);
|
||||
/* Assign UI widgets to the private members */
|
||||
remminamain->builder = remmina_public_gtk_builder_new_from_resource ("/org/remmina/Remmina/src/../data/ui/remmina_main.glade");
|
||||
remminamain->builder = remmina_public_gtk_builder_new_from_resource("/org/remmina/Remmina/src/../data/ui/remmina_main.glade");
|
||||
remminamain->window = GTK_WINDOW(RM_GET_OBJECT("RemminaMain"));
|
||||
if (kioskmode && kioskmode == TRUE) {
|
||||
gtk_window_set_position(remminamain->window, GTK_WIN_POS_CENTER_ALWAYS);
|
||||
@ -1468,8 +1476,8 @@ GtkWidget *remmina_main_new(void)
|
||||
remminamain->column_files_list_date = GTK_TREE_VIEW_COLUMN(RM_GET_OBJECT("column_files_list_date"));
|
||||
remminamain->statusbar_main = GTK_STATUSBAR(RM_GET_OBJECT("statusbar_main"));
|
||||
/* signals */
|
||||
g_signal_connect (remminamain->entry_quick_connect_server, "key-release-event", G_CALLBACK (remmina_main_search_key_event), NULL);
|
||||
g_signal_connect (remminamain->tree_files_list, "row-activated", G_CALLBACK (remmina_main_tree_row_activated), NULL);
|
||||
g_signal_connect(remminamain->entry_quick_connect_server, "key-release-event", G_CALLBACK(remmina_main_search_key_event), NULL);
|
||||
g_signal_connect(remminamain->tree_files_list, "row-activated", G_CALLBACK(remmina_main_tree_row_activated), NULL);
|
||||
/* Non widget objects */
|
||||
actions = g_simple_action_group_new();
|
||||
g_action_map_add_action_entries(G_ACTION_MAP(actions), app_actions, G_N_ELEMENTS(app_actions), remminamain->window);
|
||||
|
@ -144,8 +144,8 @@ static void remmina_protocol_widget_class_init(RemminaProtocolWidgetClass *klass
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
remmina_protocol_widget_signals[LOCK_DYNRES_SIGNAL] = g_signal_new("lock-dynres", G_TYPE_FROM_CLASS(klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, lock_dynres), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, lock_dynres), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
remmina_protocol_widget_signals[UNLOCK_DYNRES_SIGNAL] = g_signal_new("unlock-dynres", G_TYPE_FROM_CLASS(klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, unlock_dynres), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
@ -158,11 +158,11 @@ static void remmina_protocol_widget_close_all_tunnels(RemminaProtocolWidget *gp)
|
||||
int i;
|
||||
|
||||
if (gp->priv->ssh_tunnels) {
|
||||
for(i = 0;i < gp->priv->ssh_tunnels->len; i++) {
|
||||
for (i = 0; i < gp->priv->ssh_tunnels->len; i++) {
|
||||
#ifdef HAVE_LIBSSH
|
||||
remmina_ssh_tunnel_free((RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[i]);
|
||||
#else
|
||||
REMMINA_DEBUG ("LibSSH support turned off, no need to free SSH tunnel data");
|
||||
REMMINA_DEBUG("LibSSH support turned off, no need to free SSH tunnel data");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -276,7 +276,7 @@ void remmina_protocol_widget_open_connection_real(gpointer data)
|
||||
feature += num_plugin;
|
||||
}
|
||||
#ifdef HAVE_LIBSSH
|
||||
REMMINA_DEBUG("Have SSH");
|
||||
REMMINA_DEBUG("Have SSH");
|
||||
if (num_ssh) {
|
||||
feature->type = REMMINA_PROTOCOL_FEATURE_TYPE_TOOL;
|
||||
feature->id = REMMINA_PROTOCOL_FEATURE_TOOL_SSH;
|
||||
@ -367,9 +367,8 @@ static gboolean conn_opened(gpointer data)
|
||||
|
||||
#ifdef HAVE_LIBSSH
|
||||
if (gp->priv->ssh_tunnels) {
|
||||
for(guint i = 0;i < gp->priv->ssh_tunnels->len; i++) {
|
||||
for (guint i = 0; i < gp->priv->ssh_tunnels->len; i++)
|
||||
remmina_ssh_tunnel_cancel_accept((RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (gp->priv->listen_message_panel) {
|
||||
@ -412,6 +411,7 @@ static gboolean lock_dynres(gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaProtocolWidget *gp = (RemminaProtocolWidget *)data;
|
||||
|
||||
g_signal_emit_by_name(G_OBJECT(gp), "lock-dynres");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -420,6 +420,7 @@ static gboolean unlock_dynres(gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaProtocolWidget *gp = (RemminaProtocolWidget *)data;
|
||||
|
||||
g_signal_emit_by_name(G_OBJECT(gp), "unlock-dynres");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -442,6 +443,7 @@ static gboolean desktop_resize(gpointer data)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaProtocolWidget *gp = (RemminaProtocolWidget *)data;
|
||||
|
||||
g_signal_emit_by_name(G_OBJECT(gp), "desktop-resize");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -506,6 +508,7 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget *gp, GtkMenuI
|
||||
guint keyval;
|
||||
GdkKeymapKey *keys;
|
||||
gint n_keys;
|
||||
|
||||
/* Single keystroke replace */
|
||||
typedef struct _KeystrokeReplace {
|
||||
gchar * search;
|
||||
@ -522,17 +525,18 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget *gp, GtkMenuI
|
||||
{ "\\\\", "\\", GDK_KEY_backslash },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
/* Keystrokes can only be sent to plugins that accepts them */
|
||||
if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) {
|
||||
/* Replace special characters */
|
||||
for (i = 0; keystrokes_replaces[i].replace; i++) {
|
||||
REMMINA_DEBUG("Keystrokes before replacement is \'%s\'", keystrokes);
|
||||
keystrokes = g_strdup(remmina_public_str_replace_in_place(keystrokes,
|
||||
keystrokes_replaces[i].search,
|
||||
keystrokes_replaces[i].replace));
|
||||
keystrokes_replaces[i].search,
|
||||
keystrokes_replaces[i].replace));
|
||||
REMMINA_DEBUG("Keystrokes after replacement is \'%s\'", keystrokes);
|
||||
}
|
||||
gchar *iter = g_strdup(keystrokes);
|
||||
gchar *iter = g_strdup(keystrokes);
|
||||
keyvals = (guint *)g_malloc(strlen(keystrokes));
|
||||
while (TRUE) {
|
||||
/* Process each character in the keystrokes */
|
||||
@ -596,6 +600,7 @@ void remmina_protocol_widget_send_clip_strokes(GtkClipboard *clipboard, const gc
|
||||
guint keyval;
|
||||
GdkKeymapKey *keys;
|
||||
gint n_keys;
|
||||
|
||||
/* Single keystroke replace */
|
||||
typedef struct _KeystrokeReplace {
|
||||
gchar * search;
|
||||
@ -612,14 +617,15 @@ void remmina_protocol_widget_send_clip_strokes(GtkClipboard *clipboard, const gc
|
||||
{ "\\\\", "\\", GDK_KEY_backslash },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
if (remmina_protocol_widget_plugin_receives_keystrokes(gp)) {
|
||||
if(text) {
|
||||
if (text) {
|
||||
/* Replace special characters */
|
||||
for (i = 0; text_replaces[i].replace; i++) {
|
||||
REMMINA_DEBUG("Text clipboard before replacement is \'%s\'", text);
|
||||
text = g_strdup(remmina_public_str_replace_in_place(text,
|
||||
text_replaces[i].search,
|
||||
text_replaces[i].replace));
|
||||
text_replaces[i].search,
|
||||
text_replaces[i].replace));
|
||||
REMMINA_DEBUG("Text clipboard after replacement is \'%s\'", text);
|
||||
}
|
||||
gchar *iter = g_strdup(text);
|
||||
@ -679,13 +685,13 @@ void remmina_protocol_widget_send_clipboard(RemminaProtocolWidget *gp, GtkMenuIt
|
||||
TRACE_CALL(__func__);
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
|
||||
|
||||
/* Request the contents of the clipboard, contents_received will be
|
||||
called when we do get the contents.
|
||||
*/
|
||||
gtk_clipboard_request_text (clipboard,
|
||||
remmina_protocol_widget_send_clip_strokes, gp);
|
||||
* called when we do get the contents.
|
||||
*/
|
||||
gtk_clipboard_request_text(clipboard,
|
||||
remmina_protocol_widget_send_clip_strokes, gp);
|
||||
}
|
||||
|
||||
gboolean remmina_protocol_widget_plugin_screenshot(RemminaProtocolWidget *gp, RemminaPluginScreenshotData *rpsd)
|
||||
@ -707,7 +713,7 @@ gboolean remmina_protocol_widget_map_event(RemminaProtocolWidget *gp)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
REMMINA_DEBUG ("Calling plugin mapping function");
|
||||
REMMINA_DEBUG("Calling plugin mapping function");
|
||||
return gp->priv->plugin->map_event(gp);
|
||||
}
|
||||
|
||||
@ -719,7 +725,7 @@ gboolean remmina_protocol_widget_unmap_event(RemminaProtocolWidget *gp)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
REMMINA_DEBUG ("Calling plugin unmapping function");
|
||||
REMMINA_DEBUG("Calling plugin unmapping function");
|
||||
return gp->priv->plugin->unmap_event(gp);
|
||||
}
|
||||
|
||||
@ -795,7 +801,7 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget *gp, cons
|
||||
if (gp->priv->ssh_tunnels && gp->priv->ssh_tunnels->len > 0) {
|
||||
rcw_open_from_file_full(
|
||||
remmina_file_dup_temp_protocol(gp->priv->remmina_file, "SSH"), NULL,
|
||||
(RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[0], NULL);
|
||||
(RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[0], NULL);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -804,7 +810,7 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget *gp, cons
|
||||
if (gp->priv->ssh_tunnels && gp->priv->ssh_tunnels->len > 0) {
|
||||
rcw_open_from_file_full(
|
||||
remmina_file_dup_temp_protocol(gp->priv->remmina_file, "SFTP"), NULL,
|
||||
gp->priv->ssh_tunnels->pdata[0], NULL);
|
||||
gp->priv->ssh_tunnels->pdata[0], NULL);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -892,7 +898,7 @@ static void cancel_init_tunnel_cb(void *cbdata, int btn)
|
||||
printf("Remmina: Cancelling an opening tunnel is not implemented\n");
|
||||
}
|
||||
|
||||
static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidget *gp)
|
||||
static RemminaSSHTunnel *remmina_protocol_widget_init_tunnel(RemminaProtocolWidget *gp)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaSSHTunnel *tunnel;
|
||||
@ -904,7 +910,7 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg
|
||||
|
||||
tunnel = remmina_ssh_tunnel_new_from_file(gp->priv->remmina_file);
|
||||
|
||||
REMMINA_DEBUG ("Creating SSH tunnel to “%s” via SSH…", REMMINA_SSH(tunnel)->server);
|
||||
REMMINA_DEBUG("Creating SSH tunnel to “%s” via SSH…", REMMINA_SSH(tunnel)->server);
|
||||
// TRANSLATORS: “%s” is a placeholder for an hostname or an IP address.
|
||||
msg = g_strdup_printf(_("Connecting to “%s” via SSH…"), REMMINA_SSH(tunnel)->server);
|
||||
|
||||
@ -924,38 +930,38 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg
|
||||
}
|
||||
|
||||
ret = remmina_ssh_auth_gui(REMMINA_SSH(tunnel), gp, gp->priv->remmina_file);
|
||||
REMMINA_DEBUG ("Tunnel auth returned %d", ret);
|
||||
REMMINA_DEBUG("Tunnel auth returned %d", ret);
|
||||
switch (ret) {
|
||||
case REMMINA_SSH_AUTH_SUCCESS:
|
||||
REMMINA_DEBUG("Authentication success");
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_PARTIAL:
|
||||
REMMINA_DEBUG("Continue with the next auth method");
|
||||
partial = TRUE;
|
||||
// Continue the loop: OK
|
||||
continue;
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_RECONNECT:
|
||||
REMMINA_DEBUG("Reconnecting…");
|
||||
if (REMMINA_SSH(tunnel)->session) {
|
||||
ssh_disconnect(REMMINA_SSH(tunnel)->session);
|
||||
ssh_free(REMMINA_SSH(tunnel)->session);
|
||||
REMMINA_SSH(tunnel)->session = NULL;
|
||||
}
|
||||
g_free(REMMINA_SSH(tunnel)->callback);
|
||||
// Continue the loop: OK
|
||||
continue;
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_USERCANCEL:
|
||||
REMMINA_DEBUG("Interrupted by the user");
|
||||
// exit the loop here: OK
|
||||
goto BREAK;
|
||||
break;
|
||||
default:
|
||||
REMMINA_DEBUG("Error during the authentication: %s", REMMINA_SSH(tunnel)->error);
|
||||
remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error);
|
||||
// exit the loop here: OK
|
||||
goto BREAK;
|
||||
case REMMINA_SSH_AUTH_SUCCESS:
|
||||
REMMINA_DEBUG("Authentication success");
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_PARTIAL:
|
||||
REMMINA_DEBUG("Continue with the next auth method");
|
||||
partial = TRUE;
|
||||
// Continue the loop: OK
|
||||
continue;
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_RECONNECT:
|
||||
REMMINA_DEBUG("Reconnecting…");
|
||||
if (REMMINA_SSH(tunnel)->session) {
|
||||
ssh_disconnect(REMMINA_SSH(tunnel)->session);
|
||||
ssh_free(REMMINA_SSH(tunnel)->session);
|
||||
REMMINA_SSH(tunnel)->session = NULL;
|
||||
}
|
||||
g_free(REMMINA_SSH(tunnel)->callback);
|
||||
// Continue the loop: OK
|
||||
continue;
|
||||
break;
|
||||
case REMMINA_SSH_AUTH_USERCANCEL:
|
||||
REMMINA_DEBUG("Interrupted by the user");
|
||||
// exit the loop here: OK
|
||||
goto BREAK;
|
||||
break;
|
||||
default:
|
||||
REMMINA_DEBUG("Error during the authentication: %s", REMMINA_SSH(tunnel)->error);
|
||||
remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error);
|
||||
// exit the loop here: OK
|
||||
goto BREAK;
|
||||
}
|
||||
|
||||
|
||||
@ -966,14 +972,14 @@ static RemminaSSHTunnel* remmina_protocol_widget_init_tunnel(RemminaProtocolWidg
|
||||
#if 0
|
||||
|
||||
if (!remmina_ssh_init_session(REMMINA_SSH(tunnel))) {
|
||||
REMMINA_DEBUG ("Cannot init SSH session with tunnel struct");
|
||||
REMMINA_DEBUG("Cannot init SSH session with tunnel struct");
|
||||
remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error);
|
||||
remmina_ssh_tunnel_free(tunnel);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = remmina_ssh_auth_gui(REMMINA_SSH(tunnel), gp, gp->priv->remmina_file);
|
||||
REMMINA_DEBUG ("Tunnel auth returned %d", ret);
|
||||
REMMINA_DEBUG("Tunnel auth returned %d", ret);
|
||||
if (ret != REMMINA_SSH_AUTH_SUCCESS) {
|
||||
if (ret != REMMINA_SSH_AUTH_USERCANCEL)
|
||||
remmina_protocol_widget_set_error(gp, REMMINA_SSH(tunnel)->error);
|
||||
@ -1009,12 +1015,12 @@ static gboolean remmina_protocol_widget_tunnel_destroy(RemminaSSHTunnel *tunnel,
|
||||
guint idx;
|
||||
gboolean found;
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,54,0)
|
||||
#if GLIB_CHECK_VERSION(2, 54, 0)
|
||||
found = g_ptr_array_find(gp->priv->ssh_tunnels, tunnel, &idx);
|
||||
#else
|
||||
int i;
|
||||
found = FALSE;
|
||||
for(i = 0;i < gp->priv->ssh_tunnels->len; i++) {
|
||||
for (i = 0; i < gp->priv->ssh_tunnels->len; i++) {
|
||||
if ((RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[i] == tunnel) {
|
||||
found = TRUE;
|
||||
idx = i;
|
||||
@ -1046,7 +1052,7 @@ gchar *remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget *gp, gi
|
||||
gchar *ssh_tunnel_host, *srv_host, *dest;
|
||||
gint srv_port, ssh_tunnel_port;
|
||||
|
||||
REMMINA_DEBUG ("SSH tunnel initialization…");
|
||||
REMMINA_DEBUG("SSH tunnel initialization…");
|
||||
|
||||
server = remmina_file_get_string(gp->priv->remmina_file, "server");
|
||||
ssh_tunnel_server = remmina_file_get_string(gp->priv->remmina_file, "ssh_tunnel_server");
|
||||
@ -1054,16 +1060,16 @@ gchar *remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget *gp, gi
|
||||
if (!server)
|
||||
return g_strdup("");
|
||||
|
||||
if(strstr(g_strdup(server), "unix:///") != NULL) {
|
||||
REMMINA_DEBUG ("%s is a UNIX socket", server);
|
||||
if (strstr(g_strdup(server), "unix:///") != NULL) {
|
||||
REMMINA_DEBUG("%s is a UNIX socket", server);
|
||||
return g_strdup(server);
|
||||
}
|
||||
|
||||
REMMINA_DEBUG ("Calling remmina_public_get_server_port");
|
||||
REMMINA_DEBUG("Calling remmina_public_get_server_port");
|
||||
remmina_public_get_server_port(server, default_port, &srv_host, &srv_port);
|
||||
REMMINA_DEBUG ("Calling remmina_public_get_server_port (tunnel)");
|
||||
REMMINA_DEBUG("Calling remmina_public_get_server_port (tunnel)");
|
||||
remmina_public_get_server_port(ssh_tunnel_server, 22, &ssh_tunnel_host, &ssh_tunnel_port);
|
||||
REMMINA_DEBUG ("server: %s, port: %d", srv_host, srv_port);
|
||||
REMMINA_DEBUG("server: %s, port: %d", srv_host, srv_port);
|
||||
|
||||
if (port_plus && srv_port < 100)
|
||||
/* Protocols like VNC supports using instance number :0, :1, etc. as port number. */
|
||||
@ -1085,8 +1091,8 @@ gchar *remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget *gp, gi
|
||||
if (!tunnel) {
|
||||
g_free(srv_host);
|
||||
g_free(ssh_tunnel_host);
|
||||
REMMINA_DEBUG ("remmina_protocol_widget_init_tunnel failed with error is %s",
|
||||
remmina_protocol_widget_get_error_message(gp));
|
||||
REMMINA_DEBUG("remmina_protocol_widget_init_tunnel failed with error is %s",
|
||||
remmina_protocol_widget_get_error_message(gp));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1102,7 +1108,7 @@ gchar *remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget *gp, gi
|
||||
srv_host = g_strdup("127.0.0.1");
|
||||
}
|
||||
|
||||
REMMINA_DEBUG ("Starting tunnel to: %s, port: %d", ssh_tunnel_host, ssh_tunnel_port);
|
||||
REMMINA_DEBUG("Starting tunnel to: %s, port: %d", ssh_tunnel_host, ssh_tunnel_port);
|
||||
if (!remmina_ssh_tunnel_open(tunnel, srv_host, srv_port, remmina_pref.sshtunnel_port)) {
|
||||
g_free(srv_host);
|
||||
g_free(ssh_tunnel_host);
|
||||
@ -1185,7 +1191,7 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget *gp, gboolean wa
|
||||
if (gp->priv->ssh_tunnels->len < 1)
|
||||
return FALSE;
|
||||
|
||||
tunnel = (RemminaSSHTunnel*)gp->priv->ssh_tunnels->pdata[0];
|
||||
tunnel = (RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[0];
|
||||
|
||||
if ((channel = ssh_channel_new(REMMINA_SSH(tunnel)->session)) == NULL)
|
||||
return FALSE;
|
||||
@ -1245,7 +1251,7 @@ static gboolean remmina_protocol_widget_xport_tunnel_init_callback(RemminaSSHTun
|
||||
gint port;
|
||||
gboolean ret;
|
||||
|
||||
REMMINA_DEBUG ("Calling remmina_public_get_server_port");
|
||||
REMMINA_DEBUG("Calling remmina_public_get_server_port");
|
||||
remmina_public_get_server_port(remmina_file_get_string(gp->priv->remmina_file, "server"), 177, &server, &port);
|
||||
ret = ((RemminaXPortTunnelInitFunc)gp->priv->init_func)(gp,
|
||||
tunnel->remotedisplay, (tunnel->bindlocalhost ? "localhost" : server), port);
|
||||
@ -1286,7 +1292,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget *gp, R
|
||||
gchar *server;
|
||||
gchar *msg;
|
||||
RemminaMessagePanel *mp;
|
||||
RemminaSSHTunnel* tunnel;
|
||||
RemminaSSHTunnel *tunnel;
|
||||
|
||||
if (!(tunnel = remmina_protocol_widget_init_tunnel(gp))) return FALSE;
|
||||
|
||||
@ -1301,7 +1307,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget *gp, R
|
||||
tunnel->disconnect_func = remmina_protocol_widget_xport_tunnel_disconnect_callback;
|
||||
tunnel->callback_data = gp;
|
||||
|
||||
REMMINA_DEBUG ("Calling remmina_public_get_server_port");
|
||||
REMMINA_DEBUG("Calling remmina_public_get_server_port");
|
||||
remmina_public_get_server_port(remmina_file_get_string(gp->priv->remmina_file, "server"), 0, &server, NULL);
|
||||
bindlocalhost = (g_strcmp0(REMMINA_SSH(tunnel)->server, server) == 0);
|
||||
g_free(server);
|
||||
@ -1327,7 +1333,7 @@ void remmina_protocol_widget_set_display(RemminaProtocolWidget *gp, gint display
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
#ifdef HAVE_LIBSSH
|
||||
RemminaSSHTunnel* tunnel;
|
||||
RemminaSSHTunnel *tunnel;
|
||||
if (gp->priv->ssh_tunnels->len < 1)
|
||||
return;
|
||||
tunnel = (RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[0];
|
||||
@ -1348,7 +1354,7 @@ gint remmina_protocol_widget_get_multimon(RemminaProtocolWidget *gp)
|
||||
TRACE_CALL(__func__);
|
||||
/* Returns ehenever multi monitor is enabled (1) */
|
||||
gp->priv->multimon = remmina_file_get_int(gp->priv->remmina_file, "multimon", -1);
|
||||
REMMINA_DEBUG ("Multi monitor is set to %d", gp->priv->multimon);
|
||||
REMMINA_DEBUG("Multi monitor is set to %d", gp->priv->multimon);
|
||||
return gp->priv->multimon;
|
||||
}
|
||||
|
||||
@ -1932,9 +1938,9 @@ void remmina_protocol_widget_panel_show_listen(RemminaProtocolWidget *gp, gint p
|
||||
|
||||
mp = remmina_message_panel_new();
|
||||
s = g_strdup_printf(
|
||||
// TRANSLATORS: “%i” is a placeholder for a port number. “%s” is a placeholder for a protocol name (VNC).
|
||||
_("Listening on port %i for an incoming %s connection…"), port,
|
||||
remmina_file_get_string(gp->priv->remmina_file, "protocol"));
|
||||
// TRANSLATORS: “%i” is a placeholder for a port number. “%s” is a placeholder for a protocol name (VNC).
|
||||
_("Listening on port %i for an incoming %s connection…"), port,
|
||||
remmina_file_get_string(gp->priv->remmina_file, "protocol"));
|
||||
remmina_message_panel_setup_progress(mp, s, NULL, NULL);
|
||||
g_free(s);
|
||||
gp->priv->listen_message_panel = mp;
|
||||
@ -2050,11 +2056,13 @@ void remmina_protocol_widget_setup(RemminaProtocolWidget *gp, RemminaFile *remmi
|
||||
gp->priv->scaler_expand = remmina_file_get_int(gp->priv->remmina_file, "scaler_expand", FALSE);
|
||||
}
|
||||
|
||||
GtkWindow* remmina_protocol_widget_get_gtkwindow(RemminaProtocolWidget *gp) {
|
||||
GtkWindow *remmina_protocol_widget_get_gtkwindow(RemminaProtocolWidget *gp)
|
||||
{
|
||||
return rcw_get_gtkwindow(gp->cnnobj);
|
||||
}
|
||||
|
||||
GtkWidget *remmina_protocol_widget_gtkviewport(RemminaProtocolWidget *gp) {
|
||||
GtkWidget *remmina_protocol_widget_gtkviewport(RemminaProtocolWidget *gp)
|
||||
{
|
||||
return rcw_get_gtkviewport(gp->cnnobj);
|
||||
}
|
||||
|
||||
|
@ -244,12 +244,12 @@ static gboolean
|
||||
remmina_plugin_ssh_on_size_allocate(GtkWidget *widget, GtkAllocation *alloc, RemminaProtocolWidget *gp);
|
||||
|
||||
static gboolean
|
||||
valid_color(GdkRGBA const* color)
|
||||
valid_color(GdkRGBA const *color)
|
||||
{
|
||||
return color->red >= 0. && color->red <= 1. &&
|
||||
color->green >= 0. && color->green <= 1. &&
|
||||
color->blue >= 0. && color->blue <= 1. &&
|
||||
color->alpha >= 0. && color->alpha <= 1.;
|
||||
return color->red >= 0. && color->red <= 1. &&
|
||||
color->green >= 0. && color->green <= 1. &&
|
||||
color->blue >= 0. && color->blue <= 1. &&
|
||||
color->alpha >= 0. && color->alpha <= 1.;
|
||||
}
|
||||
|
||||
|
||||
@ -1037,9 +1037,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
cp[12], cp[13], cp[14], cp[15]
|
||||
};
|
||||
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = custom_palette[i];
|
||||
}
|
||||
} else {
|
||||
/* Set colors to GdkRGBA */
|
||||
switch (remmina_plugin_service->file_get_int(remminafile, "ssh_color_scheme", FALSE)) {
|
||||
@ -1051,9 +1050,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#ffffff");
|
||||
gdk_rgba_parse(&highlight_foreground, "#00000");
|
||||
gdk_rgba_parse(&colorBD, "#ffffff");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = linux_palette[i];
|
||||
}
|
||||
break;
|
||||
case TANGO:
|
||||
gdk_rgba_parse(&foreground_color, "#ffffff");
|
||||
@ -1063,9 +1061,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#ffffff");
|
||||
gdk_rgba_parse(&highlight_foreground, "#00000");
|
||||
gdk_rgba_parse(&colorBD, "#000000");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = tango_palette[i];
|
||||
}
|
||||
break;
|
||||
case GRUVBOX:
|
||||
gdk_rgba_parse(&foreground_color, "#e6d4a3");
|
||||
@ -1075,9 +1072,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#e6d4a3");
|
||||
gdk_rgba_parse(&highlight_foreground, "#1e1e1e");
|
||||
gdk_rgba_parse(&colorBD, "#ffffff");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = gruvbox_palette[i];
|
||||
}
|
||||
break;
|
||||
case SOLARIZED_DARK:
|
||||
gdk_rgba_parse(&foreground_color, "#839496");
|
||||
@ -1087,9 +1083,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#839496");
|
||||
gdk_rgba_parse(&highlight_foreground, "#002b36");
|
||||
gdk_rgba_parse(&colorBD, "#819090");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = solarized_dark_palette[i];
|
||||
}
|
||||
break;
|
||||
case SOLARIZED_LIGHT:
|
||||
gdk_rgba_parse(&foreground_color, "#657b83");
|
||||
@ -1099,9 +1094,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#657b83");
|
||||
gdk_rgba_parse(&highlight_foreground, "#fdf6e3");
|
||||
gdk_rgba_parse(&colorBD, "#475b62");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = solarized_light_palette[i];
|
||||
}
|
||||
break;
|
||||
case XTERM:
|
||||
gdk_rgba_parse(&foreground_color, "#000000");
|
||||
@ -1111,9 +1105,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gdk_rgba_parse(&highlight, "#000000");
|
||||
gdk_rgba_parse(&highlight_foreground, "#ffffff");
|
||||
gdk_rgba_parse(&colorBD, "#000000");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = xterm_palette[i];
|
||||
}
|
||||
break;
|
||||
case CUSTOM:
|
||||
REMMINA_DEBUG("Custom colors");
|
||||
@ -1143,33 +1136,31 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
g_warn_if_fail(gdk_rgba_parse(&cp[15], remmina_pref.color_pref.color15));
|
||||
|
||||
const GdkRGBA custom_palette[PALETTE_SIZE] = {
|
||||
cp[0], // remmina_pref.color_pref.color0
|
||||
cp[1], // remmina_pref.color_pref.color1
|
||||
cp[2], // remmina_pref.color_pref.color2
|
||||
cp[3], // remmina_pref.color_pref.color3
|
||||
cp[4], // remmina_pref.color_pref.color4
|
||||
cp[5], // remmina_pref.color_pref.color5
|
||||
cp[6], // remmina_pref.color_pref.color6
|
||||
cp[7], // remmina_pref.color_pref.color7
|
||||
cp[8], // remmina_pref.color_pref.color8
|
||||
cp[9], // remmina_pref.color_pref.color9
|
||||
cp[10], // remmina_pref.color_pref.color10
|
||||
cp[11], // remmina_pref.color_pref.color11
|
||||
cp[12], // remmina_pref.color_pref.color12
|
||||
cp[13], // remmina_pref.color_pref.color13
|
||||
cp[14], // remmina_pref.color_pref.color14
|
||||
cp[15] // remmina_pref.color_pref.color15
|
||||
cp[0], // remmina_pref.color_pref.color0
|
||||
cp[1], // remmina_pref.color_pref.color1
|
||||
cp[2], // remmina_pref.color_pref.color2
|
||||
cp[3], // remmina_pref.color_pref.color3
|
||||
cp[4], // remmina_pref.color_pref.color4
|
||||
cp[5], // remmina_pref.color_pref.color5
|
||||
cp[6], // remmina_pref.color_pref.color6
|
||||
cp[7], // remmina_pref.color_pref.color7
|
||||
cp[8], // remmina_pref.color_pref.color8
|
||||
cp[9], // remmina_pref.color_pref.color9
|
||||
cp[10], // remmina_pref.color_pref.color10
|
||||
cp[11], // remmina_pref.color_pref.color11
|
||||
cp[12], // remmina_pref.color_pref.color12
|
||||
cp[13], // remmina_pref.color_pref.color13
|
||||
cp[14], // remmina_pref.color_pref.color14
|
||||
cp[15] // remmina_pref.color_pref.color15
|
||||
};
|
||||
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = custom_palette[i];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
REMMINA_DEBUG("Linux paelette colors");
|
||||
for(i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++)
|
||||
palette[i] = linux_palette[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1178,12 +1169,12 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
REMMINA_DEBUG("foreground_color.blue %f, background_color.blue %f", foreground_color.blue, background_color.blue);
|
||||
REMMINA_DEBUG("foreground_color.green %f, background_color.green %f", foreground_color.green, background_color.green);
|
||||
REMMINA_DEBUG("foreground_color.alpha %f, background_color.alpha %f", foreground_color.alpha, background_color.alpha);
|
||||
for (i = 0; i < PALETTE_SIZE; i++) {
|
||||
for (i = 0; i < PALETTE_SIZE; i++) {
|
||||
REMMINA_DEBUG("index: %d, palette validation for red: %f", i, palette[i].red);
|
||||
REMMINA_DEBUG("index: %d, palette validation for green: %f", i, palette[i].green);
|
||||
REMMINA_DEBUG("index: %d, palette validation for blue: %f", i, palette[i].blue);
|
||||
REMMINA_DEBUG("index: %d, palette validation for alpha: %f", i, palette[i].alpha);
|
||||
g_warn_if_fail(valid_color(&palette[i]));
|
||||
g_warn_if_fail(valid_color(&palette[i]));
|
||||
}
|
||||
vte_terminal_set_colors(VTE_TERMINAL(vte), &foreground_color, &background_color, palette, PALETTE_SIZE);
|
||||
vte_terminal_set_color_foreground(VTE_TERMINAL(vte), &foreground_color);
|
||||
@ -1245,9 +1236,9 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp)
|
||||
gpdata->vte_session_file = g_file_new_for_path(fp);
|
||||
|
||||
g_signal_connect(G_OBJECT(vte), "size-allocate", G_CALLBACK(remmina_plugin_ssh_on_size_allocate), gp);
|
||||
g_signal_connect (G_OBJECT(vte), "unrealize", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
g_signal_connect (G_OBJECT(vte), "eof", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
g_signal_connect (G_OBJECT(vte), "child-exited", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
g_signal_connect(G_OBJECT(vte), "unrealize", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
g_signal_connect(G_OBJECT(vte), "eof", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
g_signal_connect(G_OBJECT(vte), "child-exited", G_CALLBACK(remmina_plugin_ssh_eof), gp);
|
||||
remmina_plugin_ssh_popup_ui(gp);
|
||||
gtk_widget_show_all(hbox);
|
||||
}
|
||||
@ -1510,21 +1501,21 @@ static gchar log_tips[] =
|
||||
*/
|
||||
static const RemminaProtocolSetting remmina_ssh_advanced_settings[] =
|
||||
{
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_color_scheme", N_("Terminal colour scheme"), FALSE, ssh_terminal_palette, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_charset", N_("Character set"), FALSE, ssh_charset_list, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_proxycommand", N_("SSH Proxy Command"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_kex_algorithms", N_("KEX (Key Exchange) algorithms"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_ciphers", N_("Symmetric cipher client to server"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_hostkeytypes", N_("Preferred server host key types"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_FOLDER, "sshlogfolder", N_("Folder for SSH session log"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "sshlogname", N_("Filename for SSH session log"), FALSE, NULL, log_tips },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "sshlogenabled", N_("Log SSH session when exiting Remmina"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "sshsavesession", N_("Log SSH session asynchronously"), FALSE, NULL, N_("Saving the session asynchronously may have a notable performance impact") },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "audiblebell", N_("Audible terminal bell"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "ssh_compression", N_("SSH compression"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "disablepasswordstoring", N_("Don't remember passwords"), TRUE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "ssh_stricthostkeycheck", N_("Strict host key checking"), TRUE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_color_scheme", N_("Terminal colour scheme"), FALSE, ssh_terminal_palette, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_charset", N_("Character set"), FALSE, ssh_charset_list, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_proxycommand", N_("SSH Proxy Command"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_kex_algorithms", N_("KEX (Key Exchange) algorithms"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_ciphers", N_("Symmetric cipher client to server"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_hostkeytypes", N_("Preferred server host key types"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_FOLDER, "sshlogfolder", N_("Folder for SSH session log"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "sshlogname", N_("Filename for SSH session log"), FALSE, NULL, log_tips },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "sshlogenabled", N_("Log SSH session when exiting Remmina"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "sshsavesession", N_("Log SSH session asynchronously"), FALSE, NULL, N_("Saving the session asynchronously may have a notable performance impact") },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "audiblebell", N_("Audible terminal bell"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "ssh_compression", N_("SSH compression"), FALSE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "disablepasswordstoring", N_("Don't remember passwords"), TRUE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_CHECK, "ssh_stricthostkeycheck", N_("Strict host key checking"), TRUE, NULL, NULL },
|
||||
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1540,8 +1531,8 @@ static RemminaProtocolPlugin remmina_plugin_ssh =
|
||||
N_("SSH - Secure Shell"), /**< Description */
|
||||
GETTEXT_PACKAGE, /**< Translation domain */
|
||||
VERSION, /**< Version number */
|
||||
"org.remmina.Remmina-ssh-symbolic", /**< Icon for normal connection */
|
||||
"org.remmina.Remmina-ssh-symbolic", /**< Icon for SSH connection */
|
||||
"org.remmina.Remmina-ssh-symbolic", /**< Icon for normal connection */
|
||||
"org.remmina.Remmina-ssh-symbolic", /**< Icon for SSH connection */
|
||||
remmina_ssh_basic_settings, /**< Array for basic settings */
|
||||
remmina_ssh_advanced_settings, /**< Array for advanced settings */
|
||||
REMMINA_PROTOCOL_SSH_SETTING_TUNNEL, /**< SSH settings type */
|
||||
|
Loading…
x
Reference in New Issue
Block a user