1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4
* Copyright (C) 2008 Jader Henrique da Silva
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License as
8
* published by the Free Software Foundation; either version 2 of the
9
* License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more av.
16
* You should have received a copy of the GNU General Public
17
* License along with this program; if not, write to the
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301 USA.
21
* Author: Jader Henrique da Silva <vovozito@gmail.com>
26
#include <glib/gi18n-lib.h>
27
#include "nst-common.h"
28
#include "nautilus-sendto-plugin.h"
36
#define COMBOBOX_OPTION_NEW_DVD 0
37
#define COMBOBOX_OPTION_EXISTING_DVD 1
39
static GFile *burn = NULL;
42
gboolean init (NstPlugin *plugin)
47
g_print ("Init nautilus burn plugin\n");
49
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
50
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
52
it = gtk_icon_theme_get_default ();
53
gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
55
cmd = g_find_program_in_path ("brasero");
60
burn = g_file_new_for_uri ("burn:/");
66
GtkWidget* get_contacts_widget (NstPlugin *plugin)
69
GtkCellRenderer *renderer;
72
GFileEnumerator *fenum;
73
GFileInfo *file_info = NULL;
74
int selection = COMBOBOX_OPTION_NEW_DVD;
76
fenum = g_file_enumerate_children (burn,
77
G_FILE_ATTRIBUTE_STANDARD_NAME,
78
G_FILE_QUERY_INFO_NONE,
83
file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
84
g_object_unref (fenum);
87
store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
89
gtk_list_store_insert_with_values (store, NULL,
91
COL_PIXBUF, "media-optical-blank",
92
COL_LABEL, _("New CD/DVD"),
95
if (file_info != NULL) {
96
gtk_list_store_insert_with_values (store, NULL,
98
COL_PIXBUF, "media-optical-data-new",
99
COL_LABEL, _("Existing CD/DVD"),
101
g_object_unref (file_info);
102
selection = COMBOBOX_OPTION_EXISTING_DVD;
105
model = GTK_TREE_MODEL (store);
106
widget = gtk_combo_box_new_with_model (model);
107
renderer = gtk_cell_renderer_pixbuf_new ();
108
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
111
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
113
"icon-name", COL_PIXBUF,
115
renderer = gtk_cell_renderer_text_new ();
116
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
119
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
124
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
130
gboolean send_files (NstPlugin *plugin,
131
GtkWidget *burntype_widget,
134
GFileEnumerator *fenum;
135
GFileInfo *file_info;
138
if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
139
fenum = g_file_enumerate_children (burn,
140
G_FILE_ATTRIBUTE_STANDARD_NAME,
141
G_FILE_QUERY_INFO_NONE,
146
while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
147
child = g_file_get_child (burn,
148
g_file_info_get_name(file_info));
150
g_object_unref (file_info);
151
g_file_delete (child, NULL, NULL);
152
g_object_unref (child);
154
g_object_unref (fenum);
158
copy_files_to (file_list, burn);
160
gtk_show_uri (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
166
gboolean destroy (NstPlugin *plugin){
168
g_object_unref (burn);
175
NstPluginInfo plugin_info = {
178
N_("CD/DVD Creator"),
180
NAUTILUS_CAPS_SEND_DIRECTORIES,
188
NST_INIT_PLUGIN (plugin_info)