[vinagre/gnome-3-8] Add recognize_file() API to VinagreProtocol interface



commit bbde17a11841710b989901189f9a2556317b3f06
Author: Jonh Wendell <jonh wendell intel com>
Date:   Thu Jul 11 14:25:55 2013 -0300

    Add recognize_file() API to VinagreProtocol interface
    
    it will be used to check whether a file can be parsed by
    a plugin.

 vinagre/vinagre-protocol.c |   26 ++++++++++++++++++++++++++
 vinagre/vinagre-protocol.h |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/vinagre/vinagre-protocol.c b/vinagre/vinagre-protocol.c
index 3040d8c..11ec4fd 100644
--- a/vinagre/vinagre-protocol.c
+++ b/vinagre/vinagre-protocol.c
@@ -75,6 +75,13 @@ default_new_connection_from_file (VinagreProtocol *protocol,
   return NULL;
 }
 
+static gboolean
+default_recognize_file (VinagreProtocol *protocol,
+                        GFile           *file)
+{
+  return FALSE;
+}
+
 static GtkWidget *
 default_get_connect_widget (VinagreProtocol   *protocol,
                            VinagreConnection *initial_settings)
@@ -108,6 +115,7 @@ vinagre_protocol_default_init (VinagreProtocolInterface *iface)
   iface->new_tab = default_new_tab;
   iface->new_connection = default_new_connection;
   iface->new_connection_from_file = default_new_connection_from_file;
+  iface->recognize_file = default_recognize_file;
   iface->get_connect_widget = default_get_connect_widget;
   iface->parse_mdns_dialog = default_parse_mdns_dialog;
   iface->get_icon_name = dummy;
@@ -308,6 +316,24 @@ vinagre_protocol_new_connection_from_file (VinagreProtocol *protocol,
   return NULL;
 }
 
+gboolean
+vinagre_protocol_recognize_file (VinagreProtocol *protocol,
+                                 GFile           *file)
+{
+  VinagreProtocolInterface *iface;
+
+  g_return_val_if_fail (VINAGRE_IS_PROTOCOL (protocol), FALSE);
+
+  iface = VINAGRE_PROTOCOL_GET_IFACE (protocol);
+
+  if (iface->recognize_file != NULL)
+    {
+      return iface->recognize_file (protocol, file);
+    }
+
+  return FALSE;
+}
+
 /**
  * vinagre_protocol_get_connect_widget:
  *
diff --git a/vinagre/vinagre-protocol.h b/vinagre/vinagre-protocol.h
index cdf2eb4..933cceb 100644
--- a/vinagre/vinagre-protocol.h
+++ b/vinagre/vinagre-protocol.h
@@ -48,6 +48,8 @@ struct _VinagreProtocolInterface
                                                         const gchar     *data,
                                                         gboolean         use_bookmarks,
                                                         gchar          **error_msg);
+  gboolean              (*recognize_file)               (VinagreProtocol *protocol,
+                                                         GFile           *file);
   const gchar          *(*get_mdns_service)            (VinagreProtocol *protocol);
   GtkWidget            *(*new_tab)                     (VinagreProtocol   *protocol,
                                                         VinagreConnection *conn,
@@ -80,6 +82,8 @@ VinagreConnection *   vinagre_protocol_new_connection_from_file (VinagreProtocol *
                                                                   const gchar     *data,
                                                                   gboolean         use_bookmarks,
                                                                   gchar           **error_msg);
+gboolean                vinagre_protocol_recognize_file           (VinagreProtocol *protocol,
+                                                                   GFile           *file);
 const gchar *          vinagre_protocol_get_mdns_service         (VinagreProtocol *protocol);
 
 GtkWidget *            vinagre_protocol_new_tab                  (VinagreProtocol   *protocol,


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