Re: [gnome-network][PATCH] Ask whether to accept clients in gds



Updated the patch, there is now another option in the preferences that
allows you to automatically accept clients. So if you're sharing your
desktop so you can connect remotely it doesn't ask you whether to accept
the client or not.

Shall I commit?

On Tue, 2004-01-27 at 13:59, Rob Clews wrote:
> This patch uses a GtkDialog to ask whether the client should be allowed
> to view your desktop when connecting.
> 
> Ok to commit?
-- 
Klear Systems Ltd - Dependable IT

http://www.klearsystems.com
Tel: 0870 429 6238
Fax: 0871 222 7617
Email: robc klearsystems com

Dependability means:
- dedicated support engineer
- upfront pricing
- straight talk
Index: desktop/preferences/callbacks.c
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/preferences/callbacks.c,v
retrieving revision 1.2
diff -r1.2 callbacks.c
22a23
>   gtk_widget_set_sensitive (lookup_widget(GTK_WIDGET(togglebutton), "checkbutton2"), active);
30a32,42
> void
> on_checkbutton2_toggled                (GtkToggleButton *togglebutton,
>                                         gpointer         user_data)
> {
>   GConfClient *client;
>   gboolean autoaccept;
>
>   autoaccept = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton));
>   client = gconf_client_get_default ();
>   gconf_client_set_bool (client, GCONFKEY_AUTOACCEPT, autoaccept, NULL);
> }
Index: desktop/preferences/callbacks.h
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/preferences/callbacks.h,v
retrieving revision 1.1
diff -r1.1 callbacks.h
8a9,12
> on_checkbutton2_toggled                (GtkToggleButton *togglebutton,
>                                         gpointer         user_data);
>
> void
Index: desktop/preferences/helpers.h
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/preferences/helpers.h,v
retrieving revision 1.2
diff -r1.2 helpers.h
4c4
< #define GCONFKEY "/apps/gnome-desktop-sharing/preferences/enable"
---
> #define GCONFKEY GCONFPATH"/enable"
5a6
> #define GCONFKEY_AUTOACCEPT GCONFPATH"/autoaccept"
Index: desktop/preferences/interface.c
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/preferences/interface.c,v
retrieving revision 1.3
diff -r1.3 interface.c
36a37
>   GtkWidget *checkbutton2;
121a123,128
>   checkbutton2 = gtk_check_button_new_with_mnemonic (_("Automatically accept clients"));
>   gtk_widget_show (checkbutton2);
>   gtk_table_attach (GTK_TABLE (table1), checkbutton2, 2, 3, 5, 6,
>                     (GtkAttachOptions) (GTK_FILL),
>                     (GtkAttachOptions) (0), 0, 0);
>
142a150,152
>   g_signal_connect ((gpointer) checkbutton2, "toggled",
>                     G_CALLBACK (on_checkbutton2_toggled),
>                     NULL);
158a169
>   GLADE_HOOKUP_OBJECT (window1, checkbutton2, "checkbutton2");
Index: desktop/preferences/main.c
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/preferences/main.c,v
retrieving revision 1.2
diff -r1.2 main.c
41d40
<   gboolean     value;
63d61
<   value = gconf_client_get_bool (client, GCONFKEY, NULL);
66c64,67
<                                     value);
---
>                                 gconf_client_get_bool (client, GCONFKEY, NULL));
>   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget(window1, "checkbutton2")),
>                                 gconf_client_get_bool (client, GCONFKEY_AUTOACCEPT, NULL));
>
cvs diff: Diffing desktop/server
Index: desktop/server/tray.h
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/server/tray.h,v
retrieving revision 1.5
diff -r1.5 tray.h
30a31
> #define GDS_GCONF_AUTOACCEPT GDS_GCONF_PATH"/autoaccept"
Index: desktop/server/x11vnc.c
===================================================================
RCS file: /cvs/gnome/gnome-network/desktop/server/x11vnc.c,v
retrieving revision 1.6
diff -r1.6 x11vnc.c
350c350
<
---
>
357a358,362
>       gint result;
>       GtkWidget *dialog, *label;
>       GConfClient *gc_client;
>       gboolean autoaccept;
>
381a387,418
>
>       gc_client = gconf_client_get_default ();
>       autoaccept = gconf_client_get_bool (gc_client, GDS_GCONF_AUTOACCEPT, NULL);
>
>       if(!autoaccept) {
>               dialog = gtk_dialog_new_with_buttons ("Desktop Sharing",
>                                                     NULL,
>                                                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
>                                                     GTK_STOCK_YES,
>                                                     GTK_RESPONSE_ACCEPT,
>                                                     GTK_STOCK_NO,
>                                                     GTK_RESPONSE_REJECT,
>                                                     NULL);
>               label = gtk_label_new (g_strdup_printf(_("Host %s is trying to view your desktop, allow them?"), client->host));
>
>               gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
>                             label);
>               gtk_widget_show(label);
>
>               result = gtk_dialog_run (GTK_DIALOG (dialog));
>
>               gtk_widget_destroy (dialog);
>               switch (result)
>               {
>                 case GTK_RESPONSE_ACCEPT:
>                   return(RFB_CLIENT_ACCEPT);
>                   break;
>                 case GTK_RESPONSE_REJECT:
>                   return(RFB_CLIENT_REFUSE);
>                   break;
>               }
>       }
384a422
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]