/* ui callbacks */
static void
on_gm_audio_profiles_edit_response (GtkWidget *dialog,
                               int        id,
                               void      *data)
{
  if (id == GTK_RESPONSE_HELP)
    {
      GError *err = NULL;

      gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (dialog)),
		    "ghelp:mate-audio-profiles?mate-audio-profiles-profile-edit",
		    gtk_get_current_event_time (),
		    &err);

      if (err)
        {
          gmp_util_show_error_dialog  (GTK_WINDOW (dialog), NULL,
                                       _("There was an error displaying help: %s"), err->message);
          g_error_free (err);
        }
      return;
    }
      
    gtk_widget_destroy (dialog);
}
Ejemplo n.º 2
0
GtkBuilder *
gmp_util_load_builder_file (const char *filename,
			    GtkWindow  *error_dialog_parent,
			    GError **err)
{
  static GtkWidget *no_glade_dialog = NULL;
  gchar *path;
  GtkBuilder *builder;
  GError *error = NULL;

  path = g_strconcat ("./", filename, NULL);

  builder = gtk_builder_new ();

  /* Try current dir, for debugging */
  if (g_file_test (path, G_FILE_TEST_EXISTS) && gtk_builder_add_from_file (builder, path, &error))
    goto end;

  if (error != NULL) {
    g_warning ("%s", error->message);
    g_error_free (error);
    error = NULL;
  }

  g_free (path);
  path = g_build_filename (GMP_UIDIR, filename, NULL);
  if (g_file_test (path, G_FILE_TEST_EXISTS) && gtk_builder_add_from_file (builder, path, &error))
    goto end;

  gmp_util_show_error_dialog (error_dialog_parent, &no_glade_dialog,
			      _("The file \"%s\" is missing. This indicates that the application is installed incorrectly, so the dialog can't be displayed."), path);
  g_free (path);
  if (error != NULL) {
    g_propagate_error (err, error);
  }

  return builder;

 end:
  g_free (path);

  return builder;
}