Author: dzzinstant
Date: Sun Jun  1 23:04:16 2014
New Revision: 9

URL: http://svn.gna.org/viewcvs/pidgin-zrtp?rev=9&view=rev
Log:
Add 'simplezrtp/media-window' data record to PurpleMedia object. If record is 
available, ZRTP controlbox is shown inside the media window.

Added:
    trunk/patches/pidgin-mediawindow.diff
Modified:
    trunk/Changelog
    trunk/install.sh
    trunk/src/pidgin-plugin/simplezrtp/gtk-encrypt.c

Modified: trunk/Changelog
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/Changelog?rev=9&r1=8&r2=9&view=diff
==============================================================================
--- trunk/Changelog     (original)
+++ trunk/Changelog     Sun Jun  1 23:04:16 2014
@@ -20,3 +20,6 @@
 
 * Moving from farsight2-0.0.31 to farstream-0.1.2
 
+* pidgin-mediawindow.diff makes PidginMedia available for plugin, so
+  ZRTP controlbox can be added to the PidginMedia window.
+  Occasionally freezes Pidgin window!

Modified: trunk/install.sh
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/install.sh?rev=9&r1=8&r2=9&view=diff
==============================================================================
--- trunk/install.sh    (original)
+++ trunk/install.sh    Sun Jun  1 23:04:16 2014
@@ -125,7 +125,12 @@
 
        if [ ! -e ${PIDGIN_DIR} ]; then
                tar xjf ${PIDGIN_PACKED}
-               ( cd ${PIDGIN_DIR}; patch -p1 < ../${PIDGIN_PATCH} )
+               ( cd ${PIDGIN_DIR}
+               patch -p1 < ../${PIDGIN_PATCH}
+
+               ## For plugin access to PidginMedia window:
+               patch -p1 < ../patches/pidgin-mediawindow.diff
+               )
                pidgin_plugin_unpack
        fi
        return 0

Added: trunk/patches/pidgin-mediawindow.diff
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/patches/pidgin-mediawindow.diff?rev=9&view=auto
==============================================================================
--- trunk/patches/pidgin-mediawindow.diff       (added)
+++ trunk/patches/pidgin-mediawindow.diff       Sun Jun  1 23:04:16 2014
@@ -0,0 +1,22 @@
+diff -r 0fa141a441c0 -r 6952630c46a6 pidgin/gtkmedia.c
+--- a/pidgin/gtkmedia.c
++++ b/pidgin/gtkmedia.c
+@@ -500,6 +500,8 @@
+       PidginMedia *gtkmedia = PIDGIN_MEDIA(media);
+       purple_debug_info("gtkmedia", "pidgin_media_dispose\n");
+ 
++      g_object_set_data(media, "simplezrtp/media-window", NULL);
++
+       if (gtkmedia->priv->media) {
+               purple_request_close_with_handle(gtkmedia);
+               purple_media_remove_output_windows(gtkmedia->priv->media);
+@@ -1097,6 +1099,9 @@
+       PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(),
+                                            "media", media,
+                                            "screenname", screenname, NULL);
++
++      g_object_set_data(G_OBJECT(media),
++                      "simplezrtp/media-window", gtkmedia);
+       return GTK_WIDGET(gtkmedia);
+ }
+ 

Modified: trunk/src/pidgin-plugin/simplezrtp/gtk-encrypt.c
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/src/pidgin-plugin/simplezrtp/gtk-encrypt.c?rev=9&r1=8&r2=9&view=diff
==============================================================================
--- trunk/src/pidgin-plugin/simplezrtp/gtk-encrypt.c    (original)
+++ trunk/src/pidgin-plugin/simplezrtp/gtk-encrypt.c    Sun Jun  1 23:04:16 2014
@@ -176,14 +176,19 @@
                g_object_unref(priv->encrypt);
                priv->encrypt = NULL;
        }
+
        if (priv->box) {
-               gtk_widget_destroy(priv->box);
+               if (priv->window)
+                       gtk_widget_destroy(priv->box);
+               else
+                       g_object_unref(priv->box);
                priv->box = NULL;
        }
+
        if (priv->window) {
                gtk_widget_destroy(priv->window);
                priv->window = NULL;
-       }
+       } 
 
        if (priv->auth_controls) {
                g_hash_table_destroy(priv->auth_controls);
@@ -293,7 +298,7 @@
        gtk_box_pack_start(GTK_BOX(obj->controlbox), 
                        obj->authbox, TRUE, TRUE, 6);
        /* SAS text box */
-       obj->msgwidget = gtk_label_new(" (no SAS) ");
+       obj->msgwidget = gtk_label_new(" (no SAS)  ");
        gtk_box_pack_end(GTK_BOX(obj->authbox), 
                        obj->msgwidget, FALSE, FALSE, 2);
        /* ZRTP authenticate button */
@@ -327,7 +332,7 @@
 
        controlbox = pidgin_encrypt_call_add_controlbox(call);
        gtk_box_pack_start(GTK_BOX(priv->box), controlbox, FALSE, FALSE, 0);
-       gtk_widget_show_all(priv->window);
+       gtk_widget_show_all(priv->box);
 
        update_auth_state(priv->encrypt, participant, 
PURPLE_ENCRYPT_STATE_CLEAR);
        return call;
@@ -342,6 +347,7 @@
        call = pidgin_encrypt_get_call(self, participant);
        g_return_if_fail(call != NULL);
 
+       gtk_widget_destroy(call->controlbox);
        g_free(call->participant);
        g_object_unref(call->gtkencrypt);
        pidgin_encrypt_remove_call(self, participant);
@@ -374,12 +380,11 @@
 
                                priv->box = gtk_vbox_new(TRUE, 5);
                                gtk_container_add(GTK_CONTAINER(priv->window), 
priv->box);
-                               gtk_widget_show(priv->window);
+                               gtk_widget_show_all(priv->box);
                        } else {
                                priv->box = g_object_ref(box);
                        }
-
-                       gtk_widget_show_all(priv->box);
+                       gtk_widget_show_all(gtk_widget_get_parent(priv->box));
                        break;
                }
                default:
@@ -439,12 +444,34 @@
 /** 
  * Gtk interface to the PurpleEncrypt subcomponent of libpurple 
  */
+static GtkWidget* get_parentbox(PurpleEncrypt *encrypt)
+{
+       PurpleMedia *media;
+       GtkWidget *mediawindow, *parentbox;
+
+       g_object_get(encrypt, "media", &media, NULL);
+       mediawindow = GTK_WIDGET(g_object_get_data(G_OBJECT(media),
+                               "simplezrtp/media-window"));
+       if (!GTK_IS_WINDOW(mediawindow)) {
+               purple_debug_info(PLUGIN_ID, "get_parentbox(): no access to 
PidginMedia window.\n");
+               return NULL;
+       }
+
+       parentbox = gtk_bin_get_child(GTK_BIN(mediawindow));
+       if (!GTK_IS_BOX(parentbox))
+               return NULL;
+
+       return parentbox;
+}
+
 static void media_new(PurpleEncrypt *encrypt)
 {
+       GtkWidget *parentbox = get_parentbox(encrypt);
        PidginEncrypt *self = g_object_new(PIDGIN_TYPE_ENCRYPT,
                        "encrypt", encrypt,
-                       "box", NULL,
+                       "box", parentbox,
                        NULL);
+
        purple_encrypt_set_ui_data(encrypt, self);
 
        purple_debug_info(PLUGIN_ID, "gtk: media_new(encrypt %p)\n", encrypt);
@@ -546,6 +573,7 @@
                shorttext = g_strdup_printf("<span color=\"%s\">%s</span>",
                                states[img_state].colorstring, 
states[img_state].shorttext);
                gtk_label_set_markup(GTK_LABEL(recv->label), shorttext);
+               gtk_widget_show_all(recv->authimg);
                g_free(shorttext);
 
                gtk_widget_set_tooltip_text(GTK_WIDGET(recv->authimg),


_______________________________________________
Pidgin-zrtp-commits mailing list
Pidgin-zrtp-commits@gna.org
https://mail.gna.org/listinfo/pidgin-zrtp-commits

Reply via email to