~ubuntu-branches/ubuntu/oneiric/alarm-clock/oneiric

« back to all changes in this revision

Viewing changes to src/alarm_runner.c

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-09-06 12:14:17 UTC
  • mfrom: (1.1.11 upstream)
  • mto: (9.2.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20090906121417-8er9o81ggu07jt3w
Tags: 1.2.3-2
* don't do 'make check', it doesn't work right with quilt patches
* add gtk-builder-proper-error-handling patch, used to debug LP 425163
* add fix-duplicate-id, which fixes loading on Ubuntu (LP: #425163)

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
        {
64
64
                if (count_play < current_time.tv_sec)
65
65
                {
66
 
                        gdk_threads_enter();
67
66
                        GtkWidget *stop_sound = GTK_WIDGET (gtk_builder_get_object (gxml, "stop_the_sound_toolbutton"));
68
67
                        gtk_widget_hide(GTK_WIDGET(stop_sound));
69
 
                        gdk_threads_leave();
70
68
                        gst_element_set_state(play, GST_STATE_NULL);
71
69
                        gst_object_unref (bus);
72
70
                        gst_object_unref (play);
90
88
        {
91
89
                gdk_threads_enter();
92
90
                GtkWidget *dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(main_window), 
93
 
                                                                                                                                GTK_DIALOG_DESTROY_WITH_PARENT,
94
 
                                                                                                                                GTK_MESSAGE_WARNING,
95
 
                                                                                                                                GTK_BUTTONS_CLOSE, NULL);
 
91
                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
 
92
                                                                        GTK_MESSAGE_WARNING,
 
93
                                                                        GTK_BUTTONS_CLOSE, NULL);
96
94
        
97
95
                gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), _("<b>Too many sounds!</b>"));
98
96
                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), _("Cannot play more than 1 sound at once."));
120
118
        if (!g_file_test(split[1], G_FILE_TEST_EXISTS))
121
119
        {
122
120
                gdk_threads_enter();
123
 
                
124
121
                gchar *markup = g_strdup_printf(_("Cannot play sound because the sound file <b>%s</b> was not found."), split[1]);
125
122
                GtkWidget *dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(main_window), 
126
 
                                                                                                                                GTK_DIALOG_DESTROY_WITH_PARENT,
127
 
                                                                                                                                GTK_MESSAGE_WARNING,
128
 
                                                                                                                                GTK_BUTTONS_CLOSE, NULL);
 
123
                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
 
124
                                                                        GTK_MESSAGE_WARNING,
 
125
                                                                        GTK_BUTTONS_CLOSE, NULL);
129
126
 
130
127
                gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), _("<b>Cannot find sound file!</b>"));
131
128
                gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), markup, NULL);
132
129
        
133
130
                gtk_dialog_run (GTK_DIALOG (dialog));
134
131
                gtk_widget_destroy (dialog);
135
 
                gdk_threads_leave();
 
132
 
136
133
                g_free(markup);
137
134
                g_strfreev(split);
138
135
                g_free(soundfile);
139
136
                g_free(name);
 
137
                gdk_threads_leave();
140
138
                return;
141
139
        }
142
140
        
148
146
        
149
147
        GstBus *bus;
150
148
        
151
 
        gdk_threads_enter();
152
 
        GtkWidget *stop_sound = GTK_WIDGET (gtk_builder_get_object (gxml, "stop_the_sound_toolbutton"));
153
 
        gtk_widget_show(GTK_WIDGET(stop_sound));
154
 
        gdk_threads_leave();
155
 
        
156
 
        
157
149
        play = gst_element_factory_make ("playbin", "playbin");
158
150
        g_object_set (G_OBJECT (play), "uri", soundfile, NULL);
159
151
 
 
152
 
 
153
 
160
154
        bus = gst_pipeline_get_bus (GST_PIPELINE (play));
 
155
 
161
156
        if (g_key_file_get_boolean(loaded_alarms, name, "ConstantSoundEnabled", NULL))
162
157
        {
163
158
                count_play = g_key_file_get_integer(loaded_alarms, name, "ConstantSoundValue", NULL);
174
169
                gst_element_set_state (play, GST_STATE_PLAYING);
175
170
        }
176
171
 
 
172
 
177
173
        if (g_key_file_get_boolean(loaded_alarms, name, "FadeSoundEnabled", NULL))
178
174
        {
179
175
                fade_enabled = TRUE;
190
186
                g_thread_create((GThreadFunc) volume_fade_thread, g_strdup(name), FALSE, NULL);
191
187
                
192
188
                gst_bus_add_watch (bus, constant_bus_callback, NULL);
193
 
 
194
189
                gst_element_set_state (play, GST_STATE_PLAYING);
195
 
 
196
190
        }
 
191
 
 
192
        
197
193
        
198
194
        g_free(name);
199
195
        g_free(soundfile);
 
196
 
 
197
        gdk_threads_enter();
 
198
        GtkWidget *stop_sound = GTK_WIDGET (gtk_builder_get_object (gxml, "stop_the_sound_toolbutton"));
 
199
        gtk_widget_show(GTK_WIDGET(stop_sound));
 
200
        gdk_threads_leave();
200
201
}
201
202
 
202
203
void
383
384
{
384
385
        gchar *alarm_name;
385
386
        gchar *alarm_code = g_strdup(name);
386
 
        
 
387
 
387
388
        alarm_name = g_key_file_get_string(loaded_alarms, name, "Title", NULL);
388
389
        
389
390
        if (g_key_file_get_boolean(loaded_alarms, name, "SoundEnabled", NULL))
390
391
                g_thread_create((GThreadFunc) start_sound, alarm_code, FALSE, NULL);
391
392
        
392
393
        if (g_key_file_get_boolean(loaded_alarms, name, "PassivePopupEnabled", NULL))
 
394
        {
393
395
                show_popup(alarm_code);
 
396
        }
394
397
        
395
398
        if (g_key_file_get_boolean(loaded_alarms, name, "DialogWindowEnabled", NULL))
 
399
        {
396
400
                show_dialog(alarm_code);
 
401
        }
397
402
        
398
403
        if (g_key_file_get_boolean(loaded_alarms, name, "RunCommand", NULL))
 
404
        {
399
405
                show_command(alarm_code);
 
406
        }
400
407
 
401
408
        if (g_key_file_get_boolean(loaded_alarms, name, "ActionEnabled", NULL))
 
409
        {
402
410
                show_standard_action(alarm_code);
403
 
        
 
411
        }
404
412
        g_free(alarm_name);
 
413
 
 
414
 
405
415
}
406
416
 
407
417
void