[vinagre] Integrate reverse-vnc plugin directly



commit f4e172d2dadf34c9f179fa931f07638f20ab24f5
Author: David King <amigadave amigadave com>
Date:   Fri Jun 10 23:32:32 2011 +0200

    Integrate reverse-vnc plugin directly

 .gitignore                                         |   12 +-
 Makefile.am                                        |   41 +--
 configure.ac                                       |    3 +-
 data/vinagre-ui.xml                                |    2 +-
 data/vinagre.ui                                    |  292 +++++++++++++++++++
 plugins/reverse-vnc/reverse-vnc.ui                 |  296 --------------------
 plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c   |  244 ----------------
 plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h   |   63 ----
 po/POTFILES.in                                     |    5 +-
 {plugins/reverse-vnc => vinagre}/if/getifaddrs.c   |    0
 {plugins/reverse-vnc => vinagre}/if/ifaddrs.h      |    0
 vinagre/vinagre-commands.c                         |    7 +
 vinagre/vinagre-commands.h                         |    3 +
 .../vinagre-reverse-vnc-listener-dialog.c          |   29 +--
 .../vinagre-reverse-vnc-listener-dialog.h          |    7 +-
 .../vinagre-reverse-vnc-listener.c                 |    6 +-
 .../vinagre-reverse-vnc-listener.h                 |    7 +-
 vinagre/vinagre-ui.h                               |    3 +
 vinagre/vinagre-window-private.h                   |    2 +
 vinagre/vinagre-window.c                           |   22 ++
 20 files changed, 363 insertions(+), 681 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 59984a9..039aca6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,14 +39,6 @@ Makefile.in
 /plugins/rdp/.deps
 /plugins/rdp/.dirstamp
 /plugins/rdp/.libs
-/plugins/reverse-vnc/*.lo
-/plugins/reverse-vnc/.deps
-/plugins/reverse-vnc/.dirstamp
-/plugins/reverse-vnc/.libs
-/plugins/reverse-vnc/if/*.lo
-/plugins/reverse-vnc/if/.deps
-/plugins/reverse-vnc/if/.dirstamp
-/plugins/reverse-vnc/if/.libs
 /plugins/spice/*.lo
 /plugins/spice/.deps
 /plugins/spice/.dirstamp
@@ -78,6 +70,10 @@ Makefile.in
 /vinagre/.deps
 /vinagre/.dirstamp
 /vinagre/.libs
+/vinagre/if/*.lo
+/vinagre/if/.deps
+/vinagre/if/.dirstamp
+/vinagre/if/.libs
 /vinagre/view/*.lo
 /vinagre/view/.deps
 /vinagre/view/.dirstamp
diff --git a/Makefile.am b/Makefile.am
index 947275f..3e202cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@ DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper
 common_cppflags = \
 	-I$(top_builddir) \
 	-I$(top_builddir)/vinagre \
+	-I$(top_srcdir) \
 	-I$(top_srcdir)/vinagre/view \
 	-DBINDIR=\"$(bindir)\" \
 	-DDATADIR=\"$(datadir)\" \
@@ -30,6 +31,11 @@ AM_VALAFLAGS = \
 
 bin_PROGRAMS = vinagre/vinagre
 
+if VINAGRE_HAVE_SELF_IFADDRS
+ifaddrs_sources = \
+       vinagre/if/getifaddrs.c
+endif
+
 vinagre_vinagre_SOURCES = \
 	vinagre/vinagre-main.c \
 	vinagre/vinagre-options.c
@@ -44,6 +50,7 @@ vinagre_vinagre_LDADD = \
 	libvnc.la
 
 noinst_vinagreh_headers = \
+	vinagre/if/ifaddrs.h \
 	vinagre/view/autoDrawer.h \
 	vinagre/view/drawer.h \
 	vinagre/view/ovBox.h \
@@ -67,6 +74,8 @@ noinst_vinagreh_headers = \
 	vinagre/vinagre-plugins-engine.h \
 	vinagre/vinagre-prefs.h \
 	vinagre/vinagre-protocol.h \
+	vinagre/vinagre-reverse-vnc-listener.h \
+	vinagre/vinagre-reverse-vnc-listener-dialog.h \
 	vinagre/vinagre-static-extension.h \
 	vinagre/vinagre-tab.h \
 	vinagre/vinagre-ui.h \
@@ -93,6 +102,8 @@ handwritten_sources = \
 	vinagre/vinagre-fav.c \
 	vinagre/vinagre-notebook.c \
 	vinagre/vinagre-prefs.c \
+	vinagre/vinagre-reverse-vnc-listener.c \
+	vinagre/vinagre-reverse-vnc-listener-dialog.c \
 	vinagre/vinagre-static-extension.c \
 	vinagre/vinagre-tab.c \
 	vinagre/vinagre-utils.vala \
@@ -101,7 +112,8 @@ handwritten_sources = \
 	vinagre/vinagre-ssh.c \
 	vinagre/vinagre-cache-prefs.c \
 	vinagre/vinagre-protocol.c \
-	vinagre/vinagre-plugins-engine.c
+	vinagre/vinagre-plugins-engine.c \
+	$(ifaddrs_sources)
 
 libvinagre_la_SOURCES = \
 	$(handwritten_sources)
@@ -140,10 +152,6 @@ noinst_plugin_headers = \
 	plugins/ssh/vinagre-ssh-plugin.h \
 	plugins/ssh/vinagre-ssh-connection.h \
 	plugins/ssh/vinagre-ssh-tab.h \
-	plugins/reverse-vnc/if/ifaddrs.h \
-	plugins/reverse-vnc/vinagre-reverse-vnc-plugin.h \
-	plugins/reverse-vnc/vinagre-reverse-vnc-listener.h \
-	plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.h \
 	plugins/vnc/vinagre-vnc-plugin.h \
 	plugins/vnc/vinagre-vnc-connection.h \
 	plugins/vnc/vinagre-vnc-tab.h \
@@ -195,31 +203,8 @@ plugin_LTLIBRARIES = \
 	$(rdp_plugin) \
 	$(spice_plugin) \
 	$(ssh_plugin) \
-	libreversevnc.la \
 	libvnc.la
 
-if VINAGRE_HAVE_SELF_IFADDRS
-ifaddrs_sources = \
-	plugins/reverse-vnc/if/getifaddrs.c
-endif
-
-libreversevnc_la_CPPFLAGS = \
-	$(AM_CPPFLAGS) \
-	-I$(top_srcdir) \
-	-DVINAGRE_REVERSE_VNC_DATADIR=\"$(reversevncuidir)\"
-
-libreversevnc_la_SOURCES = \
-	plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c \
-	plugins/reverse-vnc/vinagre-reverse-vnc-listener.c \
-	plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.c \
-	$(ifaddrs_sources)
-
-libreversevnc_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
-libreversevnc_la_LIBADD = $(VNC_LIBS)
-
-reversevncuidir = $(VINAGRE_PLUGINS_DATA_DIR)/reverse-vnc
-dist_reversevncui_DATA = plugins/reverse-vnc/reverse-vnc.ui
-
 libvnc_la_CPPFLAGS = \
 	$(AM_CPPFLAGS) \
 	$(VNC_CFLAGS) \
diff --git a/configure.ac b/configure.ac
index 0e3ccb8..0c11578 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,7 @@ AC_PROG_SED
 AC_SUBST([VINAGRE_ABI_VERSION], [3.0])
 AC_DEFINE_UNQUOTED([VINAGRE_ABI_VERSION], ["$VINAGRE_ABI_VERSION"], [Vinagre ABI version])
 
-AC_SUBST([PLUGIN_LIBTOOL_FLAGS], ["-module -avoid-version"])
-AC_SUBST([VINAGRE_PLUGINS_DATA_DIR], ["$datadir/vinagre-$VINAGRE_ABI_VERSION/plugins"])
+AC_SUBST([PLUGIN_LIBTOOL_FLAGS], ["-avoid-version"])
 AC_SUBST([VINAGRE_PLUGINS_LIBS_DIR], ["$libdir/vinagre-$VINAGRE_ABI_VERSION/plugins"])
 
 GLIB_DEPS="glib-2.0 >= 2.25.11 gio-unix-2.0 >= 2.25.11"
diff --git a/data/vinagre-ui.xml b/data/vinagre-ui.xml
index d41c5b1..2255ff3 100644
--- a/data/vinagre-ui.xml
+++ b/data/vinagre-ui.xml
@@ -27,7 +27,7 @@
       <separator/>
       <menuitem name="RemoteDisconnectMenu" action="RemoteDisconnect"/>
       <menuitem name="RemoteTakeScreenshotMenu" action="RemoteTakeScreenshot"/>
-      <placeholder name="RemoteOps_1" />
+      <menuitem name="VNCListener" action="VNCListener"/>
       <placeholder name="FileRecentsPlaceholder">
         <separator/>
       </placeholder>
diff --git a/data/vinagre.ui b/data/vinagre.ui
index 015f253..eefe4ef 100644
--- a/data/vinagre.ui
+++ b/data/vinagre.ui
@@ -1169,4 +1169,296 @@
       <action-widget response="0">button9</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkTextBuffer" id="ip_textbuffer"/>
+  <object class="GtkDialog" id="listener_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Reverse Connections</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox7">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area7">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button4">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox11">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkHBox" id="hbox2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkImage" id="image1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xpad">6</property>
+                    <property name="stock">gtk-dialog-info</property>
+                    <property name="icon-size">6</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">By activating reverse connections you can access remote desktops that are behind a firewall. The remote side is supposed to initiate the connection with you. For further information, read the help.</property>
+                    <property name="wrap">True</property>
+                    <attributes>
+                      <attribute name="style" value="italic"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox12">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">4</property>
+                <child>
+                  <object class="GtkCheckButton" id="enable_reverse_check">
+                    <property name="label" translatable="yes">_Enable Reverse Connections</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">    </property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="always_enabled_check">
+                        <property name="label" translatable="yes" comments="Translators: this is the reverse connection mode. &quot;Always enabled&quot; means it will be enabled by default in the program startup. You can see this string in the dialog Remote-&gt;Reverse connections.">_Always Enabled</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">    </property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkExpander" id="connectivity_exp">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkFrame" id="frame1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label_xalign">0</property>
+                                <property name="label_yalign">0</property>
+                                <child>
+                                  <object class="GtkAlignment" id="alignment1">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkTextView" id="ip_textview">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="pixels_above_lines">3</property>
+                                        <property name="pixels_below_lines">3</property>
+                                        <property name="editable">False</property>
+                                        <property name="buffer">ip_textbuffer</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child type="label">
+                                  <object class="GtkLabel" id="label9">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">This desktop is reachable through the following IP address(es):</property>
+                                    <attributes>
+                                      <attribute name="style" value="italic"/>
+                                    </attributes>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="port_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label">label</property>
+                                <attributes>
+                                  <attribute name="style" value="italic"/>
+                                  <attribute name="scale" value="1"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Connectivity</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-11">button2</action-widget>
+      <action-widget response="0">button4</action-widget>
+    </action-widgets>
+  </object>
 </interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f5d0657..6b06b7b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,9 +15,6 @@ plugins/vnc/vinagre-vnc-connection.c
 plugins/vnc/vinagre-vnc-plugin.c
 plugins/vnc/vinagre-vnc-tab.c
 plugins/vnc/vinagre-vnc-tunnel.c
-plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.c
-plugins/reverse-vnc/vinagre-reverse-vnc-listener.c
-plugins/reverse-vnc/vinagre-reverse-vnc-plugin.c
 plugins/spice/vinagre-spice-plugin.c
 plugins/spice/vinagre-spice-tab.c
 plugins/spice/vinagre-spice-tunnel.c
@@ -35,6 +32,8 @@ vinagre/vinagre-mdns.c
 vinagre/vinagre-notebook.c
 vinagre/vinagre-options.c
 vinagre/vinagre-prefs.c
+vinagre/vinagre-reverse-vnc-listener-dialog.c
+vinagre/vinagre-reverse-vnc-listener.c
 vinagre/vinagre-ssh.c
 vinagre/vinagre-tab.c
 vinagre/vinagre-tube-handler.c
diff --git a/plugins/reverse-vnc/if/getifaddrs.c b/vinagre/if/getifaddrs.c
similarity index 100%
rename from plugins/reverse-vnc/if/getifaddrs.c
rename to vinagre/if/getifaddrs.c
diff --git a/plugins/reverse-vnc/if/ifaddrs.h b/vinagre/if/ifaddrs.h
similarity index 100%
rename from plugins/reverse-vnc/if/ifaddrs.h
rename to vinagre/if/ifaddrs.h
diff --git a/vinagre/vinagre-commands.c b/vinagre/vinagre-commands.c
index b0de3ec..c055abd 100644
--- a/vinagre/vinagre-commands.c
+++ b/vinagre/vinagre-commands.c
@@ -219,6 +219,13 @@ vinagre_cmd_remote_disconnect_all (GtkAction     *action,
 }
 
 void
+vinagre_cmd_remote_vnc_listener (GtkAction *action,
+                                 VinagreWindow *window)
+{
+    vinagre_reverse_vnc_listener_dialog_show (window);
+}
+
+void
 vinagre_cmd_remote_quit (GtkAction     *action,
 			  VinagreWindow *window)
 {
diff --git a/vinagre/vinagre-commands.h b/vinagre/vinagre-commands.h
index 0cdb230..c587e94 100644
--- a/vinagre/vinagre-commands.h
+++ b/vinagre/vinagre-commands.h
@@ -41,6 +41,9 @@ void		vinagre_cmd_remote_take_screenshot (GtkAction     *action,
 
 void		vinagre_cmd_remote_disconnect_all	(GtkAction     *action,
 							 VinagreWindow *window);
+void            vinagre_cmd_remote_vnc_listener (GtkAction *action,
+                                                 VinagreWindow *window);
+
 void		vinagre_cmd_remote_quit	(GtkAction     *action,
 					 VinagreWindow *window);
 
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.c b/vinagre/vinagre-reverse-vnc-listener-dialog.c
similarity index 89%
rename from plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.c
rename to vinagre/vinagre-reverse-vnc-listener-dialog.c
index f501b59..a8fd385 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.c
+++ b/vinagre/vinagre-reverse-vnc-listener-dialog.c
@@ -39,7 +39,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
-#include <vinagre/vinagre-prefs.h>
+#include "vinagre-prefs.h"
 #include "vinagre-reverse-vnc-listener-dialog.h"
 #include "vinagre-reverse-vnc-listener.h"
 
@@ -144,7 +144,7 @@ dialog_response_handler (GtkDialog       *widget,
   switch (res_id)
     {
       case GTK_RESPONSE_HELP:
-	vinagre_utils_help_contents (GTK_WINDOW (dialog->dialog),
+	vinagre_utils_show_help (GTK_WINDOW (dialog->dialog),
           "reverse-connections");
 	break;
 
@@ -209,26 +209,9 @@ vinagre_reverse_vnc_listener_dialog_show (GtkWindow *parent)
   GtkBuilder *xml;
   GError *error = NULL;
   gboolean always;
-  gchar *filename;
-
-  filename = g_build_filename (VINAGRE_REVERSE_VNC_DATADIR, "reverse-vnc.ui", NULL);
-
-  xml = gtk_builder_new ();
-  if (!gtk_builder_add_from_file (xml, filename, &error))
-  {
-    GString *str = g_string_new (NULL);
-
-    g_string_append (str, _("The reverse VNC plugin failed to open a UI file, with the error message:"));
-    g_string_append_printf (str, "\n\n%s\n\n", error->message);
-    g_string_append (str, _("Please check your installation."));
-    vinagre_utils_show_error_dialog (_("Error loading UI file"), str->str, NULL);
-    g_error_free (error);
-    g_string_free (str, TRUE);
-    g_object_unref (xml);
-    xml = NULL;
-  }
-
-  g_free (filename);
+
+  xml = vinagre_utils_get_builder ();
+
   if (!xml)
     return;
 
@@ -286,5 +269,3 @@ vinagre_reverse_vnc_listener_dialog_show (GtkWindow *parent)
 
   gtk_widget_show_all (dialog->dialog);
 }
-
-/* vim: set ts=8: */
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.h b/vinagre/vinagre-reverse-vnc-listener-dialog.h
similarity index 83%
rename from plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.h
rename to vinagre/vinagre-reverse-vnc-listener-dialog.h
index b779da1..133cfe2 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-listener-dialog.h
+++ b/vinagre/vinagre-reverse-vnc-listener-dialog.h
@@ -18,8 +18,8 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H__
-#define __VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H__
+#ifndef VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H_
+#define VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H_
 
 G_BEGIN_DECLS
 
@@ -27,5 +27,4 @@ void vinagre_reverse_vnc_listener_dialog_show (GtkWindow *parent);
 
 G_END_DECLS
 
-#endif /* __VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H__ */
-/* vim: set ts=8: */
+#endif /* VINAGRE_REVERSE_VNC_LISTENER_DIALOG_H_ */
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-listener.c b/vinagre/vinagre-reverse-vnc-listener.c
similarity index 98%
rename from plugins/reverse-vnc/vinagre-reverse-vnc-listener.c
rename to vinagre/vinagre-reverse-vnc-listener.c
index d8decd9..ab314f5 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-listener.c
+++ b/vinagre/vinagre-reverse-vnc-listener.c
@@ -34,9 +34,9 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include <vinagre/vinagre-commands.h>
+#include "vinagre-commands.h"
 #include "vinagre-reverse-vnc-listener.h"
-#include "../vnc/vinagre-vnc-connection.h"
+#include "plugins/vnc/vinagre-vnc-connection.h"
 
 struct _VinagreReverseVncListenerPrivate
 {
@@ -269,5 +269,3 @@ vinagre_reverse_vnc_listener_set_window (VinagreReverseVncListener *listener,
 
   listener->priv->window = window ? g_object_ref (window) : NULL;
 }
-
-/* vim: set ts=8: */
diff --git a/plugins/reverse-vnc/vinagre-reverse-vnc-listener.h b/vinagre/vinagre-reverse-vnc-listener.h
similarity index 94%
rename from plugins/reverse-vnc/vinagre-reverse-vnc-listener.h
rename to vinagre/vinagre-reverse-vnc-listener.h
index 4def1b3..4cac425 100644
--- a/plugins/reverse-vnc/vinagre-reverse-vnc-listener.h
+++ b/vinagre/vinagre-reverse-vnc-listener.h
@@ -18,8 +18,8 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __VINAGRE_REVERSE_VNC_LISTENER_H__
-#define __VINAGRE_REVERSE_VNC_LISTENER_H__
+#ifndef VINAGRE_REVERSE_VNC_LISTENER_H_
+#define VINAGRE_REVERSE_VNC_LISTENER_H_
 
 #include <glib.h>
 
@@ -60,5 +60,4 @@ void			vinagre_reverse_vnc_listener_set_window (VinagreReverseVncListener *liste
 
 G_END_DECLS
 
-#endif /* __VINAGRE_REVERSE_VNC_LISTENER_H__  */
-/* vim: set ts=8: */
+#endif /* VINAGRE_REVERSE_VNC_LISTENER_H_  */
diff --git a/vinagre/vinagre-ui.h b/vinagre/vinagre-ui.h
index 5308100..c68d61c 100644
--- a/vinagre/vinagre-ui.h
+++ b/vinagre/vinagre-ui.h
@@ -41,6 +41,9 @@ static const GtkActionEntry vinagre_always_sensitive_entries[] =
     N_("Connect to a remote desktop"), G_CALLBACK (vinagre_cmd_remote_connect) },
   { "RemoteOpen", GTK_STOCK_OPEN, NULL, "<control>O",
     N_("Open a .VNC file"), G_CALLBACK (vinagre_cmd_remote_open) },
+  { "VNCListener", NULL, /* Translators: "Reverse" here is an adjective, not a verb. */
+    N_("_Reverse Connectionsâ?¦"), NULL, N_("Configure incoming VNC connections"),
+    G_CALLBACK (vinagre_cmd_remote_vnc_listener) },
   { "RemoteQuit", GTK_STOCK_QUIT, NULL, "<control>Q",
     N_("Quit the program"), G_CALLBACK (vinagre_cmd_remote_quit) },
 
diff --git a/vinagre/vinagre-window-private.h b/vinagre/vinagre-window-private.h
index fe610f8..b2fa616 100644
--- a/vinagre/vinagre-window-private.h
+++ b/vinagre/vinagre-window-private.h
@@ -23,6 +23,7 @@
 
 #include "vinagre-window.h"
 #include "vinagre-notebook.h"
+#include "vinagre-reverse-vnc-listener.h"
 
 G_BEGIN_DECLS
 
@@ -31,6 +32,7 @@ G_BEGIN_DECLS
 struct _VinagreWindowPrivate
 {
   VinagreNotebook *notebook;
+  VinagreReverseVncListener *listener;
   GtkWidget       *fav_panel;
   GtkWidget       *statusbar;	
   guint           generic_message_cid;
diff --git a/vinagre/vinagre-window.c b/vinagre/vinagre-window.c
index 1dd8b64..f904eac 100644
--- a/vinagre/vinagre-window.c
+++ b/vinagre/vinagre-window.c
@@ -84,6 +84,11 @@ vinagre_window_dispose (GObject *object)
       window->priv->update_recents_menu_ui_id = 0;
     }
 
+    if (window->priv->listener)
+    {
+        g_object_unref (window->priv->listener);
+        window->priv->listener = NULL;
+    }
   G_OBJECT_CLASS (vinagre_window_parent_class)->dispose (object);
 }
 
@@ -742,6 +747,22 @@ create_notebook (VinagreWindow *window)
   gtk_widget_show (GTK_WIDGET (window->priv->notebook));
 }
 
+/* Initialise the reverse connections dialog, and start the listener if it is
+ * enabled. */
+static void
+_init_reverse_connections (VinagreWindow *window)
+{
+    gboolean always;
+    VinagreReverseVncListener *listener = window->priv->listener;
+
+    listener = vinagre_reverse_vnc_listener_get_default ();
+
+    g_object_get (vinagre_prefs_get_default (), "always-enable-listening",
+        &always, NULL);
+    if (always)
+        vinagre_reverse_vnc_listener_start (listener);
+}
+
 static gboolean
 vinagre_window_check_first_run (VinagreWindow *window)
 {
@@ -857,6 +878,7 @@ vinagre_window_init (VinagreWindow *window)
 			  G_CALLBACK (protocol_added_removed_cb),
 			  window);
 
+  _init_reverse_connections (window);
   g_idle_add ((GSourceFunc) vinagre_window_check_first_run, window);
 }
 



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