Commit 6b304047 authored by Jonathan Matthew's avatar Jonathan Matthew

daap: remove gtk_dialog_run usage

parent f0cf16ee
......@@ -21,8 +21,6 @@ libdaap_la_SOURCES = \
rb-daap-src.h \
rb-dmap-container-db-adapter.c \
rb-dmap-container-db-adapter.h \
rb-daap-dialog.c \
rb-daap-dialog.h \
rb-dacp-pairing-page.c \
rb-dacp-pairing-page.h \
rb-dacp-player.c \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Implementation of DAAP (iTunes Music Sharing) dialogs
* (password & name collision)
*
* Copyright (C) 2005 Charles Schmidt <cschmidt2@emich.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The Rhythmbox authors hereby grant permission for non-GPL compatible
* GStreamer plugins to be used and distributed together with GStreamer
* and Rhythmbox. This permission is above and beyond the permissions granted
* by the GPL license by which Rhythmbox is covered. If you modify this code
* you may extend this exception to your version of the code, but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
#include "rb-daap-dialog.h"
char *
rb_daap_collision_dialog_new_run (GtkWindow *parent,
const char *old_name)
{
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *vbox;
char *s;
GtkWidget *label;
GtkWidget *entry;
gint resp;
dialog = gtk_dialog_new_with_buttons (_("Invalid share name"),
parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
s = g_strdup_printf (_("The shared music name '%s' is already taken. Please choose another."), old_name);
label = gtk_label_new (s);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
g_free (s);
hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("Shared music _name:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
gtk_entry_set_text (GTK_ENTRY (entry), old_name);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_widget_show_all (dialog);
do {
resp = gtk_dialog_run (GTK_DIALOG (dialog));
} while (resp != GTK_RESPONSE_OK);
s = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_widget_destroy (dialog);
return s;
}
/*
* Header for DAAP (iTunes Music Sharing) dialogs (password & name collision)
*
* Copyright (C) 2005 Charles Schmidt <cschmidt2@emich.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The Rhythmbox authors hereby grant permission for non-GPL compatible
* GStreamer plugins to be used and distributed together with GStreamer
* and Rhythmbox. This permission is above and beyond the permissions granted
* by the GPL license by which Rhythmbox is covered. If you modify this code
* you may extend this exception to your version of the code, but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef __RB_DAAP_DIALOG_H
#define __RB_DAAP_DIALOG_H
#include <glib.h>
G_BEGIN_DECLS
char * rb_daap_collision_dialog_new_run (GtkWindow *parent,
const char *old_name);
G_END_DECLS
#endif /* __RB_DAAP_DIALOG_H */
......@@ -664,6 +664,12 @@ new_daap_share_location_added_cb (RBURIDialog *dialog,
}
static void
new_daap_share_response_cb (GtkDialog *dialog, int response, gpointer meh)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
rb_daap_plugin_cmd_connect (GtkAction *action,
RBDaapPlugin *plugin)
......@@ -674,8 +680,8 @@ rb_daap_plugin_cmd_connect (GtkAction *action,
g_signal_connect_object (dialog, "location-added",
G_CALLBACK (new_daap_share_location_added_cb),
plugin, 0);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_widget_show_all (dialog);
g_signal_connect (dialog, "response", G_CALLBACK (new_daap_share_response_cb), NULL);
}
......
......@@ -52,7 +52,6 @@
#include "rb-rhythmdb-dmap-db-adapter.h"
#include "rb-display-page.h"
#include "rb-daap-dialog.h"
#include "rb-daap-plugin.h"
#include "rb-static-playlist-source.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment