ghb_hal_init();
#endif
+ if (!ghb_lock_file("queue_lock"))
+ {
+ const gchar *markup =
+ N_("<b><big>Another instance of HandBrake is already running.</big></b>\n"
+ "\n"
+ "Only one instance of HandBrake may run.\n");
+ GtkWidget *dialog = gtk_message_dialog_new_with_markup(NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _(markup));
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ exit(EXIT_FAILURE);
+ }
ud = g_malloc0(sizeof(signal_user_data_t));
ud->debug = ghb_debug;
g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
* any later version.
*
*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gstdio.h>
return plist;
}
+gboolean
+ghb_lock_file(const gchar *name)
+{
+ gchar *config, *path;
+ int fd, lock = 0;
+
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
+ if (fd >= 0)
+ lock = lockf(fd, F_TLOCK, 0);
+ if (lock)
+ close(fd);
+ g_free(config);
+ g_free(path);
+ return !lock;
+}
+
static void
remove_plist(const gchar *name)
{
gboolean ghb_preset_is_custom(void);
void ghb_prefs_store(void);
void ghb_pref_set(GValue *settings, const gchar *key);
+gboolean ghb_lock_file(const gchar *name);
#endif // _GHB_PRESETS_H_
{
GtkWidget *toggle;
gboolean active;
- gint signal_id;
- gint handler_id = 0;
GtkWidget *window;
g_debug("picture_settings_alt2_clicked_cb()");