Example #1
0
void
empathy_chat_window_move_chat (EmpathyChatWindow *old_window,
			       EmpathyChatWindow *new_window,
			       EmpathyChat       *chat)
{
	GtkWidget *widget;

	g_return_if_fail (EMPATHY_IS_CHAT_WINDOW (old_window));
	g_return_if_fail (EMPATHY_IS_CHAT_WINDOW (new_window));
	g_return_if_fail (EMPATHY_IS_CHAT (chat));

	widget = GTK_WIDGET (chat);

	DEBUG ("Chat moving with widget:%p (%d references)", widget,
		G_OBJECT (widget)->ref_count);

	/* We reference here to make sure we don't loose the widget
	 * and the EmpathyChat object during the move.
	 */
	g_object_ref (chat);
	g_object_ref (widget);

	empathy_chat_window_remove_chat (old_window, chat);
	empathy_chat_window_add_chat (new_window, chat);

	g_object_unref (widget);
	g_object_unref (chat);
}
Example #2
0
void
rb_plugins_engine_configure_plugin (RBPluginInfo *info,
				       GtkWindow       *parent)
{
	GtkWidget *conf_dlg;

	GtkWindowGroup *wg;

	g_return_if_fail (info != NULL);

	conf_dlg = rb_plugin_create_configure_dialog (info->plugin);
	g_return_if_fail (conf_dlg != NULL);
	gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
				      parent);

	wg = parent->group;
	if (wg == NULL)
	{
		wg = gtk_window_group_new ();
		gtk_window_group_add_window (wg, parent);
	}

	gtk_window_group_add_window (wg,
				     GTK_WINDOW (conf_dlg));

	gtk_window_set_modal (GTK_WINDOW (conf_dlg), TRUE);
	gtk_widget_show (conf_dlg);
}
void er_dtls_connection_start(ErDtlsConnection *self, gboolean is_client)
{
    g_return_if_fail(ER_IS_DTLS_CONNECTION(self));
    ErDtlsConnectionPrivate *priv = self->priv;
    g_return_if_fail(priv->send_closure);
    g_return_if_fail(priv->ssl);
    g_return_if_fail(priv->bio);

    LOG_TRACE(self, "locking @ start");
    g_mutex_lock(&priv->mutex);
    LOG_TRACE(self, "locked @ start");

    priv->is_alive = TRUE;
    priv->timeout_set = FALSE;
    priv->bio_buffer = NULL;
    priv->bio_buffer_len = 0;
    priv->bio_buffer_offset = 0;
    priv->keys_exported = FALSE;

    priv->is_client = is_client;
    if (priv->is_client) {
        SSL_set_connect_state(priv->ssl);
    } else {
        SSL_set_accept_state(priv->ssl);
    }
    log_state(self, "initial state set");

    openssl_poll(self);

    log_state(self, "first poll done");
    priv->thread = NULL;

    LOG_TRACE(self, "unlocking @ start");
    g_mutex_unlock(&priv->mutex);
}
Example #4
0
/*
 * Assign a position for an already existing anchor.
 */
void p_Dw_gtk_viewport_change_anchor (DwWidget *widget,
                                      gchar *name,
                                      gint32 y)
{
   GtkDwViewport *viewport;
   GtkDwViewportAnchor *anchor;
   gpointer tmp_anchor;
   gboolean exists;

   _MSG("changing anchor %p/'%s' -> %d\n", widget, name, y);

   g_return_if_fail (widget->viewport != NULL);
   viewport = GTK_DW_VIEWPORT (widget->viewport);

   exists =
      g_hash_table_lookup_extended (viewport->anchors_table, name, NULL,
                                    &tmp_anchor);
   g_return_if_fail(exists);

   anchor = tmp_anchor;
   g_return_if_fail(anchor->widget == widget);

   anchor->y = y;

   Dw_gtk_viewport_update_anchor (viewport);
}
static void
preview_selection_changed_cb (GtkTreeSelection *selection,
                              EWebViewPreview *preview)
{
	GtkTreeIter iter;
	GtkTreeModel *model = NULL;
	gboolean found = FALSE;

	g_return_if_fail (selection != NULL);
	g_return_if_fail (preview != NULL);
	g_return_if_fail (fill_preview_func != NULL);

	if (gtk_tree_selection_get_selected (selection, &model, &iter) && model) {
		CamelMimeMessage *msg = NULL;

		gtk_tree_model_get (model, &iter, 2, &msg, -1);

		if (msg) {
			found = TRUE;
			fill_preview_func (G_OBJECT (preview), msg);
			g_object_unref (msg);
		}
	}

	if (!found) {
		e_web_view_preview_begin_update (preview);
		e_web_view_preview_end_update (preview);
	}
}
Example #6
0
/**
 * gda_report_engine_declare_object
 * @engine: a #GdaReportEngine object
 * @object: a #GObject to declare
 * @obj_name: the name to give to @object within @engine
 *
 * Declares an object which will be used in @engine, referenced by the @obj_name name.
 *
 * @object must be of a supported types, that it must be a #GdaConnection, #GdaStatement or #GdaHolder object.
 */
void
gda_report_engine_declare_object (GdaReportEngine *engine, GObject *object, const gchar *obj_name)
{
	gchar prefix, *real_name;
	GObject *current_obj;
	g_return_if_fail (GDA_IS_REPORT_ENGINE (engine));
	g_return_if_fail (engine->priv);
	g_return_if_fail (G_IS_OBJECT (object));
	g_return_if_fail (obj_name);

	if (GDA_IS_STATEMENT (object))
		prefix = 'S';
	else if (GDA_IS_CONNECTION (object))
		prefix = 'C';
	else if (GDA_IS_HOLDER (object))
		prefix = 'H';
	else {
		g_warning (_("Object type '%s' cannot be declared in this context"), G_OBJECT_TYPE_NAME (object));
		return;
	}
	
	real_name = g_strdup_printf ("%c%s", prefix, obj_name);
	current_obj = g_hash_table_lookup (engine->priv->objects, real_name);
	if (current_obj) {
		if (current_obj != object) 
			g_warning (_("An object with the '%s' name has already been declared"), obj_name);
	}
	else {
		/*g_print ("%s(): declared %p as %s\n", __FUNCTION__, object, real_name);*/
		g_hash_table_insert (engine->priv->objects, real_name, object);
		g_object_ref (object);
	}
}
Example #7
0
/**
 * stf_dialog_result_attach_formats_to_cr
 * @dialogresult: a dialogresult struct
 * @cr: a cell region
 *
 * Attach the formats of the dialogresult to the given cell region.
 *
 * returns: nothing
 **/
void
stf_dialog_result_attach_formats_to_cr (DialogStfResult_t *dialogresult,
					GnmCellRegion *cr)
{
	unsigned int col, targetcol;

	g_return_if_fail (dialogresult != NULL);
	g_return_if_fail (cr != NULL);

	targetcol = 0;
	for (col = 0; col < dialogresult->parseoptions->formats->len; col++) {
		if (dialogresult->parseoptions->col_import_array[col]) {
			GOFormat *sf = g_ptr_array_index
				(dialogresult->parseoptions->formats, col);
			GnmStyleRegion *sr = g_new (GnmStyleRegion, 1);

			sr->range.start.col = targetcol;
			sr->range.start.row = 0;
			sr->range.end.col   = targetcol;
			sr->range.end.row   = dialogresult->rowcount - 1;
			sr->style = gnm_style_new_default ();
			gnm_style_set_format (sr->style, sf);
			targetcol++;

			cr->styles = g_slist_prepend (cr->styles, sr);
		}
	}
}
static void
identity_remote_object_destroyed_cb(GDBusProxy *proxy,
                                    gpointer user_data)
{
    g_return_if_fail (SIGNON_IS_IDENTITY (user_data));
    SignonIdentity *self = SIGNON_IDENTITY (user_data);

    SignonIdentityPrivate *priv = self->priv;
    g_return_if_fail (priv != NULL);

    if (priv->proxy)
    {
        g_object_unref (priv->proxy);
        priv->proxy = NULL;
    }

    DEBUG ("%s %d", G_STRFUNC, __LINE__);

    _signon_object_not_ready(self);

    priv->registration_state = NOT_REGISTERED;

    signon_identity_info_free (priv->identity_info);
    priv->identity_info = NULL;

    priv->removed = FALSE;
    priv->signed_out = FALSE;
    priv->updated = FALSE;
}
static void
identity_check_remote_registration (SignonIdentity *self)
{
    g_return_if_fail (self != NULL);
    SignonIdentityPrivate *priv = self->priv;

    g_return_if_fail (priv != NULL);

    if (priv->registration_state != NOT_REGISTERED)
        return;

    if (priv->id != 0)
        sso_auth_service_call_get_identity (priv->auth_service_proxy,
                                            priv->id,
                                            priv->cancellable,
                                            identity_new_from_db_cb,
                                            self);
    else
        sso_auth_service_call_register_new_identity (priv->auth_service_proxy,
                                                     priv->cancellable,
                                                     identity_new_cb,
                                                     self);

    priv->registration_state = PENDING_REGISTRATION;
}
void
nm_vpn_manager_add_active_connections (NMVPNManager *self,
                                       NMConnection *filter,
                                       GPtrArray *array)
{
	NMVPNManagerPrivate *priv;
	GHashTableIter iter;
	gpointer data;
	GSList *active, *elt;

	g_return_if_fail (self);
	g_return_if_fail (NM_IS_VPN_MANAGER (self));
	g_return_if_fail (array != NULL);

	priv = NM_VPN_MANAGER_GET_PRIVATE (self);
	g_hash_table_iter_init (&iter, priv->services);
	while (g_hash_table_iter_next (&iter, NULL, &data)) {
		active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data));
		for (elt = active; elt; elt = g_slist_next (elt)) {
			NMVPNConnection *vpn = NM_VPN_CONNECTION (elt->data);
			const char *path;

			if (!filter || (nm_vpn_connection_get_connection (vpn) == filter)) {
				path = nm_vpn_connection_get_active_connection_path (vpn);
				g_ptr_array_add (array, g_strdup (path));
			}
		}
	}
}
static void
identity_info_reply(GObject *object, GAsyncResult *res,
                    gpointer userdata)
{
    SsoIdentity *proxy = SSO_IDENTITY (object);
    GVariant *identity_data = NULL;
    DEBUG ("%d %s", __LINE__, __func__);

    GError *error = NULL;
    IdentityInfoCbData *cb_data = (IdentityInfoCbData *)userdata;

    g_return_if_fail (cb_data != NULL);
    g_return_if_fail (cb_data->self != NULL);
    g_return_if_fail (cb_data->self->priv != NULL);

    SignonIdentityPrivate *priv = cb_data->self->priv;

    sso_identity_call_get_info_finish (proxy, &identity_data, res, &error);
    SIGNON_RETURN_IF_CANCELLED (error);
    priv->identity_info =
        signon_identity_info_new_from_variant (identity_data);
    if (identity_data != NULL)
        g_variant_unref (identity_data);

    if (cb_data->cb)
    {
        (cb_data->cb) (cb_data->self, priv->identity_info, error, cb_data->user_data);
    }

    g_clear_error(&error);
    g_slice_free (IdentityInfoCbData, cb_data);

    priv->updated = TRUE;
}
Example #12
0
void
gimp_channel_combine_buffer (GimpChannel    *mask,
                             GeglBuffer     *add_on_buffer,
                             GimpChannelOps  op,
                             gint            off_x,
                             gint            off_y)
{
  GimpChannelCombineData data;

  g_return_if_fail (GIMP_IS_CHANNEL (mask));
  g_return_if_fail (GEGL_IS_BUFFER (add_on_buffer));

  if (gimp_channel_combine_start (mask, op,
                                  GEGL_RECTANGLE (
                                    off_x,
                                    off_y,
                                    gegl_buffer_get_width  (add_on_buffer),
                                    gegl_buffer_get_height (add_on_buffer)),
                                  FALSE, FALSE, &data))
    {
      GeglBuffer *buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));

      gimp_gegl_mask_combine_buffer (buffer, add_on_buffer, op,
                                     off_x, off_y);
    }

  gimp_channel_combine_end (mask, &data);
}
void
nm_wifi_item_remove_ap (NMWifiItem *self,
                        NMAccessPoint *ap)
{
    NMWifiItemPrivate *priv;
    GSList *iter;

    g_return_if_fail (NM_IS_WIFI_ITEM (self));
    g_return_if_fail (NM_IS_ACCESS_POINT (ap));

    priv = GET_PRIVATE (self);
    for (iter = priv->ap_list; iter; iter = iter->next) {
        if (ap != iter->data)
            continue;

        g_signal_handlers_disconnect_matched (ap,
                                              G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
                                              0, 0, NULL, update_current_ap, self);

        priv->ap_list = g_slist_delete_link (priv->ap_list, iter);
        g_object_unref (ap);

        if (priv->ap_list)
            update_current_ap (self);
        else
            /* No APs left, die */
            nm_list_item_request_remove (NM_LIST_ITEM (self));

        break;
    }
}
/**
 * Fills the treelist with accounts, should be called whenever the account
 * list is modified.
 */
static void account_store_fill()
{
    g_return_if_fail(account_list_dialog != NULL);
    gtk_list_store_clear(account_store);

    // IP2IP account must be first
    account_t *ip2ip = account_list_get_by_id(IP2IP_PROFILE);
    g_return_if_fail(ip2ip != NULL);
    ip2ip->state = ACCOUNT_STATE_IP2IP_READY;

    GtkTreeIter iter;
    gtk_list_store_append(account_store, &iter);

    account_store_add(&iter, ip2ip);

    for (size_t i = 0; i < account_list_get_size(); ++i) {
        account_t *a = account_list_get_nth(i);
        g_return_if_fail(a != NULL);

        // we don't want to process the IP2IP twice
        if (a != ip2ip) {
            gtk_list_store_append(account_store, &iter);
            account_store_add(&iter, a);
        }
    }
}
Example #15
0
/**
 * clutter_container_foreach_with_internals:
 * @container: a #ClutterContainer
 * @callback: (scope call): a function to be called for each child
 * @user_data: data to be passed to the function, or %NULL
 *
 * Calls @callback for each child of @container, including "internal"
 * children built in to the container itself that were never added
 * by the application.
 *
 * This function calls the #ClutterContainerIface.foreach_with_internals()
 * virtual function, which has been deprecated.
 *
 * Since: 1.0
 *
 * Deprecated: 1.10: See clutter_container_foreach().
 */
void
clutter_container_foreach_with_internals (ClutterContainer *container,
                                          ClutterCallback   callback,
                                          gpointer          user_data)
{
  ClutterContainerIface *iface;

  g_return_if_fail (CLUTTER_IS_CONTAINER (container));
  g_return_if_fail (callback != NULL);

  iface = CLUTTER_CONTAINER_GET_IFACE (container);

#ifdef CLUTTER_ENABLE_DEBUG
  if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
    {
      if (iface->foreach_with_internals != NULL)
        _clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
                                     "virtual function has been deprecated "
                                     "and it should not be overridden by "
                                     "newly written code");
    }
#endif /* CLUTTER_ENABLE_DEBUG */

  if (iface->foreach_with_internals != NULL)
    iface->foreach_with_internals (container, callback, user_data);
  else
    iface->foreach (container, callback, user_data);
}
/**
 * signon_identity_store_credentials_with_info:
 * @self: the #SignonIdentity.
 * @info: the #SignonIdentityInfo data to store.
 * @cb: (scope async): callback.
 * @user_data: user_data.
 *
 * Stores the data from @info into the identity.
 */
void
signon_identity_store_credentials_with_info(SignonIdentity *self,
                                            const SignonIdentityInfo *info,
                                            SignonIdentityStoreCredentialsCb cb,
                                            gpointer user_data)
{
    IdentityStoreCredentialsCbData *cb_data;
    IdentityStoreCredentialsData *operation_data;

    DEBUG ();
    g_return_if_fail (SIGNON_IS_IDENTITY (self));
    g_return_if_fail (info != NULL);

    cb_data = g_slice_new0 (IdentityStoreCredentialsCbData);
    cb_data->self = self;
    cb_data->cb = cb;
    cb_data->user_data = user_data;

    operation_data = g_slice_new0 (IdentityStoreCredentialsData);
    operation_data->info_variant = signon_identity_info_to_variant (info);
    operation_data->cb_data = cb_data;

    identity_check_remote_registration (self);
    _signon_object_call_when_ready (self,
                                    identity_object_quark(),
                                    identity_store_credentials_ready_cb,
                                    operation_data);
}
Example #17
0
static void
facets_analyse(GwyContainer *data, GwyRunType run)
{
    FacetsArgs args;
    GwyContainer *fdata;
    GwyDataField *dfield, *mfield;
    GQuark mquark;
    gint id;

    g_return_if_fail(run & FACETS_RUN_MODES);
    g_return_if_fail(g_type_from_name("GwyLayerPoint"));
    facets_load_args(gwy_app_settings_get(), &args);

    gwy_app_data_browser_get_current(GWY_APP_DATA_FIELD, &dfield,
                                     GWY_APP_MASK_FIELD_KEY, &mquark,
                                     GWY_APP_MASK_FIELD, &mfield,
                                     GWY_APP_DATA_FIELD_ID, &id,
                                     0);
    g_return_if_fail(dfield && mquark);

    fdata = gwy_container_new();
    gwy_data_field_facet_distribution(dfield, 2*args.kernel_size + 1, fdata);
    args.theta0 = gwy_container_get_double_by_name(fdata, "/theta0");
    args.phi0 = gwy_container_get_double_by_name(fdata, "/phi0");
    if (run == GWY_RUN_IMMEDIATE)
        run_noninteractive(&args, data, fdata, dfield, mfield, mquark);
    else {
        facets_dialog(&args, data, fdata, dfield, mfield, id, mquark);
        facets_save_args(gwy_app_settings_get(), &args);
    }
    g_object_unref(fdata);
}
static void
identity_verify_data(SignonIdentity *self,
                     const gchar *data_to_send,
                     gint operation,
                     SignonIdentityVerifyCb cb,
                     gpointer user_data)
{
    g_return_if_fail (SIGNON_IS_IDENTITY (self));

    SignonIdentityPrivate *priv = self->priv;
    g_return_if_fail (priv != NULL);

    DEBUG ("%s %d", G_STRFUNC, __LINE__);

    IdentityVerifyCbData *cb_data = g_slice_new0 (IdentityVerifyCbData);
    cb_data->self = self;
    cb_data->cb = cb;
    cb_data->user_data = user_data;

    IdentityVerifyData *operation_data = g_slice_new0 (IdentityVerifyData);

    operation_data->params = NULL;
    operation_data->data_to_send = g_strdup (data_to_send);
    operation_data->operation = operation;
    operation_data->cb_data = cb_data;

    identity_check_remote_registration (self);
    _signon_object_call_when_ready (self,
                                    identity_object_quark(),
                                    identity_verify_ready_cb,
                                    operation_data);
}
Example #19
0
void
hal_property_set_string (HalProperty *prop, const char *value)
{
	char *endchar;
	gboolean validated = TRUE;

	g_return_if_fail (prop != NULL);
	g_return_if_fail (prop->type == HAL_PROPERTY_TYPE_STRING ||
			  prop->type == HAL_PROPERTY_TYPE_INVALID);

	prop->type = HAL_PROPERTY_TYPE_STRING;
	if (prop->v.str_value != NULL)
		g_free (prop->v.str_value);
	prop->v.str_value = g_strdup (value);

	while (!g_utf8_validate (prop->v.str_value, -1,
				 (const char **) &endchar)) {
		validated = FALSE;
		*endchar = '?';
	}

	if (!validated) {
		HAL_WARNING (("Key '%s' has invalid UTF-8 string '%s'",
			      prop->key, value));
	}
}
Example #20
0
static void
muine_update_icon(EinaMuine *self, LomoStream *stream)
{
    g_return_if_fail(EINA_IS_MUINE(self));
    g_return_if_fail(LOMO_IS_STREAM(stream));

    EinaMuinePrivate *priv = self->priv;

    // Check URI != loading-uri
    const GValue *art_value = lomo_stream_get_extended_metadata(stream, LOMO_STREAM_EM_ART_DATA);
    g_return_if_fail(art_value);

    if (lomo_em_art_provider_value_is_loading(art_value))
        return;

    // Check for matching iter
    GtkTreeIter *iter = g_hash_table_lookup(priv->stream_iter_map, stream);
    g_return_if_fail(iter);

    // Load pixbuf
    GdkPixbuf *pb = gel_ui_pixbuf_from_value(art_value);
    g_return_if_fail(GDK_IS_PIXBUF(pb));

    GdkPixbuf *scaled = gdk_pixbuf_scale_simple(pb, DEFAULT_SIZE, DEFAULT_SIZE, GDK_INTERP_NEAREST);
    g_object_unref(pb);

    // Store
    gtk_list_store_set(muine_get_model(self), iter,
                       COMBO_COLUMN_ICON, scaled,
                       -1);
    g_object_unref(scaled);
}
static void
gkd_secret_exchange_set_property (GObject *obj,
                                  guint prop_id,
                                  const GValue *value,
                                  GParamSpec *pspec)
{
	GkdSecretExchange *self = GKD_SECRET_EXCHANGE (obj);

	switch (prop_id) {
	case PROP_CALLER:
		g_return_if_fail (!self->caller);
		self->caller = g_value_dup_string (value);
		break;
	case PROP_SERVICE:
		g_return_if_fail (!self->service);
		self->service = g_value_get_object (value);
		g_return_if_fail (self->service);
		g_object_add_weak_pointer (G_OBJECT (self->service),
		                           (gpointer*)&(self->service));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
		break;
	}
}
Example #22
0
static void
gtk_combo_button_size_request (GtkWidget *widget,
			   GtkRequisition *requisition)
{
  GtkComboButton *combo_button;
  GtkRequisition box_requisition;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_COMBO_BUTTON (widget));
  g_return_if_fail (requisition != NULL);

  GTK_WIDGET_CLASS (parent_class)->size_request (widget, &box_requisition);

  combo_button=GTK_COMBO_BUTTON(widget);
/*
  size = MIN(box_requisition.width, box_requisition.height);
  size = MIN(combo_button->button->requisition.width, box_requisition.height);
  size = MIN(combo_button->button->requisition.width, box_requisition.height);

  widget->requisition.height = size;
  widget->requisition.width = size + combo_button->arrow->requisition.width;
*/
  widget->requisition.height = box_requisition.height;
  widget->requisition.width = box_requisition.width;
}
Example #23
0
/*
 * Remove an anchor from the table in the viewport. Notice that "name"
 * is freed here.
 */
void p_Dw_gtk_viewport_remove_anchor (DwWidget *widget,
                                      gchar *name)
{
   GtkDwViewport *viewport;
   GtkDwViewportAnchor *anchor;
   gpointer tmp_anchor;
   gboolean exists;

   _MSG("removing anchor %p/'%s'\n", widget, name);

   g_return_if_fail (widget->viewport != NULL);
   viewport = GTK_DW_VIEWPORT (widget->viewport);

   exists =
      g_hash_table_lookup_extended (viewport->anchors_table, name, NULL,
                                    &tmp_anchor);
   g_return_if_fail(exists);

   anchor = tmp_anchor;
   g_return_if_fail(anchor->widget == widget);

   g_hash_table_remove (viewport->anchors_table, name);
   g_free (anchor->name);
   g_free (anchor);
}
Example #24
0
static void
gtk_combo_button_size_allocate (GtkWidget     *widget,
			 GtkAllocation *allocation)
{
  GtkComboButton *combo_button;
  GtkAllocation button_allocation;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_COMBO_BUTTON (widget));
  g_return_if_fail (allocation != NULL);

  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);

  combo_button = GTK_COMBO_BUTTON (widget);

  button_allocation = combo_button->button->allocation;
/*
  button_allocation.width = MIN(button_allocation.width, 
                                combo_button->button->requisition.width);
  button_allocation.height = MIN(button_allocation.height, 
                               combo_button->button->requisition.height);
  button_allocation.x += (combo_button->button->allocation.width-
                        button_allocation.width) / 2;
  button_allocation.y += (combo_button->button->allocation.height-
                        button_allocation.height) / 2;
*/

  gtk_widget_size_allocate (combo_button->button, &button_allocation);

  button_allocation.x=combo_button->button->allocation.x +
                      combo_button->button->allocation.width;
  button_allocation.width=combo_button->arrow->requisition.width;
  gtk_widget_size_allocate (combo_button->arrow, &button_allocation);

}
static void
mbox_preview_add_message (CamelMimeMessage *msg,
			  GtkListStore **pstore)
{
	GtkTreeIter iter;
	gchar *from;

	g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
	g_return_if_fail (pstore != NULL);

	if (!*pstore)
		*pstore = gtk_list_store_new (
			3, G_TYPE_STRING, G_TYPE_STRING,
			CAMEL_TYPE_MIME_MESSAGE);

	from = NULL;

	if (camel_mime_message_get_from (msg))
		from = camel_address_encode (CAMEL_ADDRESS (camel_mime_message_get_from (msg)));

	gtk_list_store_append (*pstore, &iter);
	gtk_list_store_set (
		*pstore, &iter,
		0, camel_mime_message_get_subject (msg) ?
		camel_mime_message_get_subject (msg) : "",
		1, from ? from : "", 2, msg, -1);

	g_free (from);
}
void
gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
                                      const gchar       *prog_name,
                                      const gchar       *menu_path,
                                      const gchar       *menu_label)
{
  GimpPlugInMenuBranch *branch;

  g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
  g_return_if_fail (prog_name != NULL);
  g_return_if_fail (menu_path != NULL);
  g_return_if_fail (menu_label != NULL);

  branch = g_slice_new (GimpPlugInMenuBranch);

  branch->prog_name  = g_strdup (prog_name);
  branch->menu_path  = plug_in_menu_path_map (menu_path);
  branch->menu_label = g_strdup (menu_label);

  manager->menu_branches = g_slist_append (manager->menu_branches, branch);

  g_signal_emit_by_name (manager, "menu-branch-added",
                         branch->prog_name,
                         branch->menu_path,
                         branch->menu_label);

#ifdef VERBOSE
  g_print ("added menu branch \"%s\" at path \"%s\"\n",
           branch->menu_label, branch->menu_path);
#endif
}
static void er_dtls_connection_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
    ErDtlsConnection *self = ER_DTLS_CONNECTION(object);
    ErDtlsAgent *agent;
    ErDtlsConnectionPrivate *priv = self->priv;
    SSL_CTX *ssl_context;

    switch (prop_id) {
    case PROP_AGENT:
        g_return_if_fail(!priv->ssl);
        agent = ER_DTLS_AGENT(g_value_get_object(value));
        g_return_if_fail(ER_IS_DTLS_AGENT(agent));

        ssl_context = _er_dtls_agent_peek_context(agent);

        priv->ssl = SSL_new(ssl_context);
        g_return_if_fail(priv->ssl);

        priv->bio = BIO_new(BIO_s_er_dtls_connection());
        g_return_if_fail(priv->bio);

        priv->bio->ptr = self;
        SSL_set_bio(priv->ssl, priv->bio, priv->bio);

        SSL_set_verify(priv->ssl,
            SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, openssl_verify_callback);
        SSL_set_ex_data(priv->ssl, connection_ex_index, self);

        log_state(self, "connection created");
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(self, prop_id, pspec);
    }
}
Example #28
0
/**
 * clutter_container_child_get_property:
 * @container: a #ClutterContainer
 * @child: a #ClutterActor that is a child of @container.
 * @property: the name of the property to set.
 * @value: the value.
 *
 * Gets a container specific property of a child of @container, In general,
 * a copy is made of the property contents and the caller is responsible for
 * freeing the memory by calling g_value_unset().
 *
 * Note that clutter_container_child_set_property() is really intended for
 * language bindings, clutter_container_child_set() is much more convenient
 * for C programming.
 *
 * Since: 0.8
 */
void
clutter_container_child_get_property (ClutterContainer *container,
                                      ClutterActor     *child,
                                      const gchar      *property,
                                      GValue           *value)
{
  GObjectClass *klass;
  GParamSpec   *pspec;

  g_return_if_fail (CLUTTER_IS_CONTAINER (container));
  g_return_if_fail (CLUTTER_IS_ACTOR (child));
  g_return_if_fail (property != NULL);
  g_return_if_fail (value != NULL);

  klass = G_OBJECT_GET_CLASS (container);

  pspec = clutter_container_class_find_child_property (klass, property);
  if (!pspec)
    {
      g_warning ("%s: Containers of type '%s' have no child "
                 "property named '%s'",
                 G_STRLOC, G_OBJECT_TYPE_NAME (container), property);
      return;
    }

  if (!(pspec->flags & G_PARAM_READABLE))
    {
      g_warning ("%s: Child property '%s' of the container '%s' "
                 "is not writable",
                 G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
      return;
    }

  container_get_child_property (container, child, value, pspec);
}
void er_dtls_connection_close(ErDtlsConnection *self)
{
    g_return_if_fail(ER_IS_DTLS_CONNECTION(self));
    g_return_if_fail(self->priv->ssl);
    g_return_if_fail(self->priv->bio);

    LOG_DEBUG(self, "closing connection");

    LOG_TRACE(self, "locking @ close");
    g_mutex_lock(&self->priv->mutex);
    LOG_TRACE(self, "locked @ close");

    if (self->priv->is_alive) {
        self->priv->is_alive = FALSE;
        g_cond_signal(&self->priv->condition);
    }

    LOG_TRACE(self, "unlocking @ close");
    g_mutex_unlock(&self->priv->mutex);

    if (self->priv->thread) {
        g_thread_join(self->priv->thread);
        self->priv->thread = NULL;
    }

    LOG_DEBUG(self, "closed connection");
}
Example #30
0
void
empathy_chat_window_remove_chat (EmpathyChatWindow *window,
				 EmpathyChat	   *chat)
{
	EmpathyChatWindowPriv *priv;
	gint                   position;
	EmpathyContact        *remote_contact;

	g_return_if_fail (window != NULL);
	g_return_if_fail (EMPATHY_IS_CHAT (chat));

	priv = GET_PRIV (window);

	g_signal_handlers_disconnect_by_func (chat,
					      chat_window_chat_notify_cb,
					      NULL);
	remote_contact = g_object_get_data (G_OBJECT (chat),
					    "chat-window-remote-contact");
	if (remote_contact) {
		g_signal_handlers_disconnect_by_func (remote_contact,
						      chat_window_update_chat_tab,
						      chat);
	}

	position = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
					  GTK_WIDGET (chat));
	gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), position);

	DEBUG ("Chat removed (%d references)", G_OBJECT (chat)->ref_count - 1);

	g_object_unref (chat);
}