コード例 #1
0
void
empathy_connection_managers_prepare_async (
    EmpathyConnectionManagers *self,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  EmpathyConnectionManagersPriv *priv = GET_PRIV (self);
  GSimpleAsyncResult *result;

  result = g_simple_async_result_new (G_OBJECT (managers),
      callback, user_data, empathy_connection_managers_prepare_finish);

  if (priv->ready)
    {
      g_simple_async_result_complete_in_idle (result);
      g_object_unref (result);
      return;
    }

  g_signal_connect (self, "notify::ready", G_CALLBACK (notify_ready_cb),
      result);
}
コード例 #2
0
static void
empathy_connection_managers_dispose (GObject *object)
{
  EmpathyConnectionManagers *self = EMPATHY_CONNECTION_MANAGERS (object);
  EmpathyConnectionManagersPriv *priv = GET_PRIV (self);

  if (priv->dispose_has_run)
    return;

  priv->dispose_has_run = TRUE;

  if (priv->dbus != NULL)
    g_object_unref (priv->dbus);
  priv->dbus = NULL;

  empathy_connection_managers_free_cm_list (self);

  /* release any references held by the object here */

  if (G_OBJECT_CLASS (empathy_connection_managers_parent_class)->dispose)
    G_OBJECT_CLASS (empathy_connection_managers_parent_class)->dispose (object);
}
コード例 #3
0
static void
clicked_cb (GtkButton *button,
    gpointer user_data)
{
  EmpathyIrcNetworkChooserPriv *priv = GET_PRIV (button);
  GtkWindow *window;

  if (priv->dialog != NULL)
    goto out;

  window = empathy_get_toplevel_window (GTK_WIDGET (button));

  priv->dialog = empathy_irc_network_chooser_dialog_new (priv->settings,
      priv->network, window);
  gtk_widget_show_all (priv->dialog);

  tp_g_signal_connect_object (priv->dialog, "response",
      G_CALLBACK (dialog_response_cb), button, 0);

out:
  empathy_window_present (GTK_WINDOW (priv->dialog));
}
コード例 #4
0
static void
gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
					GtkWidget       *widget,
					GdkRectangle    *cell_area,
					gint            *x_offset,
					gint            *y_offset,
					gint            *width,
					gint            *height)
{
	GossipCellRendererExpander     *expander;
	GossipCellRendererExpanderPriv *priv;

	expander = (GossipCellRendererExpander*) cell;
	priv = GET_PRIV (expander);

	if (cell_area) {
		if (x_offset) {
			*x_offset = cell->xalign * (cell_area->width - (priv->expander_size + (2 * cell->xpad)));
			*x_offset = MAX (*x_offset, 0);
		}

		if (y_offset) {
			*y_offset = cell->yalign * (cell_area->height - (priv->expander_size + (2 * cell->ypad)));
			*y_offset = MAX (*y_offset, 0);
		}
	} else {
		if (x_offset)
			*x_offset = 0;

		if (y_offset)
			*y_offset = 0;
	}

	if (width)
		*width = cell->xpad * 2 + priv->expander_size;

	if (height)
		*height = cell->ypad * 2 + priv->expander_size;
}
コード例 #5
0
static void
empathy_call_handler_request_cb (EmpathyDispatchOperation *operation,
  const GError *error, gpointer user_data)
{
  EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (user_data);
  EmpathyCallHandlerPriv *priv = GET_PRIV (self);

  if (error != NULL)
    return;

  priv->call = EMPATHY_TP_CALL (
    empathy_dispatch_operation_get_channel_wrapper (operation));

  g_object_ref (priv->call);

  empathy_call_handler_start_tpfs (self);

  empathy_tp_call_to (priv->call, priv->contact,
    priv->initial_audio, priv->initial_video);

  empathy_dispatch_operation_claim (operation);
}
static void
tp_contact_list_remove_from_group (EmpathyContactList *list,
				   EmpathyContact     *contact,
				   const gchar        *group_name)
{
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	TpChannel                *channel;
	TpHandle                  handle;
	GArray                    handles = {(gchar *) &handle, 1};

	channel = g_hash_table_lookup (priv->groups, group_name);
	if (channel == NULL) {
		return;
	}

	handle = empathy_contact_get_handle (contact);
	DEBUG ("remove contact %s (%d) from group %s",
		empathy_contact_get_id (contact), handle, group_name);

	tp_cli_channel_interface_group_call_remove_members (channel, -1,
		&handles, NULL, NULL, NULL, NULL, NULL);
}
コード例 #7
0
static gboolean
ft_manager_delete_event_cb (GtkWidget *widget,
                            GdkEvent *event,
                            EmpathyFTManager *manager)
{
  EmpathyFTManagerPriv *priv = GET_PRIV (manager);

  DEBUG ("%p", manager);

  /* remove all the completed/cancelled/errored transfers */
  ft_manager_clear (manager);

  if (g_hash_table_size (priv->ft_handler_to_row_ref) > 0)
    {
      /* There is still FTs on flight, just hide the window */
      DEBUG ("Hiding window");
      gtk_widget_hide (widget);
      return TRUE;
    }

  return FALSE;
}
コード例 #8
0
static void
_empathy_account_connection_invalidated_cb (TpProxy *self,
  guint    domain,
  gint     code,
  gchar   *message,
  gpointer user_data)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (user_data);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  if (priv->connection == NULL)
    return;

  DEBUG ("(%s) Connection invalidated",
    empathy_account_get_unique_name (account));

  g_assert (priv->connection == TP_CONNECTION (self));

  empathy_account_free_connection (account);

  g_object_notify (G_OBJECT (account), "connection");
}
コード例 #9
0
static void
presence_chooser_finalize (GObject *object)
{
	EmpathyPresenceChooserPriv *priv;

	priv = GET_PRIV (object);

	if (priv->flash_timeout_id) {
		g_source_remove (priv->flash_timeout_id);
	}

	if (priv->focus_out_idle_source) {
		g_source_remove (priv->focus_out_idle_source);
	}

	g_signal_handlers_disconnect_by_func (priv->idle,
					      presence_chooser_presence_changed_cb,
					      object);
	g_object_unref (priv->idle);

	G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
}
コード例 #10
0
/**
 * empathy_avatar_image_set:
 * @avatar_image: an #EmpathyAvatarImage
 * @avatar: the #EmpathyAvatar to set @avatar_image to
 *
 * Sets @avatar_image to display the avatar indicated by @avatar.
 */
void
empathy_avatar_image_set (EmpathyAvatarImage *avatar_image,
			  EmpathyAvatar      *avatar)
{
	EmpathyAvatarImagePriv *priv = GET_PRIV (avatar_image);
	GdkPixbuf              *scaled_pixbuf;

	g_return_if_fail (EMPATHY_IS_AVATAR_IMAGE (avatar_image));

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

	if (avatar) {
		priv->pixbuf = empathy_pixbuf_from_data ((gchar *) avatar->data,
				avatar->len);
	}

	if (!priv->pixbuf) {
		gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
					      "stock_person",
					      GTK_ICON_SIZE_DIALOG);
		return;
	}

	scaled_pixbuf = empathy_pixbuf_scale_down_if_necessary (priv->pixbuf, MAX_SMALL);
	gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled_pixbuf);

	if (scaled_pixbuf != priv->pixbuf) {
		gtk_widget_set_tooltip_text (GTK_WIDGET (avatar_image),
					     _("Click to enlarge"));
	} else {
		gtk_widget_set_tooltip_text (GTK_WIDGET (avatar_image),
					     NULL);
	}

	g_object_unref (scaled_pixbuf);
}
static void
tp_contact_list_group_add_channel (EmpathyTpContactList *list,
				   const gchar          *object_path,
				   GHashTable           *properties)
{
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	TpChannel                *channel;
	GError *error = NULL;

	channel = tp_channel_new_from_properties (priv->connection,
				  object_path, properties, &error);
	if (channel == NULL) {
		DEBUG ("Failed to create group channel: %s", error->message);
		g_error_free (error);
		return;
	}

	/* Give the ref to the callback */
	tp_channel_call_when_ready (channel,
				    tp_contact_list_group_ready_cb,
				    list);
}
static void
remove_from_member_if_needed (EmpathyTpContactList *list,
			      TpHandle handle)
{
	/* remove contact from members if it's not in publish and subscribe */
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	const TpIntSet *members;

	members = tp_channel_group_get_members (priv->subscribe);
	if (tp_intset_is_member (members, handle))
		return;

	members = tp_channel_group_get_remote_pending (priv->subscribe);
	if (tp_intset_is_member (members, handle))
		return;

	members = tp_channel_group_get_members (priv->publish);
	if (tp_intset_is_member (members, handle))
		return;

	tp_contact_list_remove_handle (list, priv->members, handle);
}
コード例 #13
0
ファイル: moz-web-view.cpp プロジェクト: gistinc/Gecko
/* We handle configure events on the toplevel in order to
 * reposition our window when the toplevel moves.
 */
static gboolean
handle_toplevel_configure(GtkWidget         *toplevel,
                          GdkEventConfigure *event,
                          GtkWidget         *widget)
{
    MozWebViewPriv *priv;
    gint x, y;

    priv = GET_PRIV(widget);

    DBG(g_print("Configure event !\n"));

    gdk_window_get_position(widget->window, &x, &y);
    x += widget->allocation.x;
    y += widget->allocation.y;

    SetWindowPos(priv->native_window, NULL, x, y,
                 widget->allocation.width, widget->allocation.height,
                 SWP_NOACTIVATE | SWP_NOZORDER);

    return FALSE;
}
コード例 #14
0
static void
preferences_theme_variants_setup (EmpathyPreferences *preferences)
{
	EmpathyPreferencesPriv *priv = GET_PRIV (preferences);
	GtkComboBox   *combo;
	GtkCellLayout *cell_layout;
	GtkCellRenderer *renderer;
	GtkListStore  *store;

	combo = GTK_COMBO_BOX (priv->combobox_chat_theme_variant);
	cell_layout = GTK_CELL_LAYOUT (combo);

	/* Create the model */
	store = gtk_list_store_new (COL_VARIANT_COUNT,
				    G_TYPE_STRING,      /* name */
				    G_TYPE_BOOLEAN);    /* is default */
	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
		COL_VARIANT_NAME, GTK_SORT_ASCENDING);

	/* Add cell renderer */
	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
	gtk_cell_layout_set_attributes (cell_layout, renderer,
		"text", COL_VARIANT_NAME, NULL);

	gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
	g_object_unref (store);

	g_signal_connect (combo, "changed",
			  G_CALLBACK (preferences_theme_variant_changed_cb),
			  preferences);

	/* Track changes of the GSetting key */
	g_signal_connect (priv->gsettings_chat,
			  "changed::" EMPATHY_PREFS_CHAT_THEME_VARIANT,
			  G_CALLBACK (preferences_theme_variant_notify_cb),
			  preferences);
}
コード例 #15
0
static void
contact_list_view_set_list_features (EmpathyContactListView         *view,
				     EmpathyContactListFeatureFlags  features)
{
	EmpathyContactListViewPriv *priv = GET_PRIV (view);
	gboolean                    has_tooltip;

	g_return_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view));

	priv->list_features = features;

	/* Update DnD source/dest */
	if (features & EMPATHY_CONTACT_LIST_FEATURE_CONTACT_DRAG) {
		gtk_drag_source_set (GTK_WIDGET (view),
				     GDK_BUTTON1_MASK,
				     drag_types_source,
				     G_N_ELEMENTS (drag_types_source),
				     GDK_ACTION_MOVE | GDK_ACTION_COPY);
	} else {
		gtk_drag_source_unset (GTK_WIDGET (view));

	}

	if (features & EMPATHY_CONTACT_LIST_FEATURE_CONTACT_DROP) {
		gtk_drag_dest_set (GTK_WIDGET (view),
				   GTK_DEST_DEFAULT_ALL,
				   drag_types_dest,
				   G_N_ELEMENTS (drag_types_dest),
				   GDK_ACTION_MOVE | GDK_ACTION_COPY);
	} else {
		/* FIXME: URI could still be  droped depending on FT feature */
		gtk_drag_dest_unset (GTK_WIDGET (view));
	}

	/* Update has-tooltip */
	has_tooltip = (features & EMPATHY_CONTACT_LIST_FEATURE_CONTACT_TOOLTIP) != 0;
	gtk_widget_set_has_tooltip (GTK_WIDGET (view), has_tooltip);
}
コード例 #16
0
ファイル: megaphone-applet.c プロジェクト: james-w/empathy
static void
megaphone_applet_update_contact (MegaphoneApplet *applet)
{
	MegaphoneAppletPriv *priv = GET_PRIV (applet);
	const gchar         *name;
	const gchar         *status;
	gchar               *tip;
	const gchar         *avatar_token = NULL;

	if (priv->contact) {
		EmpathyAvatar *avatar;

		avatar = empathy_contact_get_avatar (priv->contact);
		if (avatar) {
			avatar_token = avatar->token;
		}
	}

	if (avatar_token) {
		panel_applet_gconf_set_string (PANEL_APPLET (applet),
					       "avatar_token", avatar_token,
					       NULL);
	}

	megaphone_applet_update_icon (applet);

	if (priv->contact ) {
		name = empathy_contact_get_name (priv->contact);
		status = empathy_contact_get_status (priv->contact);
		tip = g_strdup_printf ("<b>%s</b>: %s", name, status);
		gtk_widget_set_tooltip_markup (GTK_WIDGET (applet), tip);
		g_free (tip);
	} else {
		gtk_widget_set_tooltip_markup (GTK_WIDGET (applet),
					       _("Please configure a contact."));
	}

}
コード例 #17
0
ファイル: vcl.c プロジェクト: varnish/vagent2
static unsigned int
vcl_json(struct http_request *request, const char *arg, void *data)
{
	struct agent_core_t *core = data;
	struct vcl_priv_t *vcl;
	struct ipc_ret_t vret;
	struct vsb *json;
	struct http_response *resp;

	GET_PRIV(core, vcl);

	assert(STARTS_WITH(request->url, "/vcljson"));
	assert(request->method == M_GET);

	if (arg) {
		http_reply(request->connection, 404,
		    "/vcljson takes no argument");
		return (0);
	}

	ipc_run(vcl->vadmin, &vret, "vcl.list");
	if (vret.status == 400)
		http_reply(request->connection, 500, vret.answer);
	else {
		json = vcl_list_json(vret.answer);
		assert(VSB_finish(json) == 0);
		resp = http_mkresp(request->connection, 200, NULL);
		resp->data = VSB_data(json);
		resp->ndata = VSB_len(json);
		http_add_header(resp, "Content-Type", "application/json");
		send_response(resp);
		http_free_resp(resp);
		VSB_clear(json);
		VSB_delete(json);
	}
	free(vret.answer);
	return (0);
}
コード例 #18
0
static gboolean
protocol_chooser_filter_visible_func (GtkTreeModel *model,
    GtkTreeIter *iter,
    gpointer user_data)
{
  EmpathyProtocolChooser *protocol_chooser = user_data;
  EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
  TpConnectionManager *cm = NULL;
  gchar *protocol_name = NULL;
  gboolean visible = FALSE;
  gchar *service;

  gtk_tree_model_get (model, iter,
      COL_CM, &cm,
      COL_PROTOCOL_NAME, &protocol_name,
      COL_SERVICE, &service,
      -1);

  if (cm != NULL && protocol_name != NULL)
    {
      TpConnectionManagerProtocol *protocol;

      protocol = (TpConnectionManagerProtocol *)
        tp_connection_manager_get_protocol (cm, protocol_name);

      if (protocol != NULL)
        {
          visible = priv->filter_func (cm, protocol, service,
              priv->filter_user_data);
        }
    }

  if (cm != NULL)
    g_object_unref (cm);

  g_free (service);
  return visible;
}
コード例 #19
0
static void
empathy_call_handler_dispose (GObject *object)
{
  EmpathyCallHandlerPriv *priv = GET_PRIV (object);

  if (priv->dispose_has_run)
    return;

  priv->dispose_has_run = TRUE;

  if (priv->contact != NULL)
    g_object_unref (priv->contact);

  priv->contact = NULL;

  if (priv->tfchannel != NULL)
    g_object_unref (priv->tfchannel);

  priv->tfchannel = NULL;

  if (priv->call != NULL)
    {
      empathy_tp_call_close (priv->call);
      g_object_unref (priv->call);
    }

  priv->call = NULL;

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

  /* release any references held by the object here */
  if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose)
    G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object);
}
コード例 #20
0
static void
ft_handler_read_async_cb (GObject *source,
    GAsyncResult *res,
    gpointer user_data)
{
  GFileInputStream *stream;
  GError *error = NULL;
  HashingData *hash_data;
  EmpathyFTHandler *handler = user_data;
  EmpathyFTHandlerPriv *priv = GET_PRIV (handler);

  DEBUG ("GFile read async CB.");

  stream = g_file_read_finish (priv->gfile, res, &error);
  if (error != NULL)
    {
      emit_error_signal (handler, error);
      g_clear_error (&error);

      return;
    }

  hash_data = g_slice_new0 (HashingData);
  hash_data->stream = G_INPUT_STREAM (stream);
  hash_data->total_bytes = priv->total_bytes;
  hash_data->handler = g_object_ref (handler);
  /* FIXME: MD5 is the only ContentHashType supported right now */
  hash_data->checksum = g_checksum_new (G_CHECKSUM_MD5);

  tp_asv_set_uint32 (priv->request,
      TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH_TYPE,
      TP_FILE_HASH_TYPE_MD5);

  g_signal_emit (handler, signals[HASHING_STARTED], 0);

  g_io_scheduler_push_job (do_hash_job, hash_data, NULL,
      G_PRIORITY_DEFAULT, priv->cancellable);
}
コード例 #21
0
ファイル: empathy-tp-chat.c プロジェクト: james-w/empathy
static void
tp_chat_got_added_contacts_cb (EmpathyTpContactFactory *factory,
			       guint                    n_contacts,
			       EmpathyContact * const * contacts,
			       guint                    n_failed,
			       const TpHandle          *failed,
			       const GError            *error,
			       gpointer                 user_data,
			       GObject                 *chat)
{
	EmpathyTpChatPriv *priv = GET_PRIV (chat);
	guint i;
	const TpIntSet *members;
	TpHandle handle;
	EmpathyContact *contact;

	if (error) {
		DEBUG ("Error: %s", error->message);
		return;
	}

	members = tp_channel_group_get_members (priv->channel);
	for (i = 0; i < n_contacts; i++) {
		contact = contacts[i];
		handle = empathy_contact_get_handle (contact);

		/* Make sure the contact is still member */
		if (tp_intset_is_member (members, handle)) {
			priv->members = g_list_prepend (priv->members,
				g_object_ref (contact));
			g_signal_emit_by_name (chat, "members-changed",
					       contact, NULL, 0, NULL, TRUE);
		}
	}

	tp_chat_update_remote_contact (EMPATHY_TP_CHAT (chat));
	tp_chat_check_if_ready (EMPATHY_TP_CHAT (chat));
}
コード例 #22
0
static void
populate_data (EmpathyGroupsWidget *self)
{
  EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
  EmpathyConnectionAggregator *aggregator;
  GeeSet *member_groups;
  GList *all_groups, *l;

  /* Remove the old groups */
  gtk_list_store_clear (priv->group_store);

  /* FIXME: We have to get the whole group list from
   * EmpathyConnectionAggregator, as libfolks hasn't grown API to get the whole
   * group list yet. (bgo#627398) */
  aggregator = empathy_connection_aggregator_dup_singleton ();
  all_groups = empathy_connection_aggregator_get_all_groups (aggregator);
  g_object_unref (aggregator);

  /* Get the list of groups that this #FolksGroupDetails is currently in */
  member_groups = folks_group_details_get_groups (priv->group_details);

  for (l = all_groups; l != NULL; l = l->next)
    {
      const gchar *group_str = l->data;
      gboolean enabled;

      enabled = gee_collection_contains (GEE_COLLECTION (member_groups),
          group_str);

      gtk_list_store_insert_with_values (priv->group_store, NULL, -1,
          COL_NAME, group_str,
          COL_EDITABLE, TRUE,
          COL_ENABLED, enabled,
          -1);
    }

  g_list_free (all_groups);
}
static void
tp_contact_list_publish_group_members_changed_cb (TpChannel     *channel,
						  gchar         *message,
						  GArray        *added,
						  GArray        *removed,
						  GArray        *local_pending,
						  GArray        *remote_pending,
						  TpHandle       actor,
						  TpChannelGroupChangeReason reason,
						  EmpathyTpContactList *list)
{
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	guint i;

	/* We now send our presence to those contacts, remove them from pendings */
	add_to_members (list, added);
	for (i = 0; i < added->len; i++) {
		tp_contact_list_remove_handle (list, priv->pendings,
			g_array_index (added, TpHandle, i));
	}

	/* We refuse to send our presence to those contacts, remove from pendings */
	for (i = 0; i < removed->len; i++) {
		TpHandle handle = g_array_index (removed, TpHandle, i);

		tp_contact_list_remove_handle (list, priv->pendings, handle);
		remove_from_member_if_needed (list, handle);
	}

	/* Those contacts want our presence, auto accept those that are already
	 * member, otherwise add in pendings. */
	if (local_pending->len > 0) {
		empathy_tp_contact_factory_get_from_handles (priv->connection,
			local_pending->len, (TpHandle *) local_pending->data,
			tp_contact_list_got_local_pending_cb, NULL, NULL,
			G_OBJECT (list));
	}
}
コード例 #24
0
static void
unlink_individual (EmpathyIndividualLinker *self,
    FolksIndividual *individual)
{
  EmpathyIndividualLinkerPriv *priv = GET_PRIV (self);
  GeeSet *removed_personas, *old_personas;
  GeeHashSet *final_personas;
  gboolean personas_changed;

  /* Remove the individual from the link */
  g_hash_table_remove (priv->changed_individuals, individual);

  /* Remove personas which are in @individual from priv->new_individual. */
  old_personas = folks_individual_get_personas (priv->new_individual);
  removed_personas = folks_individual_get_personas (individual);

  final_personas = gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref,
      g_object_unref, g_direct_hash, g_direct_equal);
  gee_collection_add_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (old_personas));
  personas_changed = gee_collection_remove_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (removed_personas));

  if (personas_changed)
    {
      folks_individual_set_personas (priv->new_individual,
          GEE_SET (final_personas));
    }

  g_clear_object (&final_personas);

  /* Update the toggle renderers, so that if this Individual is listed in
   * another group in the EmpathyIndividualView, the toggle button for that
   * group is updated. */
  update_toggle_renderers (self);

  g_object_notify (G_OBJECT (self), "has-changed");
}
コード例 #25
0
static void
empathy_irc_server_set_property (GObject *object,
                                 guint property_id,
                                 const GValue *value,
                                 GParamSpec *pspec)
{
  EmpathyIrcServer *self = EMPATHY_IRC_SERVER (object);
  EmpathyIrcServerPriv *priv = GET_PRIV (self);

  switch (property_id)
    {
      case PROP_ADDRESS:
        if (tp_strdiff (priv->address, g_value_get_string (value)))
          {
            g_free (priv->address);
            priv->address = g_value_dup_string (value);
            g_signal_emit (object, signals[MODIFIED], 0);
          }
        break;
      case PROP_PORT:
        if (priv->port != g_value_get_uint (value))
          {
            priv->port = g_value_get_uint (value);
            g_signal_emit (object, signals[MODIFIED], 0);
          }
        break;
      case PROP_SSL:
        if (priv->ssl != g_value_get_boolean (value))
          {
            priv->ssl = g_value_get_boolean (value);
            g_signal_emit (object, signals[MODIFIED], 0);
          }
        break;
      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
        break;
    }
}
static void
tp_contact_list_group_members_changed_cb (TpChannel     *channel,
					  gchar         *message,
					  GArray        *added,
					  GArray        *removed,
					  GArray        *local_pending,
					  GArray        *remote_pending,
					  guint          actor,
					  guint          reason,
					  EmpathyTpContactList *list)
{
	EmpathyTpContactListPriv  *priv = GET_PRIV (list);
	const gchar *group_name;
	guint i;

	contacts_added_to_group (list, channel, added);

	group_name = tp_channel_get_identifier (channel);

	for (i = 0; i < removed->len; i++) {
		EmpathyContact *contact;
		TpHandle handle;

		handle = g_array_index (removed, TpHandle, i);
		contact = g_hash_table_lookup (priv->members,
					       GUINT_TO_POINTER (handle));
		if (contact == NULL) {
			continue;
		}

		DEBUG ("Contact %s (%d) removed from group %s",
			empathy_contact_get_id (contact), handle, group_name);

		g_signal_emit_by_name (list, "groups-changed", contact,
				       group_name,
				       FALSE);
	}
}
コード例 #27
0
static void
chat_window_edit_activate_cb (GtkWidget        *menuitem,
			      EmpathyChatWindow *window)
{
	EmpathyChatWindowPriv *priv;
	GtkClipboard         *clipboard;
	GtkTextBuffer        *buffer;
	gboolean              text_available;

	priv = GET_PRIV (window);

	g_return_if_fail (priv->current_chat != NULL);

	if (!empathy_chat_get_tp_chat (priv->current_chat)) {
		gtk_widget_set_sensitive (priv->menu_edit_copy, FALSE);
		gtk_widget_set_sensitive (priv->menu_edit_cut, FALSE);
		gtk_widget_set_sensitive (priv->menu_edit_paste, FALSE);
		return;
	}

	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->current_chat->input_text_view));
	if (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL)) {
		gtk_widget_set_sensitive (priv->menu_edit_copy, TRUE);
		gtk_widget_set_sensitive (priv->menu_edit_cut, TRUE);
	} else {
		gboolean selection;

		selection = empathy_chat_view_get_selection_bounds (priv->current_chat->view, 
								   NULL, NULL);

		gtk_widget_set_sensitive (priv->menu_edit_cut, FALSE);
		gtk_widget_set_sensitive (priv->menu_edit_copy, selection);
	}

	clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
	text_available = gtk_clipboard_wait_is_text_available (clipboard);
	gtk_widget_set_sensitive (priv->menu_edit_paste, text_available);
}
コード例 #28
0
static void
contact_list_store_dispose (GObject *object)
{
	EmpathyContactListStorePriv *priv = GET_PRIV (object);
	GList                       *contacts, *l;

	if (priv->dispose_has_run)
		return;
	priv->dispose_has_run = TRUE;

	contacts = empathy_contact_list_get_members (priv->list);
	for (l = contacts; l; l = l->next) {
		g_signal_handlers_disconnect_by_func (l->data,
						      G_CALLBACK (contact_list_store_contact_updated_cb),
						      object);

		g_object_unref (l->data);
	}
	g_list_free (contacts);

	g_signal_handlers_disconnect_by_func (priv->list,
					      G_CALLBACK (contact_list_store_members_changed_cb),
					      object);
	g_signal_handlers_disconnect_by_func (priv->list,
					      G_CALLBACK (contact_list_store_groups_changed_cb),
					      object);
	g_object_unref (priv->list);

	if (priv->inhibit_active) {
		g_source_remove (priv->inhibit_active);
	}

	if (priv->setup_idle_id != 0) {
		g_source_remove (priv->setup_idle_id);
	}

	G_OBJECT_CLASS (empathy_contact_list_store_parent_class)->dispose (object);
}
コード例 #29
0
ファイル: moz-web-view.cpp プロジェクト: gistinc/Gecko
/*******************************************************************
 *                            GtkWidgetClass                       *
 *******************************************************************/
static void
moz_web_view_realize(GtkWidget *widget)
{
    MozWebViewPriv *priv = GET_PRIV(widget);
    GdkWindowAttr attributes;
    gint attributes_mask;

    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);

    attributes.window_type = GDK_WINDOW_CHILD;
    attributes.x = widget->allocation.x;
    attributes.y = widget->allocation.y;
    attributes.width = widget->allocation.width;
    attributes.height = widget->allocation.height;
    attributes.wclass = GDK_INPUT_OUTPUT;
    attributes.visual = gtk_widget_get_visual(widget);
    attributes.colormap = gtk_widget_get_colormap(widget);
    attributes.event_mask = gtk_widget_get_events(widget) |  //| GDK_ALL_EVENTS_MASK;
	GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
	GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
	GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK;

    attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;

    widget->window = gtk_widget_get_parent_window(widget);
    g_object_ref(widget->window);

    priv->native_window = create_native_window(widget);

    priv->view->CreateBrowser(priv->native_window, 0, 0,
			      widget->allocation.width, widget->allocation.height);

    widget->style = gtk_style_attach(widget->style, widget->window);
    gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);

    if (priv->requested_uri)
        moz_web_view_load_uri(MOZ_WEB_VIEW(widget), priv->requested_uri);
}
コード例 #30
0
static void
do_set_property (GObject *object,
    guint property_id,
    const GValue *value,
    GParamSpec *pspec)
{
  EmpathyImportDialogPriv *priv = GET_PRIV (object);

  switch (property_id)
    {
    case PROP_PARENT:
      priv->parent_window = g_value_get_object (value);
      break;
    case PROP_SHOW_WARNING:
      priv->show_warning = g_value_get_boolean (value);
      break;
    case PROP_CMS:
      priv->cms = g_value_dup_object (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}