summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-20 20:14:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-12-21 09:43:51 +0100
commit6fb2a92af8c612fbb3ffb76a89d1729a9891829f (patch)
tree27fba11c494247fbd50c743c55180042959e3edc /vcl
parent2952166e3359156db763e94603c934bccefea051 (diff)
drop GTK_STOCK_* label uses
Change-Id: I63b0bd0cfd62fbcf93de75dd62ca9a5daca1a8c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108062 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx59
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx2
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx4
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkPicker.hxx26
4 files changed, 49 insertions, 42 deletions
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 1129eee40ba3..14b9feb6faa5 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -119,8 +119,8 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(),
nullptr,
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ getCancelText().getStr(), GTK_RESPONSE_CANCEL,
+ getOpenText().getStr(), GTK_RESPONSE_ACCEPT,
nullptr );
gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT );
@@ -1326,20 +1326,7 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const OUString&
}
OString aTxt = OUStringToOString( rLabel.replace('~', '_'), RTL_TEXTENCODING_UTF8 );
- if (nControlId == ExtendedFilePickerElementIds::PUSHBUTTON_PLAY)
- {
-#ifdef GTK_STOCK_MEDIA_PLAY
- if (msPlayLabel.isEmpty())
- msPlayLabel = rLabel;
- if (msPlayLabel == rLabel)
- gtk_button_set_label(GTK_BUTTON(pWidget), GTK_STOCK_MEDIA_PLAY);
- else
- gtk_button_set_label(GTK_BUTTON(pWidget), GTK_STOCK_MEDIA_STOP);
-#else
- gtk_button_set_label(GTK_BUTTON(pWidget), aTxt.getStr());
-#endif
- }
- else if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL )
+ if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL )
g_object_set( pWidget, "label", aTxt.getStr(),
"use_underline", true, nullptr );
else
@@ -1594,7 +1581,9 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
}
GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- const gchar *first_button_text = GTK_STOCK_OPEN;
+ OString sOpen = getOpenText();
+ OString sSave = getSaveText();
+ const gchar *first_button_text = sOpen.getStr();
SolarMutexGuard g;
@@ -1604,22 +1593,22 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
{
case FILEOPEN_SIMPLE:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
break;
case FILESAVE_SIMPLE:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE;
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
break;
case FILESAVE_AUTOEXTENSION_PASSWORD:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE;
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
mbToggleVisibility[PASSWORD] = true;
mbToggleVisibility[GPGENCRYPTION] = true;
// TODO
break;
case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE;
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
mbToggleVisibility[PASSWORD] = true;
mbToggleVisibility[GPGENCRYPTION] = true;
mbToggleVisibility[FILTEROPTIONS] = true;
@@ -1627,19 +1616,19 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
break;
case FILESAVE_AUTOEXTENSION_SELECTION:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE; // SELECT_FOLDER ?
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
mbToggleVisibility[SELECTION] = true;
// TODO
break;
case FILESAVE_AUTOEXTENSION_TEMPLATE:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE;
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
mbListVisibility[TEMPLATE] = true;
// TODO
break;
case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[LINK] = true;
mbToggleVisibility[PREVIEW] = true;
mbListVisibility[IMAGE_TEMPLATE] = true;
@@ -1647,7 +1636,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
break;
case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[LINK] = true;
mbToggleVisibility[PREVIEW] = true;
mbListVisibility[IMAGE_ANCHOR] = true;
@@ -1655,38 +1644,38 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
break;
case FILEOPEN_PLAY:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbButtonVisibility[PLAY] = true;
// TODO
break;
case FILEOPEN_LINK_PLAY:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[LINK] = true;
mbButtonVisibility[PLAY] = true;
// TODO
break;
case FILEOPEN_READONLY_VERSION:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[READONLY] = true;
mbListVisibility[VERSION] = true;
break;
case FILEOPEN_LINK_PREVIEW:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[LINK] = true;
mbToggleVisibility[PREVIEW] = true;
// TODO
break;
case FILESAVE_AUTOEXTENSION:
eAction = GTK_FILE_CHOOSER_ACTION_SAVE;
- first_button_text = GTK_STOCK_SAVE;
+ first_button_text = sSave.getStr();
// TODO
break;
case FILEOPEN_PREVIEW:
eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
- first_button_text = GTK_STOCK_OPEN;
+ first_button_text = sOpen.getStr();
mbToggleVisibility[PREVIEW] = true;
// TODO
break;
@@ -1706,17 +1695,15 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
gtk_file_chooser_set_action( GTK_FILE_CHOOSER( m_pDialog ), eAction);
dialog_remove_buttons( GTK_DIALOG( m_pDialog ) );
- gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL );
+ gtk_dialog_add_button(GTK_DIALOG( m_pDialog ),
+ getCancelText().getStr(),
+ GTK_RESPONSE_CANCEL);
for( int nTVIndex = 0; nTVIndex < BUTTON_LAST; nTVIndex++ )
{
if( mbButtonVisibility[nTVIndex] )
{
-#ifdef GTK_STOCK_MEDIA_PLAY
- m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), GTK_STOCK_MEDIA_PLAY, 1 );
-#else
OString aPlay = OUStringToOString( getResString( PUSHBUTTON_PLAY ), RTL_TEXTENCODING_UTF8 );
m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), aPlay.getStr(), 1 );
-#endif
}
}
gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), first_button_text, GTK_RESPONSE_ACCEPT );
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
index e6a3d611cd95..7cfe6a6199ee 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
@@ -147,7 +147,6 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
private:
css::uno::Reference< css::ui::dialogs::XFilePickerListener >
m_xListener;
- OUString msPlayLabel;
std::unique_ptr<std::vector<FilterEntry>> m_pFilterVector;
GtkWidget *m_pParentWidget;
GtkWidget *m_pVBox;
@@ -234,6 +233,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
virtual ~SalGtkFilePicker() override;
};
+
#endif // INCLUDED_VCL_UNX_GTK_FPICKER_SALGTKFILEPICKER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
index bb940cf5fcfb..8d8319daf3ba 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx
@@ -45,8 +45,8 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference< uno::XComponentCon
{
m_pDialog = gtk_file_chooser_dialog_new(
OUStringToOString( getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(),
- nullptr, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, nullptr );
+ nullptr, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, getCancelText().getStr(), GTK_RESPONSE_CANCEL,
+ getOKText().getStr(), GTK_RESPONSE_ACCEPT, nullptr );
gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT );
#if ENABLE_GIO
diff --git a/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx b/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx
index e38f48df22d1..36cab844df52 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkPicker.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_VCL_UNX_GTK_FPICKER_SALGTKPICKER_HXX
-#define INCLUDED_VCL_UNX_GTK_FPICKER_SALGTKPICKER_HXX
+#pragma once
#include <sal/config.h>
@@ -34,6 +33,9 @@
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <strings.hrc>
+#include <svdata.hxx>
+
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -116,6 +118,24 @@ public:
static GtkWindow* GetTransientFor();
};
-#endif
+inline OString getCancelText()
+{
+ return VclResId(SV_BUTTONTEXT_CANCEL).replace('~', '_').toUtf8();
+}
+
+inline OString getOpenText()
+{
+ return VclResId(SV_BUTTONTEXT_OPEN).replace('~', '_').toUtf8();
+}
+
+inline OString getSaveText()
+{
+ return VclResId(SV_BUTTONTEXT_SAVE).replace('~', '_').toUtf8();
+}
+
+inline OString getOKText()
+{
+ return VclResId(SV_BUTTONTEXT_OK).replace('~', '_').toUtf8();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */