mirror of
https://github.com/transmission/transmission.git
synced 2025-12-23 03:48:41 +00:00
(trunk, gtk) use GtkApplication and GtkApplicationWindow
This commit is contained in:
@@ -512,7 +512,7 @@ on_startup( GApplication * application, gpointer user_data )
|
|||||||
gtk_ui_manager_ensure_update ( ui_manager );
|
gtk_ui_manager_ensure_update ( ui_manager );
|
||||||
|
|
||||||
/* create main window now to be a parent to any error dialogs */
|
/* create main window now to be a parent to any error dialogs */
|
||||||
win = GTK_WINDOW( gtr_window_new( ui_manager, cbdata->core ) );
|
win = GTK_WINDOW( gtr_window_new( GTK_APPLICATION( application ), ui_manager, cbdata->core ) );
|
||||||
g_signal_connect( win, "size-allocate", G_CALLBACK( on_main_window_size_allocated ), cbdata );
|
g_signal_connect( win, "size-allocate", G_CALLBACK( on_main_window_size_allocated ), cbdata );
|
||||||
g_application_hold( application );
|
g_application_hold( application );
|
||||||
g_object_weak_ref( G_OBJECT( win ), (GWeakNotify)g_application_release, application );
|
g_object_weak_ref( G_OBJECT( win ), (GWeakNotify)g_application_release, application );
|
||||||
@@ -587,7 +587,7 @@ main( int argc, char ** argv )
|
|||||||
int ret;
|
int ret;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char * application_id;
|
char * application_id;
|
||||||
GApplication * app;
|
GtkApplication * app;
|
||||||
GOptionContext * option_context;
|
GOptionContext * option_context;
|
||||||
bool show_version = false;
|
bool show_version = false;
|
||||||
GError * error = NULL;
|
GError * error = NULL;
|
||||||
@@ -650,11 +650,11 @@ main( int argc, char ** argv )
|
|||||||
/* init the application for the specified config dir */
|
/* init the application for the specified config dir */
|
||||||
stat( cbdata.config_dir, &sb );
|
stat( cbdata.config_dir, &sb );
|
||||||
application_id = g_strdup_printf( "com.transmissionbt.transmission_%lu_%lu", (unsigned long)sb.st_dev, (unsigned long)sb.st_ino );
|
application_id = g_strdup_printf( "com.transmissionbt.transmission_%lu_%lu", (unsigned long)sb.st_dev, (unsigned long)sb.st_ino );
|
||||||
app = g_application_new( application_id, G_APPLICATION_HANDLES_OPEN );
|
app = gtk_application_new( application_id, G_APPLICATION_HANDLES_OPEN );
|
||||||
g_signal_connect( app, "open", G_CALLBACK(on_open), &cbdata );
|
g_signal_connect( app, "open", G_CALLBACK(on_open), &cbdata );
|
||||||
g_signal_connect( app, "startup", G_CALLBACK(on_startup), &cbdata );
|
g_signal_connect( app, "startup", G_CALLBACK(on_startup), &cbdata );
|
||||||
g_signal_connect( app, "activate", G_CALLBACK(on_activate), &cbdata );
|
g_signal_connect( app, "activate", G_CALLBACK(on_activate), &cbdata );
|
||||||
ret = g_application_run (app, argc, argv);
|
ret = g_application_run( G_APPLICATION( app ), argc, argv);
|
||||||
g_object_unref( app );
|
g_object_unref( app );
|
||||||
g_free( application_id );
|
g_free( application_id );
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ onOptionsClicked( GtkButton * button UNUSED, gpointer vp )
|
|||||||
***/
|
***/
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
|
gtr_window_new( GtkApplication * app, GtkUIManager * ui_mgr, TrCore * core )
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
const char * pch;
|
const char * pch;
|
||||||
@@ -593,7 +593,7 @@ gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
|
|||||||
p = g_new0( PrivateData, 1 );
|
p = g_new0( PrivateData, 1 );
|
||||||
|
|
||||||
/* make the window */
|
/* make the window */
|
||||||
self = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
|
self = gtk_application_window_new ( app );
|
||||||
g_object_set_qdata_full( G_OBJECT(self), get_private_data_key( ), p, privateFree );
|
g_object_set_qdata_full( G_OBJECT(self), get_private_data_key( ), p, privateFree );
|
||||||
win = GTK_WINDOW( self );
|
win = GTK_WINDOW( self );
|
||||||
gtk_window_set_title( win, g_get_application_name( ) );
|
gtk_window_set_title( win, g_get_application_name( ) );
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "tr-core.h"
|
#include "tr-core.h"
|
||||||
|
|
||||||
GtkWidget * gtr_window_new( GtkUIManager * uim, TrCore * core );
|
GtkWidget * gtr_window_new( GtkApplication * app, GtkUIManager * uim, TrCore * core );
|
||||||
GtkTreeSelection * gtr_window_get_selection( GtkWindow * );
|
GtkTreeSelection * gtr_window_get_selection( GtkWindow * );
|
||||||
void gtr_window_set_busy( GtkWindow *, gboolean isBusy );
|
void gtr_window_set_busy( GtkWindow *, gboolean isBusy );
|
||||||
void gtr_window_refresh( GtkWindow * );
|
void gtr_window_refresh( GtkWindow * );
|
||||||
|
|||||||
Reference in New Issue
Block a user