empathy r2403 - trunk/libempathy-gtk



Author: xclaesse
Date: Tue Feb  3 09:03:58 2009
New Revision: 2403
URL: http://svn.gnome.org/viewvc/empathy?rev=2403&view=rev

Log:
Add minimum width and height properties

Signed-off-by: Sjoerd Simons <sjoerd simons collabora co uk>

Modified:
   trunk/libempathy-gtk/empathy-video-widget.c
   trunk/libempathy-gtk/empathy-video-widget.h

Modified: trunk/libempathy-gtk/empathy-video-widget.c
==============================================================================
--- trunk/libempathy-gtk/empathy-video-widget.c	(original)
+++ trunk/libempathy-gtk/empathy-video-widget.c	Tue Feb  3 09:03:58 2009
@@ -51,6 +51,8 @@
 enum {
   PROP_GST_ELEMENT = 1,
   PROP_GST_BUS,
+  PROP_MIN_WIDTH,
+  PROP_MIN_HEIGHT,
 };
 
 /* private structure */
@@ -64,6 +66,8 @@
   GstPad *sink_pad;
   GstElement *overlay;
   FsElementAddedNotifier *notifier;
+  gint min_width;
+  gint min_height;
 };
 
 #define GET_PRIV(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
@@ -73,13 +77,16 @@
 empathy_video_widget_init (EmpathyVideoWidget *obj)
 {
   EmpathyVideoWidgetPriv *priv = GET_PRIV (obj);
+  GdkColor black;
 
   priv->notifier = fs_element_added_notifier_new ();
   g_signal_connect (priv->notifier, "element-added",
     G_CALLBACK (empathy_video_widget_element_added_cb),
     obj);
 
-  gtk_widget_set_size_request (GTK_WIDGET (obj), 320, 240);
+  if (gdk_color_parse ("Black", &black))
+    gtk_widget_modify_bg (GTK_WIDGET (obj), GTK_STATE_NORMAL,
+      &black);
 
   GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (obj), GTK_DOUBLE_BUFFERED);
 }
@@ -101,6 +108,8 @@
   g_signal_connect (priv->bus, "sync-message",
     G_CALLBACK (empathy_video_widget_sync_message_cb), object);
 
+  gtk_widget_set_size_request (GTK_WIDGET (object), priv->min_width,
+    priv->min_height);
 }
 
 static void empathy_video_widget_dispose (GObject *object);
@@ -119,6 +128,12 @@
       case PROP_GST_BUS:
         priv->bus = g_value_dup_object (value);
         break;
+      case PROP_MIN_WIDTH:
+        priv->min_width = g_value_get_int (value);
+        break;
+      case PROP_MIN_HEIGHT:
+        priv->min_height = g_value_get_int (value);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -138,6 +153,12 @@
       case PROP_GST_BUS:
         g_value_set_object (value, priv->bus);
         break;
+      case PROP_MIN_WIDTH:
+        g_value_set_int (value, priv->min_width);
+        break;
+      case PROP_MIN_HEIGHT:
+        g_value_set_int (value, priv->min_height);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -177,6 +198,21 @@
     GST_TYPE_BUS,
     G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_GST_BUS, param_spec);
+
+  param_spec = g_param_spec_int ("min-width",
+    "min-width",
+    "Minimal width of the widget",
+    0, G_MAXINT, 320,
+    G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_MIN_WIDTH, param_spec);
+
+  param_spec = g_param_spec_int ("min-height",
+    "min-height",
+    "Minimal height of the widget",
+    0, G_MAXINT, 240,
+    G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_MIN_HEIGHT, param_spec);
+
 }
 
 void
@@ -279,6 +315,17 @@
   return TRUE;
 }
 
+GtkWidget *
+empathy_video_widget_new_with_size (GstBus *bus, gint width, gint height)
+{
+  g_return_val_if_fail (bus != NULL, NULL);
+
+  return GTK_WIDGET (g_object_new (EMPATHY_TYPE_GST_GTK_WIDGET,
+    "gst-bus", bus,
+    "min-width", width,
+    "min-height", height,
+    NULL));
+}
 
 GtkWidget *
 empathy_video_widget_new (GstBus *bus)

Modified: trunk/libempathy-gtk/empathy-video-widget.h
==============================================================================
--- trunk/libempathy-gtk/empathy-video-widget.h	(original)
+++ trunk/libempathy-gtk/empathy-video-widget.h	Tue Feb  3 09:03:58 2009
@@ -58,6 +58,8 @@
   EmpathyVideoWidgetClass))
 
 GtkWidget *empathy_video_widget_new (GstBus *bus);
+GtkWidget *empathy_video_widget_new_with_size (GstBus *bus,
+  gint width, gint height);
 
 GstElement *empathy_video_widget_get_element (EmpathyVideoWidget *widget);
 GstPad *empathy_video_widget_get_sink (EmpathyVideoWidget *widget);



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