static void custom_entry_changed_cb (GtkEditable *entry, gpointer user_data) { NemoMimeApplicationChooser *chooser = user_data; const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (entry)); if (g_strcmp0 (entry_text, "") != 0) { GAppInfo *default_app; gchar *cl = g_strdup_printf ("%s", entry_text); GAppInfo *info = g_app_info_create_from_commandline (cl, NULL, G_APP_INFO_CREATE_NONE, NULL); default_app = g_app_info_get_default_for_type (chooser->details->content_type, FALSE); gtk_widget_set_sensitive (chooser->details->set_as_default_button, !g_app_info_equal (info, default_app)); gtk_widget_set_sensitive (chooser->details->add_button, app_info_can_add (info, chooser->details->content_type)); g_object_unref (default_app); if (chooser->details->custom_info != NULL) { g_object_unref (chooser->details->custom_info); chooser->details->custom_info = NULL; } chooser->details->custom_info = info; } else { if (chooser->details->custom_info != NULL) { g_object_unref (chooser->details->custom_info); chooser->details->custom_info = NULL; } gtk_widget_set_sensitive (chooser->details->set_as_default_button, FALSE); gtk_widget_set_sensitive (chooser->details->add_button, FALSE); } }
static void application_selected_cb (GtkAppChooserWidget *widget, GAppInfo *info, gpointer user_data) { NemoMimeApplicationChooser *chooser = user_data; GAppInfo *default_app; default_app = g_app_info_get_default_for_type (chooser->details->content_type, FALSE); gtk_widget_set_sensitive (chooser->details->set_as_default_button, !g_app_info_equal (info, default_app)); gtk_widget_set_sensitive (chooser->details->add_button, app_info_can_add (info, chooser->details->content_type)); g_object_unref (default_app); }
static void application_selected_cb (GtkAppChooserWidget *widget, GAppInfo *info, gpointer user_data) { NemoMimeApplicationChooser *chooser = user_data; GAppInfo *default_app; default_app = g_app_info_get_default_for_type (chooser->details->content_type, FALSE); gtk_widget_set_sensitive (chooser->details->set_as_default_button, !g_app_info_equal (info, default_app)); gtk_widget_set_sensitive (chooser->details->add_button, app_info_can_add (info, chooser->details->content_type)); gtk_entry_set_text (GTK_ENTRY (chooser->details->custom_entry), ""); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser->details->file_button), ""); g_object_unref (default_app); }