コード例 #1
0
static gboolean
main_window_flash_foreach (GtkTreeModel *model,
			   GtkTreePath  *path,
			   GtkTreeIter  *iter,
			   gpointer      user_data)
{
	FlashForeachData *data = (FlashForeachData *) user_data;
	EmpathyContact   *contact;
	const gchar      *icon_name;
	GtkTreePath      *parent_path = NULL;
	GtkTreeIter       parent_iter;
	GdkPixbuf        *pixbuf = NULL;

	/* To be used with gtk_tree_model_foreach, update the status icon
	 * of the contact to show the event icon (on=TRUE) or the presence
	 * (on=FALSE) */
	gtk_tree_model_get (model, iter,
			    EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
			    -1);

	if (contact != data->event->contact) {
		if (contact) {
			g_object_unref (contact);
		}
		return FALSE;
	}

	if (data->on) {
		icon_name = data->event->icon_name;
		pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
	} else {
		pixbuf = contact_list_store_get_contact_status_icon (
						data->window->list_store,
						contact);
	}

	gtk_tree_store_set (GTK_TREE_STORE (model), iter,
			    EMPATHY_CONTACT_LIST_STORE_COL_ICON_STATUS, pixbuf,
			    -1);

	/* To make sure the parent is shown correctly, we emit
	 * the row-changed signal on the parent so it prompts
	 * it to be refreshed by the filter func.
	 */
	if (gtk_tree_model_iter_parent (model, &parent_iter, iter)) {
		parent_path = gtk_tree_model_get_path (model, &parent_iter);
	}
	if (parent_path) {
		gtk_tree_model_row_changed (model, parent_path, &parent_iter);
		gtk_tree_path_free (parent_path);
	}

	g_object_unref (contact);

	return FALSE;
}
コード例 #2
0
static void
account_chooser_filter_ready_cb (gboolean is_enabled,
				 gpointer data)
{
	FilterResultCallbackData  *fr_data = data;
	EmpathyAccountChooser     *chooser;
	EmpathyAccountChooserPriv *priv;
	TpAccount                 *account;
	GtkTreeIter               *iter;
	GtkListStore              *store;
	GtkComboBox               *combobox;
	const gchar               *icon_name;
	GdkPixbuf                 *pixbuf;

	chooser = fr_data->chooser;
	priv = GET_PRIV (chooser);
	account = fr_data->account;
	iter = fr_data->iter;
	combobox = GTK_COMBO_BOX (chooser);
	store = GTK_LIST_STORE (gtk_combo_box_get_model (combobox));

	icon_name = tp_account_get_icon_name (account);
	pixbuf = empathy_pixbuf_from_icon_name (icon_name,
		GTK_ICON_SIZE_BUTTON);

	gtk_list_store_set (store, iter,
			    COL_ACCOUNT_IMAGE, pixbuf,
			    COL_ACCOUNT_TEXT, tp_account_get_display_name (account),
			    COL_ACCOUNT_ENABLED, is_enabled,
			    -1);

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

	/* set first connected account as active account */
	if (priv->account_manually_set == FALSE &&
	    priv->set_active_item == FALSE && is_enabled) {
		priv->set_active_item = TRUE;
		gtk_combo_box_set_active_iter (combobox, iter);
	}

	filter_result_callback_data_free (fr_data);
}
void
empathy_smiley_manager_add (EmpathySmileyManager *manager,
			    const gchar          *icon_name,
			    const gchar          *first_str,
			    ...)
{
	GdkPixbuf *smiley;
	va_list    var_args;

	g_return_if_fail (EMPATHY_IS_SMILEY_MANAGER (manager));
	g_return_if_fail (!G_STR_EMPTY (icon_name));
	g_return_if_fail (!G_STR_EMPTY (first_str));

	smiley = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
	if (smiley) {
		va_start (var_args, first_str);
		smiley_manager_add_valist (manager, smiley, first_str, var_args);
		va_end (var_args);
		g_object_unref (smiley);
	}
}