Example #1
0
static void
presence_chooser_dialog_save_toggled_cb (GtkWidget           *widget,
					 CustomMessageDialog *dialog)
{
	gboolean     active;
	McPresence   state;
	const gchar *text;

	active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbutton_save));
	state = presence_chooser_dialog_get_selected (dialog);
	text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));

	if (active) {
		empathy_status_presets_set_last (state, text);
	} else {
		empathy_status_presets_remove (state, text);
	}
}
static void
presence_chooser_entry_icon_release_cb (EmpathyPresenceChooser *self,
                                        GtkEntryIconPosition    icon_pos,
                                        GdkEvent               *event,
					GtkEntry               *entry)
{
	EmpathyPresenceChooserPriv *priv = GET_PRIV (self);

	if (priv->editing_status) {
		presence_chooser_set_status_editing (self, FALSE);
		mc_set_custom_state (self);
	}
	else {
		PresenceChooserEntryType type;
		TpConnectionPresenceType state;
		const char *status;

		type = presence_chooser_get_entry_type (self);
		state = empathy_idle_get_state (priv->idle);
		status = empathy_idle_get_status (priv->idle);

		if (presence_chooser_is_preset (self)) {
			/* remove the entry */
			DEBUG ("REMOVING PRESET (%i, %s)\n", state, status);
			empathy_status_presets_remove (state, status);
		}
		else {
			/* save the entry */
			DEBUG ("SAVING PRESET (%i, %s)\n", state, status);
			empathy_status_presets_set_last (state, status);
		}

		/* update the icon */
		presence_chooser_set_favorite_icon (self);
	}
}