ngHideOnClose.cpp
Go to the documentation of this file.
1 /*
2  * BEGIN NIGHTINGALE GPL
3  *
4  * This file is part of the Nightingale Media Player.
5  *
6  * Copyright(c) 2014
7  * http://www.getnightingale.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the "GPL").
11  *
12  * Software distributed under the License is distributed
13  * on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * END NIGHTINGALE GPL
23  */
24 
25 #include "ngHideOnClose.h"
26 
27 static GtkWindow *playerGtkWindow = NULL;
28 
29 void onRaise(GtkWidget *window, gpointer data)
30 {
31  gdk_window_show(((GtkWidget*) playerGtkWindow)->window);
32 }
33 
34 void checkWindowTitle(gpointer data, gpointer user_data)
35 {
36  const gchar *title = gtk_window_get_title((GtkWindow*) data);
37 
38  if (playerGtkWindow || g_strcmp0(title, (char*) user_data)) return;
39 
40  playerGtkWindow = (GtkWindow*) data;
41 }
42 
44 
46 {
47 }
48 
50 {
51 
52 }
53 
54 NS_IMETHODIMP ngHideOnClose::InitializeFor(const char* desktopFileName, const char* windowTitle)
55 {
56  if (!desktopFileName || !windowTitle) return NS_ERROR_INVALID_ARG;
57 
58  GList* wlist = gtk_window_list_toplevels();
59  g_list_foreach(wlist, checkWindowTitle, (gpointer) windowTitle);
60  g_list_free(wlist);
61 
62  if (!playerGtkWindow) return NS_ERROR_INVALID_ARG;
63 
64  return NS_OK;
65 }
66 
67 NS_IMETHODIMP ngHideOnClose::HideWindow()
68 {
69  gdk_window_hide(((GtkWidget*) playerGtkWindow)->window);
70 
71  return NS_OK;
72 }
73 
74 NS_IMETHODIMP ngHideOnClose::ShowWindow()
75 {
76  gdk_window_show(((GtkWidget*) playerGtkWindow)->window);
77 
78  return NS_OK;
79 }
return NS_OK
void checkWindowTitle(gpointer data, gpointer user_data)
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
void onRaise(GtkWidget *window, gpointer data)
virtual ~ngHideOnClose()
static GtkWindow * playerGtkWindow
let window
void InitializeFor(in string desktopFileName, in string windowTitle)
observe data
Definition: FeedWriter.js:1329